29 #ifndef OOMPH_PML_TIME_HARMONIC_LINEAR_ELASTICITY_ELEMENTS_HEADER
30 #define OOMPH_PML_TIME_HARMONIC_LINEAR_ELASTICITY_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
46 #include "../generic/Qelements.h"
47 #include "../generic/mesh.h"
48 #include "../generic/hermite_elements.h"
50 #include "../generic/projection.h"
51 #include "../generic/nodes.h"
52 #include "../generic/oomph_utilities.h"
53 #include "../generic/pml_meshes.h"
54 #include "../generic/pml_mapping_functions.h"
77 template<
unsigned DIM>
99 const unsigned i)
const
101 return std::complex<unsigned>(
i,
i +
DIM);
109 unsigned n_node =
nnode();
117 for (
unsigned i = 0;
i <
DIM;
i++)
120 std::complex<unsigned> u_nodal_index =
124 disp[
i] = std::complex<double>(0.0, 0.0);
127 for (
unsigned l = 0; l < n_node; l++)
129 const std::complex<double> u_value(
133 disp[
i] += u_value * psi[l];
143 unsigned n_node =
nnode();
152 std::complex<unsigned> u_nodal_index =
156 std::complex<double> interpolated_u(0.0, 0.0);
159 for (
unsigned l = 0; l < n_node; l++)
161 const std::complex<double> u_value(
165 interpolated_u += u_value * psi[l];
168 return (interpolated_u);
185 inline std::complex<double>
E(
const unsigned&
i,
188 const unsigned& l)
const
194 inline double nu()
const
237 Vector<std::complex<double>>&
b)
const
244 for (
unsigned i = 0;
i <
n;
i++)
246 b[
i] = std::complex<double>(0.0, 0.0);
252 (*Body_force_fct_pt)(
x,
b);
263 values_to_pin.resize(
DIM * 2);
264 for (
unsigned j = 0;
j <
DIM * 2;
j++)
266 values_to_pin[
j] =
j;
285 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
289 std::pair<unsigned long, unsigned> dof_lookup;
292 const unsigned n_node = this->
nnode();
295 int local_unknown = 0;
298 for (
unsigned n = 0;
n < n_node;
n++)
301 for (
unsigned i = 0;
i < 2 *
DIM;
i++)
307 if (local_unknown >= 0)
311 dof_lookup.first = this->
eqn_number(local_unknown);
312 dof_lookup.second = 0;
315 dof_lookup_list.push_front(dof_lookup);
334 Vector<std::complex<double>>& pml_inverse_jacobian_diagonal,
335 std::complex<double>& pml_jacobian_det)
339 for (
unsigned k = 0;
k <
DIM;
k++)
341 pml_inverse_jacobian_diagonal[
k] = std::complex<double>(1.0, 0.0);
343 pml_jacobian_det = std::complex<double>(1.0, 0.0);
350 for (
unsigned k = 0;
k <
DIM;
k++)
358 for (
unsigned k = 0;
k <
DIM;
k++)
368 std::ostringstream error_message_stream;
369 error_message_stream <<
"Pml_mapping_pt needs to be set "
381 double wavenumber_squared = 2.0 * (1.0 + this->
nu()) * this->
omega_sq();
383 for (
unsigned k = 0;
k <
DIM;
k++)
388 std::complex<double> pml_gamma =
393 pml_inverse_jacobian_diagonal[
k] = 1.0 / pml_gamma;
395 pml_jacobian_det *= pml_gamma;
445 template<
unsigned DIM>
475 ->fill_in_generic_contribution_to_residuals_time_harmonic_linear_elasticity(
476 residuals, jacobian, 1);
486 const unsigned& nplot,
497 void output(std::ostream& outfile,
const unsigned& n_plot);
508 void output(FILE* file_pt,
const unsigned& n_plot);
516 std::ostream& outfile,
519 const unsigned& nplot);
529 const unsigned& n_plot);
537 const unsigned& n_plot);
557 std::ostringstream error_stream;
558 error_stream <<
"There is no time-dependent compute_error() " << std::endl
559 <<
"for pml time harmonic linear elasticity elements"
581 template<
unsigned DIM,
unsigned NNODE_1D>
583 :
public virtual QElement<DIM, NNODE_1D>,
601 void output(std::ostream& outfile,
const unsigned& n_plot)
614 void output(FILE* file_pt,
const unsigned& n_plot)
711 template<
class TIME_HARMONIC_LINEAR_ELAST_ELEMENT>
733 unsigned nnod = this->
nnode();
734 for (
unsigned j = 0;
j < nnod;
j++)
737 data_values.push_back(std::make_pair(this->
node_pt(
j), fld));
748 return 2 * this->
dim();
758 std::stringstream error_stream;
759 error_stream <<
"Elements only store four fields so fld can't be"
760 <<
" " << fld << std::endl;
782 unsigned n_dim = this->
dim();
783 unsigned n_node = this->
nnode();
784 DShape dpsidx(n_node, n_dim);
798 unsigned n_node = this->
nnode();
811 double interpolated_u = 0.0;
814 for (
unsigned l = 0; l < n_node; l++)
818 if (nvalue != 2 * n_dim)
820 std::stringstream error_stream;
822 <<
"Current implementation only works for non-resized nodes\n"
823 <<
"but nvalue= " << nvalue <<
"!= 2 dim = " << 2 * n_dim
830 interpolated_u += this->
nodal_value(t, l, fld) * psi[l];
832 return interpolated_u;
839 return this->
nnode();
849 if (nvalue != 2 * n_dim)
851 std::stringstream error_stream;
853 <<
"Current implementation only works for non-resized nodes\n"
854 <<
"but nvalue= " << nvalue <<
"!= 2 dim = " << 2 * n_dim
869 template<
class ELEMENT>
882 template<
class ELEMENT>
901 template<
unsigned NNODE_1D>
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: pml_mapping_functions.h:91
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
unsigned ntstorage() const
Definition: nodes.cc:879
Definition: matrices.h:386
FaceGeometry()
Definition: pml_time_harmonic_linear_elasticity_elements.h:888
FaceGeometry()
Definition: pml_time_harmonic_linear_elasticity_elements.h:874
FaceGeometry()
Constructor must call the constructor of the underlying solid element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:631
FaceGeometry()
Constructor must call the constructor of the underlying element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:645
FaceGeometry()
Constructor must call the constructor of the underlying element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:659
FaceGeometry()
Constructor must call the constructor of the underlying element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:673
FaceGeometry()
Constructor must call the constructor of the underlying element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:686
FaceGeometry()
Constructor must call the constructor of the underlying element.
Definition: pml_time_harmonic_linear_elasticity_elements.h:700
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
virtual void shape(const Vector< double > &s, Shape &psi) const =0
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Definition: elements.h:1432
unsigned dim() const
Definition: elements.h:2611
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3298
unsigned long eqn_number(const unsigned &ieqn_local) const
Definition: elements.h:704
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
Definition: nodes.h:1022
Definition: oomph_definitions.h:222
Base class for elements with pml capabilities.
Definition: pml_meshes.h:60
bool Pml_is_enabled
Boolean indicating if element is used in pml mode.
Definition: pml_meshes.h:119
std::vector< bool > Pml_direction_active
Definition: pml_meshes.h:124
Vector< double > Pml_outer_boundary
Definition: pml_meshes.h:134
Vector< double > Pml_inner_boundary
Definition: pml_meshes.h:129
PMLLayerElement()
Definition: pml_time_harmonic_linear_elasticity_elements.h:908
Definition: pml_meshes.h:48
Definition: pml_mapping_functions.h:46
virtual std::complex< double > gamma(const double &nu_i, const double &pml_width_i, const double &wavenumber_squared, const double &alpha_shift=0.0)=0
Definition: pml_time_harmonic_elasticity_tensor.h:150
double nu() const
Poisson's ratio.
Definition: pml_time_harmonic_elasticity_tensor.h:194
Definition: pml_time_harmonic_linear_elasticity_elements.h:81
double *& omega_sq_pt()
Access function for square of non-dim frequency.
Definition: pml_time_harmonic_linear_elasticity_elements.h:206
BodyForceFctPt body_force_fct_pt() const
Access function: Pointer to body force function (const version)
Definition: pml_time_harmonic_linear_elasticity_elements.h:218
unsigned ndof_types() const
Definition: pml_time_harmonic_linear_elasticity_elements.h:273
void body_force(const Vector< double > &x, Vector< std::complex< double >> &b) const
Definition: pml_time_harmonic_linear_elasticity_elements.h:236
BodyForceFctPt & body_force_fct_pt()
Access function: Pointer to body force function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:212
std::complex< double > E(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Access function to the entries in the elasticity tensor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:185
PMLTimeHarmonicIsotropicElasticityTensor *& elasticity_tensor_pt()
Return the pointer to the elasticity_tensor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:179
virtual void get_stress(const Vector< double > &s, DenseMatrix< std::complex< double >> &sigma) const =0
double nu() const
Access function to nu in the elasticity tensor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:194
static ContinuousBermudezPMLMapping Default_pml_mapping
Definition: pml_time_harmonic_linear_elasticity_elements.h:415
void values_to_be_pinned_on_outer_pml_boundary(Vector< unsigned > &values_to_pin)
Definition: pml_time_harmonic_linear_elasticity_elements.h:260
static double Default_omega_sq_value
Static default value for square of frequency.
Definition: pml_time_harmonic_linear_elasticity_elements.h:428
PMLMapping * Pml_mapping_pt
Definition: pml_time_harmonic_linear_elasticity_elements.h:432
BodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:425
virtual std::complex< unsigned > u_index_time_harmonic_linear_elasticity(const unsigned i) const
Definition: pml_time_harmonic_linear_elasticity_elements.h:98
const double & omega_sq() const
Access function for square of non-dim frequency.
Definition: pml_time_harmonic_linear_elasticity_elements.h:200
PMLTimeHarmonicIsotropicElasticityTensor * Elasticity_tensor_pt
Pointer to the elasticity tensor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:419
std::complex< double > interpolated_u_time_harmonic_linear_elasticity(const Vector< double > &s, const unsigned &i) const
Return FE interpolated displacement u[i] at local coordinate s.
Definition: pml_time_harmonic_linear_elasticity_elements.h:139
PMLTimeHarmonicLinearElasticityEquationsBase()
Definition: pml_time_harmonic_linear_elasticity_elements.h:86
PMLMapping *const & pml_mapping_pt() const
Return a pointer to the PML Mapping object (const version)
Definition: pml_time_harmonic_linear_elasticity_elements.h:408
void get_strain(const Vector< double > &s, DenseMatrix< std::complex< double >> &strain) const
Return the strain tensor.
Definition: pml_time_harmonic_linear_elasticity_elements.cc:49
PMLMapping *& pml_mapping_pt()
Return a pointer to the PML Mapping object.
Definition: pml_time_harmonic_linear_elasticity_elements.h:402
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Definition: pml_time_harmonic_linear_elasticity_elements.h:284
void interpolated_u_time_harmonic_linear_elasticity(const Vector< double > &s, Vector< std::complex< double >> &disp) const
Compute vector of FE interpolated displacement u at local coordinate s.
Definition: pml_time_harmonic_linear_elasticity_elements.h:105
void(* BodyForceFctPt)(const Vector< double > &x, Vector< std::complex< double >> &b)
Definition: pml_time_harmonic_linear_elasticity_elements.h:175
void compute_pml_coefficients(const unsigned &ipt, const Vector< double > &x, Vector< std::complex< double >> &pml_inverse_jacobian_diagonal, std::complex< double > &pml_jacobian_det)
Definition: pml_time_harmonic_linear_elasticity_elements.h:331
double * Omega_sq_pt
Square of nondim frequency.
Definition: pml_time_harmonic_linear_elasticity_elements.h:422
Definition: pml_time_harmonic_linear_elasticity_elements.h:448
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: pml_time_harmonic_linear_elasticity_elements.h:470
void output_imag(std::ostream &outfile, const double &phi, const unsigned &n_plot)
Definition: pml_time_harmonic_linear_elasticity_elements.cc:768
void get_stress(const Vector< double > &s, DenseMatrix< std::complex< double >> &sigma) const
Definition: pml_time_harmonic_linear_elasticity_elements.cc:152
void compute_norm(double &norm)
Compute norm of solution: square of the L2 norm.
Definition: pml_time_harmonic_linear_elasticity_elements.cc:863
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Definition: pml_time_harmonic_linear_elasticity_elements.h:461
unsigned required_nvalue(const unsigned &n) const
Number of values required at node n.
Definition: pml_time_harmonic_linear_elasticity_elements.h:454
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
Definition: pml_time_harmonic_linear_elasticity_elements.h:551
void output(std::ostream &outfile)
Output: x,y,[z],u_r,v_r,[w_r],u_i,v_i,[w_i].
Definition: pml_time_harmonic_linear_elasticity_elements.h:490
virtual void fill_in_generic_contribution_to_residuals_time_harmonic_linear_elasticity(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: pml_time_harmonic_linear_elasticity_elements.cc:197
void output_total_real(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt incoming_wave_fct_pt, const double &phi, const unsigned &nplot)
Definition: pml_time_harmonic_linear_elasticity_elements.cc:651
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact solution x,y,[z],u_r,v_r,[w_r],u_i,v_i,[w_i].
Definition: pml_time_harmonic_linear_elasticity_elements.cc:538
void output_real(std::ostream &outfile, const double &phi, const unsigned &n_plot)
Definition: pml_time_harmonic_linear_elasticity_elements.cc:715
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
Definition: pml_time_harmonic_linear_elasticity_elements.cc:923
void output(FILE *file_pt)
C-style output: x,y,[z],u_r,v_r,[w_r],u_i,v_i,[w_i].
Definition: pml_time_harmonic_linear_elasticity_elements.h:501
PMLTimeHarmonicLinearElasticityEquations()
Constructor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:451
Definition: projection.h:183
Time-harmonic linear elasticity upgraded to become projectable.
Definition: pml_time_harmonic_linear_elasticity_elements.h:714
unsigned nhistory_values_for_projection(const unsigned &fld)
Definition: pml_time_harmonic_linear_elasticity_elements.h:753
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld.
Definition: pml_time_harmonic_linear_elasticity_elements.h:837
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Definition: pml_time_harmonic_linear_elasticity_elements.h:794
unsigned nfields_for_projection()
Definition: pml_time_harmonic_linear_elasticity_elements.h:746
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Definition: pml_time_harmonic_linear_elasticity_elements.h:727
ProjectablePMLTimeHarmonicLinearElasticityElement()
Definition: pml_time_harmonic_linear_elasticity_elements.h:718
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
Definition: pml_time_harmonic_linear_elasticity_elements.h:844
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Definition: pml_time_harmonic_linear_elasticity_elements.h:778
unsigned nhistory_values_for_coordinate_projection()
Definition: pml_time_harmonic_linear_elasticity_elements.h:771
Definition: Qelements.h:459
Definition: pml_time_harmonic_linear_elasticity_elements.h:585
void output(std::ostream &outfile)
Output function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:595
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:614
void output(FILE *file_pt)
C-style output function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:608
void output(std::ostream &outfile, const unsigned &n_plot)
Output function.
Definition: pml_time_harmonic_linear_elasticity_elements.h:601
QPMLTimeHarmonicLinearElasticityElement()
Constructor.
Definition: pml_time_harmonic_linear_elasticity_elements.h:588
unsigned ntstorage() const
Definition: timesteppers.h:601
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
#define DIM
Definition: linearised_navier_stokes_elements.h:44
int error
Definition: calibrate.py:297
int sigma
Definition: calibrate.py:179
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2