30 #ifndef OOMPH_CHANNEL_SPINE_MESH_TEMPLATE_CC 31 #define OOMPH_CHANNEL_SPINE_MESH_TEMPLATE_CC 54 template<
class ELEMENT>
67 0.0,h,false,false,time_stepper_pt),
68 Nx0(nx0), Nx1(nx1), Nx2(nx2),
69 Lx0(lx0), Lx1(lx1), Lx2(lx2),
74 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
77 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
102 template<
class ELEMENT>
113 const bool& periodic_in_x,
116 periodic_in_x,false,time_stepper_pt),
122 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
125 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
146 template<
class ELEMENT>
155 unsigned n_x = this->
Nx;
156 unsigned n_y = this->
Ny;
157 unsigned n_x0 = this->
Nx0;
158 unsigned n_x1 = this->
Nx1;
159 unsigned n_x2 = this->
Nx2;
162 unsigned nleft=n_x0*n_y;;
166 unsigned nright=n_x2*n_y;;
168 for(
unsigned irow=0;irow<n_y;irow++)
170 for (
unsigned e=0;
e<n_x0;
e++)
175 for (
unsigned e=0;
e<n_x1;
e++)
180 for (
unsigned e=0;
e<n_x2;
e++)
189 if (
nelement()!=nleft+ncentre+nright)
192 OOMPH_CURRENT_FUNCTION,
193 OOMPH_EXCEPTION_LOCATION);
207 nspine = (n_p-1)*n_x;
217 nspine = (n_p-1)*n_x+1;
241 double dzeta=
Lx0/n_x0;
244 unsigned n_prev_elements=0;
292 geom_object_pt[0] = geometric_object_pt;
300 for(
unsigned long i=0;
i<n_y;
i++)
303 for(
unsigned l1=1;l1<n_p;l1++)
310 nod_pt->
fraction()=(double(
i)+double(l1)/double(n_p-1))/
double(n_y);
323 for(
unsigned long j=0;j<n_x0;j++)
328 for(
unsigned l2=1;l2<n_pmax;l2++)
331 new_spine_pt=
new Spine(1.0);
351 zeta[0] = zeta_lo + double(j)*dzeta + double(l2)*dzeta/(n_p-1.0);
370 geom_object_pt[0] = geometric_object_pt;
378 for(
unsigned long i=0;
i<n_y;
i++)
381 for(
unsigned l1=1;l1<n_p;l1++)
388 nod_pt->
fraction()=(double(
i)+double(l1)/double(n_p-1))/
double(n_y);
399 n_prev_elements+=n_x0*n_y;
415 for(
unsigned long j=n_x0;j<n_x0+n_x1;j++)
420 for(
unsigned l2=1;l2<n_pmax;l2++)
423 new_spine_pt=
new Spine(1.0);
443 zeta[0] = zeta_lo + double(j-n_x0)*dzeta + double(l2)*dzeta/(n_p-1.0);
462 geom_object_pt[0] = geometric_object_pt;
470 for(
unsigned long i=0;
i<n_y;
i++)
473 for(
unsigned l1=1;l1<n_p;l1++)
480 nod_pt->
fraction()=(double(
i)+double(l1)/double(n_p-1))/
double(n_y);
491 n_prev_elements+=n_x1*n_y;
508 for(
unsigned long j=n_x0+n_x1;j<n_x0+n_x1+n_x2;j++)
526 zeta[0] = zeta_lo + double(j-n_x0-n_x1)*dzeta;
545 geom_object_pt[0] = geometric_object_pt;
557 if ((this->
Xperiodic)&&(j==n_x-1)) n_pmax=n_p-1;
559 for(
unsigned l2=1;l2<n_pmax;l2++)
562 new_spine_pt=
new Spine(1.0);
582 zeta[0] = zeta_lo + double(j-n_x0-n_x1)*dzeta + double(l2)*dzeta/(n_p-1.0);
601 geom_object_pt[0] = geometric_object_pt;
609 for(
unsigned long i=0;
i<n_y;
i++)
612 for(
unsigned l1=1;l1<n_p;l1++)
619 nod_pt->
fraction()=(double(
i)+double(l1)/double(n_p-1))/
double(n_y);
630 n_prev_elements+=n_x2*n_y;
643 nod_pt->
spine_pt() = final_spine_pt;
650 for(
unsigned i=0;
i<n_y;
i++)
653 for(
unsigned l1=1;l1<n_p;l1++)
659 nod_pt->
spine_pt() = final_spine_pt;
679 template <
class ELEMENT>
683 unsigned n_x = this->
Nx;
684 unsigned n_y = this->
Ny;
686 unsigned long Nelement =
nelement();
688 unsigned long Nfluid = n_x*n_y;
693 for(
unsigned long j=0;j<n_x;j++)
696 for(
unsigned long i=0;
i<n_y;
i++)
707 for(
unsigned long e=0;
e<Nelement;
e++)
void set_geom_parameter(const Vector< double > &geom_parameter)
Set vector of geometric parameters that are involved in the node update operations for this Spine...
unsigned Nx0
Number of elements in the left region.
unsigned long nright() const
Number of elements in right region.
void element_reorder()
Reorder the elements so we loop over them vertically first (advantageous in "wide" domains if a front...
double & height()
Access function to spine height.
double & fraction()
Set reference to fraction along spine.
ChannelSpineMesh(const unsigned &nx0, const unsigned &nx1, const unsigned &nx2, const unsigned &ny, const double &lx0, const double &lx1, const double &lx2, const double &h, GeomObject *wall_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction in regions 0,1 and 2, number of elements in y-dir...
unsigned & node_update_fct_id()
Access function to ID of node update function (within specific mesh)
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
virtual void build_channel_spine_mesh(TimeStepper *time_stepper_pt)
Helper function to actually build the channel-spine mesh (called from various constructors) ...
void pin(const unsigned &i)
Pin the i-th stored variable.
unsigned Ny
Ny: number of elements in y-direction.
unsigned long nelement() const
Return number of elements in the mesh.
double Lx1
Length of centre region.
unsigned long ncentre() const
Number of elements in centre region.
const unsigned & ny() const
Return number of elements in y direction.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
unsigned Nx
Nx: number of elements in x-direction.
unsigned Nx1
Number of elements in the centre region.
Vector< FiniteElement * > Centre_element_pt
Vector of pointers to element in the centre region.
bool Xperiodic
Boolean variable used to determine whether the mesh is periodic in the x-direction.
unsigned Ncentre_spine
Number of spines in centre region.
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
GeomObject * wall_pt()
Access function to the GeomObject for upper wall.
void set_geom_object_pt(const Vector< GeomObject *> &geom_object_pt)
Set vector of (pointers to) geometric objects that is involved in the node update operations for this...
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
unsigned long nspine() const
Return the number of spines in the mesh.
unsigned Nx2
Number of elements in the right region.
GeomObject * Straight_wall_pt
GeomObject for the straight upper wall.
double Lx2
Length of right region.
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...
unsigned Nleft_spine
Number of spines in left region.
Data *& spine_height_pt()
Access function to Data object that stores the spine height.
unsigned long nleft() const
Number of elements in left region.
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...
virtual void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
A geometric object may be composed of may sub-objects (e.g. a finite-element representation of a boun...
double Lx0
Length of left region.
Vector< FiniteElement * > Right_element_pt
Vector of pointers to element in the right region.
Vector< FiniteElement * > Left_element_pt
Vector of pointers to element in the left region.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
unsigned Nright_spine
Number of spines in right region.
GeomObject * Wall_pt
GeomObject for upper wall.
Vector< Spine * > Spine_pt
A Spine mesh contains a Vector of pointers to spines.