26#ifndef OOMPH_PML_MESH_HEADER
27#define OOMPH_PML_MESH_HEADER
31#include <oomph-lib-config.h>
35#include "../meshes/rectangular_quadmesh.template.h"
36#include "../meshes/rectangular_quadmesh.template.cc"
46 template<
class ELEMENT>
58 template<
unsigned DIM>
145 namespace TwoDimensionalPMLHelper
184 template<
class ELEMENT>
232 double tol = 1.0e-12;
256 const unsigned nx = this->
nx();
259 const unsigned ny = this->
ny();
312 for (
unsigned i = 0;
i <
nx;
i++)
328 for (
unsigned i = 0;
i <
ny;
i++)
357 for (
unsigned i = 0;
i <
nx;
i++)
379 <<
"has not been found." << std::endl;
388 for (
unsigned i = 0;
i <
ny;
i++)
410 <<
"has not been found." << std::endl;
429 template<
class ELEMENT>
442 const unsigned& boundary_id,
520 for (
unsigned j = 0;
j <
nnod;
j++)
557 if (
inod % nnode_1d == 0)
589 if ((
int)(
inod / nnode_1d) == 0)
694 if (
inod % nnode_1d == 0)
775 template<
class ELEMENT>
905 if ((
inod % nnode_1d == 0) && (
inod > 0))
920 if ((
inod % nnode_1d) == 0)
956 if (((
int)(
inod / nnode_1d) == 0) && (
inod > 0))
971 if ((
int)(
inod / nnode_1d) == 0)
1080 if ((
inod % nnode_1d == 0) &&
1096 if ((
inod % nnode_1d) == 0)
1132 if (((
unsigned)(
inod / nnode_1d) ==
1257 (
inod > (nnode_1d - 1)))
1309 if (((
int)(
inod / nnode_1d) == 0) &&
1317 if (
inod == (nnode_1d - 1))
1325 if ((
int)(
inod / nnode_1d) == 0)
1485 if (((
unsigned)(
inod / nnode_1d) ==
1532 namespace TwoDimensionalPMLHelper
1538 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
1626 for (
unsigned j = 0;
j <
npin;
j++)
1645 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
1732 for (
unsigned j = 0;
j <
npin;
j++)
1751 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
1840 for (
unsigned j = 0;
j <
npin;
j++)
1859 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
1948 for (
unsigned j = 0;
j <
npin;
j++)
1967 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
2081 if ((b == 1) || (b == 2))
2083 for (
unsigned j = 0;
j <
npin;
j++)
2102 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
2212 if ((b == 0) || (b == 1))
2214 for (
unsigned j = 0;
j <
npin;
j++)
2233 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
2345 if ((b == 2) || (b == 3))
2347 for (
unsigned j = 0;
j <
npin;
j++)
2366 template<
class ASSOCIATED_PML_QUAD_ELEMENT>
2473 if ((b == 0) || (b == 3))
2475 for (
unsigned j = 0;
j <
npin;
j++)
A general Finite Element class.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
unsigned nnode() const
Return the number of nodes.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
FiniteElement * boundary_element_pt(const unsigned &b, const unsigned &e) const
Return pointer to e-th finite element on boundary b.
unsigned long nnode() const
Return number of nodes in the mesh.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Vector< Node * > prune_dead_nodes()
Prune nodes. Nodes that have been marked as obsolete are removed from the mesh (and its boundary-node...
unsigned long nelement() const
Return number of elements in the mesh.
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void set_obsolete()
Mark node as obsolete.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
PMLCornerQuadMesh(Mesh *PMLQuad_mesh_x_pt, Mesh *PMLQuad_mesh_y_pt, Mesh *bulk_mesh_pt, Node *special_corner_node_pt, const unsigned &parent_boundary_x_id, const unsigned &parent_boundary_y_id, const unsigned ¤t_boundary_x_id, const unsigned ¤t_boundary_y_id, const unsigned &n_pml_x, const unsigned &n_pml_y, const double &x_pml_start, const double &x_pml_end, const double &y_pml_start, const double &y_pml_end, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to "bulk" mesh and the two existing PML meshes in order to construct the co...
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
bool Pml_is_enabled
Boolean indicating if element is used in pml mode.
virtual ~PMLElementBase()
Virtual destructor.
void enable_pml(const int &direction, const double &interface_border_value, const double &outer_domain_border_value)
Enable pml. Specify the coordinate direction along which pml boundary is constant,...
void disable_pml()
Disable pml. Ensures the PML-ification in all directions has been deactivated.
std::vector< bool > Pml_direction_active
Coordinate direction along which pml boundary is constant; alternatively: coordinate direction in whi...
Vector< double > Pml_outer_boundary
Coordinate of outer pml boundary (Storage is provided for any coordinate direction; only the entries ...
Vector< double > Pml_inner_boundary
Coordinate of inner pml boundary (Storage is provided for any coordinate direction; only the entries ...
PMLElementBase()
Constructor.
virtual void values_to_be_pinned_on_outer_pml_boundary(Vector< unsigned > &values_to_pin)=0
Pure virtual function in which we have to specify the values to be pinned (and set to zero) on the ou...
General definition of policy class defining the elements to be used in the actual PML layers....
/////////////////////////////////////////////////////////////// /////////////////////////////////////...
virtual void pml_locate_zeta(const Vector< double > &x, FiniteElement *&el_pt)=0
Pure virtual function to provide an optimised version of the locate_zeta function for PML meshes....
PML mesh class. Policy class for 2D PML meshes.
void pml_locate_zeta(const Vector< double > &x, FiniteElement *&coarse_mesh_el_pt)
Overloaded function to allow the user to locate an element in mesh given the (Eulerian) position of a...
PMLQuadMeshBase(const unsigned &n_pml_x, const unsigned &n_pml_y, const double &x_pml_start, const double &x_pml_end, const double &y_pml_start, const double &y_pml_end, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Create the underlying rectangular quad mesh.
PML mesh, derived from RectangularQuadMesh.
PMLQuadMesh(Mesh *bulk_mesh_pt, const unsigned &boundary_id, const unsigned &quad_boundary_id, const unsigned &n_pml_x, const unsigned &n_pml_y, const double &x_pml_start, const double &x_pml_end, const double &y_pml_start, const double &y_pml_end, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to "bulk" mesh, the boundary ID of axis aligned boundary to which the mesh ...
RectangularQuadMesh is a two-dimensional mesh of Quad elements with Nx elements in the "x" (horizonal...
const unsigned & ny() const
Return number of elements in y direction.
const double y_min() const
Return the minimum value of y coordinate.
const double x_max() const
Return the maximum value of x coordinate.
const double y_max() const
Return the maximum value of y coordinate.
const unsigned & nx() const
Return number of elements in x direction.
const double x_min() const
Return the minimum value of x coordinate.
//////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////// //////////////////////////////...
bool sorter_bottom_boundary(Node *nod_i_pt, Node *nod_j_pt)
helper function for sorting the bottom boundary nodes
Mesh * create_bottom_left_pml_mesh(Mesh *pml_left_mesh_pt, Mesh *pml_bottom_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML bottom left corner mesh, aligned with the existing PML meshes
Mesh * create_top_left_pml_mesh(Mesh *pml_left_mesh_pt, Mesh *pml_top_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML top left corner mesh, aligned with the existing PML meshes
Mesh * create_bottom_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &bottom_boundary_id, const unsigned &n_y_bottom_pml, const double &width_y_bottom_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML mesh,aligned with the bottom physical domain boundary
Mesh * create_top_right_pml_mesh(Mesh *pml_right_mesh_pt, Mesh *pml_top_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML top right corner mesh, aligned with the existing PML meshes
bool sorter_top_boundary(Node *nod_i_pt, Node *nod_j_pt)
helper function for sorting the top boundary nodes
Mesh * create_right_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, const unsigned &n_x_right_pml, const double &width_x_right_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML mesh,aligned with the right physical domain boundary
Mesh * create_left_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &left_boundary_id, const unsigned &n_x_left_pml, const double &width_x_left_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML mesh, aligned with the left physical domain boundary
Mesh * create_bottom_right_pml_mesh(Mesh *pml_right_mesh_pt, Mesh *pml_bottom_mesh_pt, Mesh *bulk_mesh_pt, const unsigned &right_boundary_id, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML bottom right corner mesh, aligned with the existing PML meshes
bool sorter_right_boundary(Node *nod_i_pt, Node *nod_j_pt)
helper function for sorting the right boundary nodes
Mesh * create_top_pml_mesh(Mesh *bulk_mesh_pt, const unsigned &top_boundary_id, const unsigned &n_y_top_pml, const double &width_y_top_pml, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
"Constructor" for PML mesh, aligned with the top physical domain boundary
bool sorter_left_boundary(Node *nod_i_pt, Node *nod_j_pt)
helper function for sorting the left boundary nodes
//////////////////////////////////////////////////////////////////// ////////////////////////////////...