26 #ifndef MY_CANYON_SPINE_MESH_HEADER
27 #define MY_CANYON_SPINE_MESH_HEADER
35 using namespace oomph;
45 template <
class ELEMENT,
class INTERFACE_ELEMENT>
69 const unsigned &rotation_flag,
76 {
return Interface_element_pt[
i];}
80 {
return Interface_element_pt.size();}
84 {
return Bulk_element_pt[
i];}
87 unsigned long nbulk()
const {
return Bulk_element_pt.size();}
95 double scaled_R =
R/(this->
Zmax - this->
Zmin);
96 if ( (scaled_R<0.95) && (scaled_R>0.05) )
100 std::ostringstream error_stream;
103 "We can not constract so small elements so close to the origin\n"
104 <<
"Choose a different radius (actual scaled radius = "<<scaled_R<<
122 double H = spine_node_pt->
h();
133 sqrt( (Xsim - origin_pt[0] ) * (Xsim - origin_pt[0] )+
134 (Zsim - origin_pt[2] ) * (Zsim - origin_pt[2]) );
137 spine_node_pt->
x(0) = origin_pt[0] +
H*
W* (Xsim - origin_pt[0] )/norm;
140 spine_node_pt->
x(2) = origin_pt[2] +
H*
W* (Zsim - origin_pt[2] )/norm;
151 double daxis =
sqrt( (this->Xsim - spine_node_pt->
x(0) ) *(this->Xsim - spine_node_pt->
x(0) )+(this->Zsim - spine_node_pt->
x(2) ) * (this->Zsim - spine_node_pt->
x(2)));
152 double init_h = ( daxis -
radius() ) ;
175 Bulk_element_pt.clear();
176 Interface_element_pt.clear();
197 virtual void build_single_layer_mesh(
TimeStepper* time_stepper_pt);
230 template<
class ELEMENT,
class INTERFACE_ELEMENT>
232 const unsigned &
nx,
const unsigned &
ny,
const unsigned &
nz,
233 const double &x_min,
const double &x_max,
const double &y_min,
234 const double &y_max,
const double &z_min,
const double &z_max,
235 const double &
R,
const unsigned &rotation_flag,
TimeStepper* time_stepper_pt) :
261 template<
class ELEMENT,
class INTERFACE_ELEMENT>
267 if(Rotation_flag == 1)
268 for(
unsigned i = 0;
i< this->nnode();
i++)
270 double x_node = this->node_pt(
i)->x(0);
271 double z_node = this->node_pt(
i)->x(2);
272 this->node_pt(
i)->x(0) = -z_node +1.0;
273 this->node_pt(
i)->x(2) = x_node;
279 unsigned n_x = this->
Nx;
280 unsigned n_y = this->
Ny;
281 unsigned n_z = this->
Nz;
286 unsigned nbulk=nelement();
287 Bulk_element_pt.reserve(nbulk);
288 for(
unsigned e=0;
e<nbulk;
e++)
291 Bulk_element_pt.push_back(
dynamic_cast<ELEMENT*
>(this->finite_element_pt(
e)));
298 unsigned n_p =
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
301 Spine_pt.reserve(((n_p-1)*n_x+1)*((n_p-1)*n_y+1));
310 for(
unsigned l1=0;l1<n_p;l1++)
312 for(
unsigned l2=0;l2<n_p;l2++)
318 origin_node[0] = element_node_pt(0,l2+l1*n_p)->x(0);
319 origin_node[1] = element_node_pt(0,l2+l1*n_p)->x(1);
320 origin_node[2] = element_node_pt(0,l2+l1*n_p)->x(2);
322 double hinit = init_spine_height( element_node_pt(0,l2+l1*n_p) );
326 Spine_pt.push_back(new_spine_pt);
329 SpineNode* nod_pt=element_node_pt(0,l2+l1*n_p);
339 for(
unsigned long k=0;
k<n_z;
k++)
342 for(
unsigned l3=1;l3<n_p;l3++)
345 SpineNode* nod_pt=element_node_pt(
k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
364 for(
unsigned j=1;
j<n_x;
j++)
367 for(
unsigned l1=0;l1<n_p;l1++)
370 for(
unsigned l2=1;l2<n_p;l2++)
375 origin_node[0] = element_node_pt(
j,l2+l1*n_p)->x(0);
376 origin_node[1] = element_node_pt(
j,l2+l1*n_p)->x(1);
377 origin_node[2] = element_node_pt(
j,l2+l1*n_p)->x(2);
378 double hinit = init_spine_height( element_node_pt(
j,l2+l1*n_p) );
383 Spine_pt.push_back(new_spine_pt);
387 SpineNode* nod_pt=element_node_pt(
j,l2+l1*n_p);
397 for(
unsigned long k=0;
k<n_z;
k++)
400 for(
unsigned l3=1;l3<n_p;l3++)
403 SpineNode* nod_pt=element_node_pt(
j+
k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
423 for(
unsigned long i=1;
i<n_y;
i++)
429 for(
unsigned l1=1;l1<n_p;l1++)
432 for(
unsigned l2=0;l2<n_p;l2++)
437 origin_node[0] = element_node_pt(
i*n_x,l2+l1*n_p)->x(0);
438 origin_node[1] = element_node_pt(
i*n_x,l2+l1*n_p)->x(1);
439 origin_node[2] = element_node_pt(
i*n_x,l2+l1*n_p)->x(2);
440 double hinit = init_spine_height( element_node_pt(
i*n_x,l2+l1*n_p) );
445 Spine_pt.push_back(new_spine_pt);
449 SpineNode* nod_pt=element_node_pt(
i*n_x,l2+l1*n_p);
459 for(
unsigned long k=0;
k<n_z;
k++)
462 for(
unsigned l3=1;l3<n_p;l3++)
465 SpineNode* nod_pt=element_node_pt(
i*n_x+
k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
484 for(
unsigned j=1;
j<n_x;
j++)
490 for(
unsigned l1=1;l1<n_p;l1++)
493 for(
unsigned l2=1;l2<n_p;l2++)
498 origin_node[0] = element_node_pt(
j+
i*n_x,l2+l1*n_p)->x(0);
499 origin_node[1] = element_node_pt(
j+
i*n_x,l2+l1*n_p)->x(1);
500 origin_node[2] = element_node_pt(
j+
i*n_x,l2+l1*n_p)->x(2);
501 double hinit = init_spine_height( element_node_pt(
j+
i*n_x,l2+l1*n_p) );
507 Spine_pt.push_back(new_spine_pt);
511 SpineNode* nod_pt=element_node_pt(
j+
i*n_x,l2+l1*n_p);
521 for(
unsigned long k=0;
k<n_z;
k++)
524 for(
unsigned l3=1;l3<n_p;l3++)
527 SpineNode* nod_pt=element_node_pt(
j+
i*n_x+
k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
555 unsigned long element_count = Element_pt.size();
558 for(
unsigned l1=0;l1<n_y;l1++)
559 for(
unsigned l2=0;l2<n_x;l2++)
565 new INTERFACE_ELEMENT(finite_element_pt(n_x*n_y*(n_z-1)+l2+l1*n_x),3);
569 Element_pt.push_back(interface_element_element_pt);
572 Interface_element_pt.push_back(interface_element_element_pt);
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
@ R
Definition: StatisticsVector.h:21
Definition: canyon_spine_mesh.h:48
MyCanyonMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &x_min, const double &x_max, const double &y_min, const double &y_max, const double &z_min, const double &z_max, const double &R, const unsigned &rotation_flag, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: canyon_spine_mesh.h:231
double init_spine_height(SpineNode *spine_node_pt)
Definition: canyon_spine_mesh.h:147
double Zsim
Definition: canyon_spine_mesh.h:203
void change_radius(double R)
Definition: canyon_spine_mesh.h:93
Vector< FiniteElement * > Interface_element_pt
Vector of pointers to interface elements.
Definition: canyon_spine_mesh.h:190
double Xsim
Definition: canyon_spine_mesh.h:201
unsigned Rotation_flag
Definition: canyon_spine_mesh.h:207
virtual void spine_node_update(SpineNode *spine_node_pt)
Definition: canyon_spine_mesh.h:116
double Radius
Sacled radius of the canyon (must be between 0 and one.
Definition: canyon_spine_mesh.h:193
virtual void build_single_layer_mesh(TimeStepper *time_stepper_pt)
Definition: canyon_spine_mesh.h:262
FiniteElement *& interface_element_pt(const unsigned long &i)
Access functions for pointers to interface elements.
Definition: canyon_spine_mesh.h:75
void flush_spine_element_and_node_storage()
Definition: canyon_spine_mesh.h:171
unsigned long ninterface_element() const
Number of elements on interface.
Definition: canyon_spine_mesh.h:79
Vector< FiniteElement * > Bulk_element_pt
Vector of pointers to element in the fluid layer.
Definition: canyon_spine_mesh.h:187
FiniteElement *& bulk_element_pt(const unsigned long &i)
Access functions for pointers to elements in bulk.
Definition: canyon_spine_mesh.h:83
unsigned long nbulk() const
Number of elements in bulk.
Definition: canyon_spine_mesh.h:87
double radius()
Definition: canyon_spine_mesh.h:90
Definition: elements.h:1313
static Steady< 0 > Default_TimeStepper
The Steady Timestepper.
Definition: mesh.h:75
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
Definition: oomph_definitions.h:222
Simple cubic 3D Brick mesh class.
Definition: simple_cubic_mesh.template.h:47
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
double & fraction()
Set reference to fraction along spine.
Definition: spines.h:378
void set_geom_parameter(const Vector< double > &geom_parameter)
Definition: spines.h:273
double & geom_parameter(const unsigned &i)
Definition: spines.h:287
Definition: timesteppers.h:231
char char char int int * k
Definition: level2_impl.h:374
unsigned Nx
Number of elements in each direction (used by SimpleCubicMesh)
Definition: structured_cubic_point_source.cc:114
unsigned Ny
Definition: structured_cubic_point_source.cc:115
double Zmin
Set up min z coordinate.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:74
unsigned Nz
Number of elements in z-direction.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:62
double Zmax
Set up max z coordinate.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:80
double Radius
Radius of the pipe.
Definition: pipe.cc:55
const unsigned nz
Definition: ConstraintElementsUnitTest.cpp:32
const unsigned nx
Definition: ConstraintElementsUnitTest.cpp:30
const unsigned ny
Definition: ConstraintElementsUnitTest.cpp:31
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#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