26 #ifndef ST_MESH_HEADER
27 #define ST_MESH_HEADER
38 using namespace oomph;
52 template <
class ELEMENT,
class INTERFACE_ELEMENT>
63 STSpineMesh(
const unsigned int &nel_can,
const unsigned int &nel,
const unsigned int &nel_liq ,
const double &
alpha,
64 const double &length_can,
const double &length_tip,
const double &length_liq,
const double &
height,
const double &
radius,
70 {
return Interface_element_pt[
i];}
77 {
return Interface_line_element_pt[
i];}
81 unsigned long ninterfaceline()
const {
return Interface_line_element_pt.size();}
85 {
return Bulk_element_pt[
i];}
88 unsigned long nbulk()
const {
return Bulk_element_pt.size();}
92 {
return Bulk_outlet_element_pt[
i];}
95 unsigned long nbulkoutlet()
const {
return Bulk_outlet_element_pt.size();}
101 {
return Bulk_inlet_element_pt[
i];}
104 unsigned long nbulkinlet()
const {
return Bulk_inlet_element_pt.size();}
135 unsigned long Element_pt_range = Bulk_element_pt.size();
136 for(
unsigned long e=0;
e<Element_pt_range;
e++)
142 oomph_info <<
"Can't execute output(...) for non Navier Stokes Elements"
157 unsigned long Element_pt_range = Interface_element_pt.size();
158 for(
unsigned long e=0;
e<Element_pt_range;
e++)
164 oomph_info <<
"Can't execute surface output(...) for non Finite Element elements"
169 el_pt->
output(outfile,n_plot);
188 double H = spine_node_pt->
h();
200 double norm =
sqrt( (Xsim - origin_pt[0] ) * (Xsim - origin_pt[0] )+(Zsim - origin_pt[2] ) * (Zsim - origin_pt[2]) );
203 spine_node_pt->
x(0) = origin_pt[0] +
H*
W* (Xsim - origin_pt[0] )/norm;
206 spine_node_pt->
x(2) = origin_pt[2] +
H*
W* (Zsim - origin_pt[2] )/norm;
215 double norm =
sqrt( (Xsim - origin_pt[0] ) * (Xsim - origin_pt[0] )+ (Ysim - origin_pt[1] ) * (Ysim - origin_pt[1] ) +
216 (Zsim- origin_pt[2] ) * (Zsim - origin_pt[2]) );
219 spine_node_pt->
x(0) = origin_pt[0] +
H*
W* (Xsim - origin_pt[0] )/norm;
222 spine_node_pt->
x(1) = origin_pt[1] +
H*
W* (Ysim - origin_pt[1] )/norm;
225 spine_node_pt->
x(2) = origin_pt[2] +
H*
W* (Zsim - origin_pt[2] )/norm;
279 virtual void build_single_layer_mesh(
TimeStepper* time_stepper_pt);
284 void add_mesh(
unsigned int bound1,
Mesh *addmesh_pt,
int *addmesh_map_boundary,
int total_boundaries,
unsigned spine_flag);
298 template<
class ELEMENT,
class INTERFACE_ELEMENT>
300 const double &
alpha,
const double &length_can,
const double &length_tip,
const double &length_liq,
324 template<
class ELEMENT,
class INTERFACE_ELEMENT>
346 for(
unsigned i = 0;
i< mesh1_pt->
nnode();
i++)
351 this->add_node_pt(mesh1_pt->
node_pt(
i));
355 for(
unsigned i = 0;
i< mesh1_pt->
nbulk();
i++)
374 for(
unsigned i = 0;
i< mesh1_pt->
nspine();
i++)
376 Spine_pt.push_back(mesh1_pt->
spine_pt(
i));
389 this->add_boundary_node(
b , node_pt);
409 int addmesh_map_boundary[7];
411 for(
unsigned int i =0;
i<7;
i++)
413 addmesh_map_boundary[
i] =
i;
415 addmesh_map_boundary[3] = -1;
418 add_side_spinemesh(1, mesh2_pt ,addmesh_map_boundary, 7,1);
420 std::cout<<
"Tip mesh added"<<std::endl;
425 unsigned Nzcubic = 2*Nel;
426 double heightcubic =
Height;
427 double alphacubic =
Alpha/2;
441 for(
int k =0;
k<nzin;
k++)
443 for(
int i =0;
i<nxin;
i++)
445 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh3_pt->
element_pt(
i+jin*nxin+
k*nxin*nyin));
446 Bulk_inlet_element_pt.push_back(el_pt);
451 Face_index_inlet = -2;
454 for(
unsigned int i =0;
i<7;
i++)
456 addmesh_map_boundary[
i] =
i;
458 addmesh_map_boundary[3] = -1;
459 addmesh_map_boundary[5] = 6;
464 add_mesh(1, mesh3_pt, addmesh_map_boundary,7,2);
468 std::cout<<
"The complete mesh consists of "<<nbulk()<<
" bulk elements and "<<ninterface_element()<<
" interface elements"<<std::endl;
504 total_boundaries,spine_flag);
507 for(
unsigned i = 0;
i< addmesh_pt->
nbulk();
i++)
532 Mesh *addmesh_pt,
int *addmesh_map_boundary,
int total_boundaries,
unsigned spine_flag)
537 Mesh *mesh_pt =
this;
540 std::map<Node*,Node*> map_bound_node;
545 if(addmesh_map_boundary[
i] == -1)
552 throw OomphLibError(
"Error setting the shared boundary conditions\n",
561 std::ostringstream error_stream;
563 <<
"Different number of nodes in the shared boundaries:\n" <<
564 "Boundary "<<bound1<<
" in the original mesh has "
566 "and Boundary "<<bound2<<
" in the added mesh has "
585 unsigned long nodecounter;
596 for(
unsigned int k=0;
k<dim;
k++)
606 }
while((nodecounter < mesh_pt->nboundary_node(bound1)) && (d>1
E-10));
610 std::ostringstream error_stream;
612 <<
"Error doing the mapping between shared boundaries:\n" <<
613 "it could not be found minimum distance in node "<<
i<<
"\n"
614 <<
"Minimum found distance = "<<
sqrt(
dmin)<<
"\n"
615 <<
"Position in the added mesh = "
640 for(
unsigned int i = 0;
i< addmesh_pt->
nelement();
i++ )
644 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>( addmesh_pt->
element_pt(
i));
647 for(
unsigned j =0;
j< el_pt->nnode();
j++)
650 if(map_bound_node[ el_pt->node_pt(
j) ] != 0)
652 el_pt->node_pt(
j) = map_bound_node[ el_pt->node_pt(
j)];
661 unsigned long n_nodes_addmesh = addmesh_pt->
nnode();
662 unsigned int zaehler = 0;
663 for(
unsigned j=0;
j<n_nodes_addmesh;
j++)
665 if( map_bound_node[ addmesh_pt->
node_pt(
j)] == 0)
684 std::ostringstream error_stream;
688 <<
" nodes too much to the mesh.\n"
689 <<
"(This control should be removed in case we do not want to copy all the nodes of the shared boundaries)\n";
701 for(
unsigned i = 0;
i< addmesh_pt->
nelement();
i++)
703 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>( addmesh_pt->
element_pt(
i));
705 Element_pt.push_back(el_pt);
706 Bulk_element_pt.push_back(el_pt );
733 bool alr_included = 0;
734 for(
unsigned k =0;
k<this->nboundary_node(
i);
k++)
736 if(node_pt == this->boundary_node_pt(
i,
k) )
743 if( map_bound_node[node_pt] == 0)
750 Node* map_node_pt = map_bound_node[node_pt];
771 std::cout<<
"Boundary "<<
i
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: comb_can_spine_mesh.h:55
unsigned long nbulk() const
Number of elements in bulk.
Definition: comb_can_spine_mesh.h:89
int face_index_outlet()
Definition: comb_can_spine_mesh.h:86
FiniteElement *& interface_line_element_pt(const unsigned long &i)
Definition: comb_can_spine_mesh.h:80
unsigned long ninterface_element() const
Number of elements on interface.
Definition: comb_can_spine_mesh.h:92
FiniteElement *& bulk_outlet_element_pt(const unsigned long &i)
Definition: comb_can_spine_mesh.h:75
unsigned long nbulkoutlet() const
Definition: comb_can_spine_mesh.h:95
void flush_spine_element_and_node_storage()
Definition: comb_can_spine_mesh.h:100
FiniteElement *& bulk_element_pt(const unsigned long &i)
Access functions for pointers to elements in bulk.
Definition: comb_can_spine_mesh.h:71
unsigned long ninterfaceline() const
Definition: comb_can_spine_mesh.h:98
FiniteElement *& interface_element_pt(const unsigned long &i)
Access functions for pointers to interface elements.
Definition: comb_can_spine_mesh.h:67
Definition: comb_tip_spine_mesh.h:62
unsigned long ninterface_element() const
Number of elements on interface.
Definition: comb_tip_spine_mesh.h:81
FiniteElement *& interface_element_pt(const unsigned long &i)
Access functions for pointers to interface elements.
Definition: comb_tip_spine_mesh.h:76
unsigned long nbulk() const
Number of elements in bulk.
Definition: comb_tip_spine_mesh.h:89
void flush_spine_element_and_node_storage()
Definition: comb_tip_spine_mesh.h:93
FiniteElement *& bulk_element_pt(const unsigned long &i)
Access functions for pointers to elements in bulk.
Definition: comb_tip_spine_mesh.h:84
int Face_index_inlet
Definition: st_mesh.h:258
unsigned long nbulkinlet() const
Definition: st_mesh.h:104
unsigned int Nel
Definition: st_mesh.h:235
Vector< FiniteElement * > Bulk_element_pt
Vector of pointers to element in the fluid layer.
Definition: st_mesh.h:263
int Face_index_outlet
Definition: st_mesh.h:255
Vector< FiniteElement * > Interface_line_element_pt
Definition: st_mesh.h:275
unsigned long nbulkoutlet() const
Definition: st_mesh.h:95
unsigned int Nel_liq
Definition: st_mesh.h:236
double Xsim
Definition: st_mesh.h:247
unsigned long ninterface_element() const
Number of elements on interface.
Definition: st_mesh.h:73
FiniteElement *& interface_element_pt(const unsigned long &i)
Access functions for pointers to interface elements.
Definition: st_mesh.h:69
FiniteElement *& bulk_inlet_element_pt(const unsigned long &i)
Definition: st_mesh.h:100
Vector< FiniteElement * > Interface_element_pt
Vector of pointers to interface elements.
Definition: st_mesh.h:266
double Length_liq
Definition: st_mesh.h:242
double Length_tip
Definition: st_mesh.h:241
double Ysim
Definition: st_mesh.h:251
FiniteElement *& bulk_element_pt(const unsigned long &i)
Access functions for pointers to elements in bulk.
Definition: st_mesh.h:84
virtual void spine_node_update(SpineNode *spine_node_pt)
Definition: st_mesh.h:176
double Height
Definition: st_mesh.h:243
void full_output(std::ostream &outfile, const unsigned &n_plot)
Definition: st_mesh.h:131
virtual void build_single_layer_mesh(TimeStepper *time_stepper_pt)
Definition: st_mesh.h:325
unsigned int Nel_can
Definition: st_mesh.h:234
unsigned long nbulk() const
Number of elements in bulk.
Definition: st_mesh.h:88
Vector< FiniteElement * > Bulk_inlet_element_pt
Vector of pointers to the bulk inlet elements in the fluid layer.
Definition: st_mesh.h:272
void add_mesh(unsigned int bound1, Mesh *addmesh_pt, int *addmesh_map_boundary, int total_boundaries, unsigned spine_flag)
Definition: st_mesh.h:531
int face_index_outlet()
Definition: st_mesh.h:110
FiniteElement *& interface_line_element_pt(const unsigned long &i)
Access functions for pointers to interface line elements.
Definition: st_mesh.h:76
void add_side_spinemesh(unsigned int bound1, CombTipSpineMesh< ELEMENT, INTERFACE_ELEMENT > *addmesh_pt, int *addmesh_map_boundary, int total_boundaries, unsigned flag)
Definition: st_mesh.h:497
double Alpha
Aspect ratio, length, height and radius.
Definition: st_mesh.h:239
int face_index_inlet()
Definition: st_mesh.h:113
Vector< FiniteElement * > Bulk_outlet_element_pt
Vector of pointers to the bulk outlet elements in the fluid layer.
Definition: st_mesh.h:269
void surface_output(std::ostream &outfile, const unsigned &n_plot)
Definition: st_mesh.h:153
FiniteElement *& bulk_outlet_element_pt(const unsigned long &i)
Definition: st_mesh.h:91
unsigned long ninterfaceline() const
Number of elements on the line interface.
Definition: st_mesh.h:81
double Zsim
Definition: st_mesh.h:248
STSpineMesh(const unsigned int &nel_can, const unsigned int &nel, const unsigned int &nel_liq, const double &alpha, const double &length_can, const double &length_tip, const double &length_liq, const double &height, const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: st_mesh.h:299
double Radius
Definition: st_mesh.h:244
double Length_can
Definition: st_mesh.h:240
Definition: elements.h:1313
virtual void output(std::ostream &outfile)
Definition: elements.h:3050
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
Definition: mesh.cc:243
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:833
static Steady< 0 > Default_TimeStepper
The Steady Timestepper.
Definition: mesh.h:75
void flush_element_and_node_storage()
Definition: mesh.h:407
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Definition: mesh.h:505
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
void remove_boundary_nodes()
Clear all pointers to boundary nodes.
Definition: mesh.cc:204
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
void add_node_pt(Node *const &node_pt)
Add a (pointer to a) node to the mesh.
Definition: mesh.h:611
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:493
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: navier_stokes_elements.h:395
void full_output(std::ostream &outfile)
Definition: navier_stokes_elements.h:1180
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
virtual bool is_on_boundary() const
Definition: nodes.h:1373
virtual void remove_from_boundary(const unsigned &b)
Definition: nodes.cc:2350
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
Definition: oomph_definitions.h:222
Simple cubic 3D Brick mesh class.
Definition: simple_cubic_mesh.template.h:47
SpineNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global SpineNode.
Definition: spines.h:648
unsigned long nspine() const
Return the number of spines in the mesh.
Definition: spines.h:635
Spine *& spine_pt(const unsigned long &i)
Return the i-th spine in the mesh.
Definition: spines.h:623
void node_update(const bool &update_all_solid_nodes=false)
Definition: spines.cc:84
double & h()
Access function to spine height.
Definition: spines.h:397
SpineMesh *& spine_mesh_pt()
Definition: spines.h:391
Spine *& spine_pt()
Access function to spine.
Definition: spines.h:372
unsigned & node_update_fct_id()
Access function to ID of node update function (within specific mesh)
Definition: spines.h:384
double & fraction()
Set reference to fraction along spine.
Definition: spines.h:378
double & geom_parameter(const unsigned &i)
Definition: spines.h:287
Definition: timesteppers.h:231
#define dmin(a, b)
Definition: datatypes.h:24
RealScalar alpha
Definition: level1_cplx_impl.h:151
char char char int int * k
Definition: level2_impl.h:374
double Height
Height of domain.
Definition: flow_past_oscillating_cylinder.cc:316
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
double Radius
Radius of the pipe.
Definition: pipe.cc:55
double Length_liq
Definition: three_d_breth.cc:77
double Length_can
Definition: three_d_breth.cc:79
double height(const double &x)
Height of domain.
Definition: simple_spine_channel.cc:429
double Length_tip
Definition: three_d_breth.cc:75
double Alpha
Parameter for steepness of step.
Definition: two_d_adv_diff_adapt.cc:53
void merge_spine_meshes(MESH1 *mesh_pt, unsigned bound1, MESH2 *addmesh_pt, int *addmesh_map_boundary, int total_boundaries, unsigned spine_flag)
Definition: merge_meshes.h:32
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#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