30 #ifndef OOMPH_TWO_LAYER_SPINE_MESH_TEMPLATE_CC 31 #define OOMPH_TWO_LAYER_SPINE_MESH_TEMPLATE_CC 54 template<
class ELEMENT>
56 const unsigned &nx,
const unsigned &ny1,
const unsigned &ny2,
57 const double &lx,
const double &h1,
const double &h2,
63 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
66 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
103 template<
class ELEMENT>
105 const unsigned &
nx,
const unsigned &ny1,
const unsigned &ny2,
106 const double &lx,
const double &h1,
const double &h2,
107 const bool& periodic_in_x,
TimeStepper* time_stepper_pt) :
109 false,time_stepper_pt)
112 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
115 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
153 template<
class ELEMENT>
155 const unsigned &
nx,
const unsigned &ny1,
const unsigned &ny2,
156 const double &lx,
const double &h1,
const double &h2,
157 const bool& periodic_in_x,
const bool&
build_mesh,
160 false,time_stepper_pt)
163 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
166 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
195 template<
class ELEMENT>
198 unsigned yelement,
unsigned ynode)
201 double xstep = (this->
Xmax-this->
Xmin)/((this->
Np-1)*this->
Nx);
203 return (this->
Xmin + xstep*((this->
Np-1)*xelement + xnode));
210 template<
class ELEMENT>
213 unsigned yelement,
unsigned ynode)
223 double y1init =
Ymin;
225 double y2init =
H1 -
Ymin;
231 double y2step = (Ymax-
H1)/((n_p-1)*
Ny2);
237 return (y1init + y1step*((n_p-1)*yelement + ynode));
241 return (y2init + y2step*((n_p-1)*(yelement-
Ny1) + ynode));
249 template<
class ELEMENT>
261 unsigned long n_lower = this->
Nx*
Ny1;
262 unsigned long n_upper = this->
Nx*
Ny2;
265 for(
unsigned e=0;
e<n_lower;
e++)
271 for(
unsigned e=n_lower;
e<(n_lower+n_upper);
e++)
280 unsigned count_lower=this->
Nx*(this->Ny1-1);
281 unsigned count_upper= count_lower + this->
Nx;
282 for(
unsigned e=0;
e<this->
Nx;
e++)
296 const double y_interface =
H1 - this->
Ymin;
302 for(
unsigned n=0;n<n_boundary_node;n++)
321 double y = nod_pt->
x(1);
351 for(
unsigned n=0;n<n_boundary_node;n++)
376 std::list<Node*> nodes_to_be_removed;
381 for(
unsigned n=0;n<n_boundary_node;n++)
387 double y = nod_pt->
x(1);
402 nodes_to_be_removed.push_back(nod_pt);
416 for(std::list<Node*>::iterator it=nodes_to_be_removed.begin();
417 it!=nodes_to_be_removed.end();++it)
421 nodes_to_be_removed.clear();
436 for(
unsigned e=0;
e<this->
Nx;
e++)
443 for(
unsigned n=n_start;n<n_p;n++)
448 b_coord[0] = nod_pt->
x(0);
460 Spine_pt.reserve((n_p-1)*this->Nx+1);
487 for(
unsigned long i=0;
i<
Ny1;
i++)
490 for(
unsigned l1=1;l1<n_p;l1++)
506 for(
unsigned long i=0;
i<
Ny2;
i++)
509 for(
unsigned l1=1;l1<n_p;l1++)
530 for(
unsigned long j=0;j<this->
Nx;j++)
537 if ((this->
Xperiodic)&&(j==this->Nx-1)) n_pmax=n_p-1;
539 for(
unsigned l2=1;l2<n_pmax;l2++)
559 for(
unsigned long i=0;
i<
Ny1;
i++)
562 for(
unsigned l1=1;l1<n_p;l1++)
578 for(
unsigned long i=0;
i<
Ny2;
i++)
581 for(
unsigned l1=1;l1<n_p;l1++)
611 nod_pt->
spine_pt() = final_spine_pt;
620 for(
unsigned i=0;
i<(Ny1+
Ny2);
i++)
623 for(
unsigned l1=1;l1<n_p;l1++)
630 nod_pt->
spine_pt() = final_spine_pt;
Vector< FiniteElement * > Lower_layer_element_pt
Vector of pointers to element in the upper layer.
const unsigned & nx() const
Return number of elements in x direction.
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
void convert_to_boundary_node(Node *&node_pt, const Vector< FiniteElement *> &finite_element_pt)
A function that upgrades an ordinary node to a boundary node We shouldn't ever really use this...
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
virtual void build_two_layer_mesh(TimeStepper *time_stepper_pt)
Helper function to actually build the two-layer spine mesh (called from various constructors) ...
std::vector< bool > Boundary_coordinate_exists
Vector of boolean data that indicates whether the boundary coordinates have been set for the boundary...
double & fraction()
Set reference to fraction along spine.
A general Finite Element class.
double y_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
The spacing function for the y co-ordinates with three regions in each fluid.
unsigned & node_update_fct_id()
Access function to ID of node update function (within specific mesh)
bool boundary_coordinate_exists(const unsigned &i) const
Indicate whether the i-th boundary has an intrinsic coordinate.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
virtual void get_coordinates_on_boundary(const unsigned &b, const unsigned &k, Vector< double > &boundary_zeta)
Return the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interface provides run-time error checking.
virtual unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b. Broken virtual interface provides run-time...
void remove_boundary_node(const unsigned &b, Node *const &node_pt)
virtual void remove_from_boundary(const unsigned &b)
Broken interface for removing the node from the mesh boundary b Here to provide error reporting...
TwoLayerSpineMesh(const unsigned &nx, const unsigned &ny1, const unsigned &ny2, const double &lx, const double &h1, const double &h2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction, number of elements in y-direction in bottom and ...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
unsigned Ny2
Number of elements in upper layer.
unsigned Ny1
Number of elements in lower layer.
Vector< FiniteElement * > Interface_lower_boundary_element_pt
Vector of pointers to the elements adjacent to the interface on the lower layer.
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
unsigned Nx
Nx: number of elements in x-direction.
Vector< FiniteElement * > Upper_layer_element_pt
Vector of pointers to element in the lower layer.
unsigned Np
Np: number of (linear) points in the element.
bool Xperiodic
Boolean variable used to determine whether the mesh is periodic in the x-direction.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double H1
Height of the lower layer.
double H2
Height of the upper layer.
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Vector< FiniteElement * > Interface_upper_boundary_element_pt
Vector of pointers to the element adjacent to the interface on the upper layer.
Vector< Vector< Node * > > Boundary_node_pt
Vector of Vector of pointers to nodes on the boundaries: Boundary_node_pt(b,n). Note that this is pri...
SpineNode * element_node_pt(const unsigned long &e, const unsigned &n)
Return the n-th local SpineNode in element e. This is required to cast the nodes in a spine mesh to b...
virtual void setup_boundary_element_info()
Interface for function that is used to setup the boundary information (Empty virtual function – impl...
double Xmin
Minimum value of x coordinate.
double Ymax
Maximum value of y coordinate.
Spine *& spine_pt()
Access function to spine.
SpineMesh *& spine_mesh_pt()
Access function to Pointer to SpineMesh that this node is a part of and which implements the node upd...
double x_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
The spacing function for the x co-ordinates with two regions.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
double Xmax
Maximum value of x coordinate.
double Ymin
Minimum value of y coordinate.
Vector< Spine * > Spine_pt
A Spine mesh contains a Vector of pointers to spines.