30 #ifndef OOMPH_QUARTER_CIRCLE_SECTOR_MESH_TEMPLATE_CC 31 #define OOMPH_QUARTER_CIRCLE_SECTOR_MESH_TEMPLATE_CC 48 template <
class ELEMENT>
52 const double& fract_mid,
55 Wall_pt(wall_pt), Xi_lo(xi_lo), Fract_mid(fract_mid), Xi_hi(xi_hi)
59 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
80 Node_pt.resize(n_p*n_p+(n_p-1)*n_p+(n_p-1)*(n_p-1));
94 unsigned long node_count=0;
110 construct_boundary_node(0,time_stepper_pt);
118 Domain_pt->macro_element_pt(0)->macro_map(s,r);
119 Node_pt[node_count]->x(0) = r[0];
120 Node_pt[node_count]->x(1) = r[1];
131 for(
unsigned l1=1;l1<n_p;l1++)
135 unsigned jnod_local=l1;
139 construct_boundary_node(jnod_local,time_stepper_pt);
145 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
147 Domain_pt->macro_element_pt(0)->macro_map(s,r);
148 Node_pt[node_count]->x(0) = r[0];
149 Node_pt[node_count]->x(1) = r[1];
163 for(
unsigned l2=1;l2<n_p;l2++)
170 unsigned jnod_local=n_p*l2;
174 construct_boundary_node(jnod_local,time_stepper_pt);
182 s[1]=-1.0+2.0*double(l2)/double(n_p-1); ;
183 Domain_pt->macro_element_pt(0)->macro_map(s,r);
184 Node_pt[node_count]->x(0) = r[0];
185 Node_pt[node_count]->x(1) = r[1];
197 for(
unsigned l1=1;l1<n_p;l1++)
201 unsigned jnod_local=l1+n_p*l2;
205 construct_node(jnod_local,time_stepper_pt);
211 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
212 s[1]=-1.0+2.0*double(l2)/double(n_p-1);
213 Domain_pt->macro_element_pt(0)->macro_map(s,r);
214 Node_pt[node_count]->x(0) = r[0];
215 Node_pt[node_count]->x(1) = r[1];
231 for(
unsigned l2=0;l2<n_p;l2++)
234 unsigned jnod_local_old=(n_p-1)+l2*n_p;
243 for(
unsigned l1=1;l1<n_p-1;l1++)
249 unsigned jnod_local=l1;
253 construct_boundary_node(jnod_local,time_stepper_pt);
259 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
261 Domain_pt->macro_element_pt(1)->macro_map(s,r);
262 Node_pt[node_count]->x(0) = r[0];
263 Node_pt[node_count]->x(1) = r[1];
273 for(
unsigned l2=1;l2<n_p;l2++)
276 unsigned jnod_local=l1+l2*n_p;
280 construct_node(jnod_local,time_stepper_pt);
286 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
287 s[1]=-1.0+2.0*double(l2)/double(n_p-1);
288 Domain_pt->macro_element_pt(1)->macro_map(s,r);
289 Node_pt[node_count]->x(0) = r[0];
290 Node_pt[node_count]->x(1) = r[1];
304 unsigned jnod_local=n_p-1;
308 construct_boundary_node(jnod_local,time_stepper_pt);
316 Domain_pt->macro_element_pt(1)->macro_map(s,r);
317 Node_pt[node_count]->x(0) = r[0];
318 Node_pt[node_count]->x(1) = r[1];
326 Node_pt[node_count]->set_coordinates_on_boundary(1,zeta);
333 for(
unsigned l2=1;l2<n_p;l2++)
336 unsigned jnod_local=(n_p-1)+l2*n_p;
340 construct_boundary_node(jnod_local,time_stepper_pt);
347 s[1]=-1.0+2.0*double(l2)/double(n_p-1);
348 Domain_pt->macro_element_pt(1)->macro_map(s,r);
349 Node_pt[node_count]->x(0) = r[0];
350 Node_pt[node_count]->x(1) = r[1];
357 Node_pt[node_count]->set_coordinates_on_boundary(1,zeta);
372 for(
unsigned l1=0;l1<n_p;l1++)
376 unsigned jnod_local_old=n_p*(n_p-1)+l1;
379 unsigned jnod_local=l1;
391 for(
unsigned l2=1;l2<n_p;l2++)
394 unsigned jnod_local_old=n_p*(n_p-1)+l2;
397 unsigned jnod_local=(n_p-1)+l2*n_p;
407 for(
unsigned l2=1;l2<n_p-1;l2++)
413 unsigned jnod_local=n_p*l2;
417 construct_boundary_node(jnod_local,time_stepper_pt);
424 s[1]=-1.0+2.0*double(l2)/double(n_p-1); ;
425 Domain_pt->macro_element_pt(2)->macro_map(s,r);
426 Node_pt[node_count]->x(0) = r[0];
427 Node_pt[node_count]->x(1) = r[1];
438 for(
unsigned l1=1;l1<n_p-1;l1++)
442 unsigned jnod_local=l1+n_p*l2;
446 construct_node(jnod_local,time_stepper_pt);
452 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
453 s[1]=-1.0+2.0*double(l2)/double(n_p-1);
454 Domain_pt->macro_element_pt(2)->macro_map(s,r);
455 Node_pt[node_count]->x(0) = r[0];
456 Node_pt[node_count]->x(1) = r[1];
468 jnod_local=n_p*(n_p-1);
472 construct_boundary_node(jnod_local,time_stepper_pt);
480 Domain_pt->macro_element_pt(2)->macro_map(s,r);
481 Node_pt[node_count]->x(0) = r[0];
482 Node_pt[node_count]->x(1) = r[1];
490 Node_pt[node_count]->set_coordinates_on_boundary(1,zeta);
498 for(
unsigned l1=1;l1<n_p-1;l1++)
501 unsigned jnod_local=n_p*(n_p-1)+l1;
505 construct_boundary_node(jnod_local,time_stepper_pt);
511 s[0]=-1.0+2.0*double(l1)/double(n_p-1);
513 Domain_pt->macro_element_pt(2)->macro_map(s,r);
514 Node_pt[node_count]->x(0) = r[0];
515 Node_pt[node_count]->x(1) = r[1];
522 Node_pt[node_count]->set_coordinates_on_boundary(1,zeta);
530 unsigned n_element=this->
nelement();
531 for (
unsigned e=0;
e<n_element;
e++)
534 ELEMENT* el_pt=
dynamic_cast<ELEMENT*
>(this->
element_pt(
e));
537 el_pt->set_macro_elem_pt(this->Domain_pt->macro_element_pt(
e));
572 template <
class ELEMENT>
582 if (central_box_pt==0)
584 std::ostringstream error_message;
586 "Element in AlgebraicRefineableQuarterCircleSectorMesh must be\n ";
587 error_message <<
"derived from AlgebraicElementBase\n";
588 error_message<<
"but it is of type: " 591 "AlgebraicRefineableQuarterCircleSectorMesh::";
592 function_name +=
"setup_algebraic_node_update()";
594 OOMPH_CURRENT_FUNCTION,
595 OOMPH_EXCEPTION_LOCATION);
613 Lambda_x = x_box/r_br[0];
628 Lambda_y = y_box/r_tl[1];
644 for (
unsigned jnod=0;jnod<nnodes;jnod++)
657 ref_value[0]=x/x_box;
660 ref_value[1]=y/y_box;
663 geom_object_pt[0] = obj_br_pt;
668 ref_value[2]=s_br[0];
672 geom_object_pt[1] = obj_tl_pt;
677 ref_value[3]=s_tl[0];
681 add_node_update_info(
699 unsigned nnod_lin=
dynamic_cast<ELEMENT*
>(
701 for (
unsigned i0=0;i0<nnod_lin;i0++)
705 double rho_0=double(i0)/double(nnod_lin-1);
707 for (
unsigned i1=0;i1<nnod_lin;i1++)
711 double rho_1=double(i1)/double(nnod_lin-1);
714 unsigned jnod=i0+i1*nnod_lin;
729 geom_object_pt[0] = obj_br_pt;
734 ref_value[2]=s_br[0];
737 geom_object_pt[1] = obj_tl_pt;
742 ref_value[3]=s_tl[0];
758 geom_object_pt[2] = obj_wall_pt;
763 ref_value[4]=s_wall[0];
767 add_node_update_info(
785 unsigned nnod_lin=
dynamic_cast<ELEMENT*
>(
788 for (
unsigned i0=0;i0<nnod_lin;i0++)
791 double rho_0=double(i0)/double(nnod_lin-1);
793 for (
unsigned i1=0;i1<nnod_lin;i1++)
796 double rho_1=double(i1)/double(nnod_lin-1);
799 unsigned jnod=i0+i1*nnod_lin;
814 geom_object_pt[0] = obj_br_pt;
819 ref_value[2]=s_br[0];
822 geom_object_pt[1] = obj_tl_pt;
827 ref_value[3]=s_tl[0];
843 geom_object_pt[2] = obj_wall_pt;
848 ref_value[4]=s_wall[0];
852 add_node_update_info(
868 template <
class ELEMENT>
890 "Trying to update the nodal position at a time level\n";
891 error_message +=
"beyond the number of previous values in the nodes'\n";
892 error_message +=
"position timestepper. This seems highly suspect!\n";
893 error_message +=
"If you're sure the code behaves correctly\n";
894 error_message +=
"in your application, remove this warning \n";
895 error_message +=
"or recompile with PARNOID switched off.\n";
898 "AlgebraicRefineableQuarterCircleSectorMesh::";
899 function_name +=
"node_update_in_central_box()",
901 OOMPH_CURRENT_FUNCTION,
902 OOMPH_EXCEPTION_LOCATION);
911 vector_geom_object_pt(Central_box));
914 double rho_x=ref_value[0];
917 double rho_y=ref_value[1];
926 unsigned n_dim = obj_br_pt->
ndim();
930 s_br[0]=ref_value[2];
943 s_tl[0]=ref_value[3];
949 node_pt->
x(t,0)=r_br[0]*Lambda_x*rho_x;
950 node_pt->
x(t,1)=r_tl[1]*Lambda_y*rho_y;
959 template <
class ELEMENT>
981 "Trying to update the nodal position at a time level";
982 error_message +=
"beyond the number of previous values in the nodes'";
983 error_message +=
"position timestepper. This seems highly suspect!";
984 error_message +=
"If you're sure the code behaves correctly";
985 error_message +=
"in your application, remove this warning ";
986 error_message +=
"or recompile with PARNOID switched off.";
989 "AlgebraicRefineableQuarterCircleSectorMesh::";
990 function_name +=
"node_update_in_lower_right_box()",
992 OOMPH_CURRENT_FUNCTION,
993 OOMPH_EXCEPTION_LOCATION);
1000 vector_ref_value(Lower_right_box));
1004 vector_geom_object_pt(Lower_right_box));
1007 double rho_0=ref_value[0];
1010 double rho_1=ref_value[1];
1018 unsigned n_dim=obj_br_pt->
ndim();
1022 s_br[0]=ref_value[2];
1035 s_tl[0]=ref_value[3];
1042 r_box[0]=Lambda_x*r_br[0];
1043 r_box[1]=Lambda_y*r_tl[1];
1047 r_left[0]=Lambda_x*r_br[0]+rho_1*(r_box[0]-Lambda_x*r_br[0]);
1048 r_left[1]=Lambda_x*r_br[1]+rho_1*(r_box[1]-Lambda_x*r_br[1]);
1057 s_wall[0]=ref_value[4];
1060 obj_wall_pt->position(t,s_wall,r_wall);
1063 node_pt->
x(t,0)=r_left[0]+rho_0*(r_wall[0]-r_left[0]);
1064 node_pt->
x(t,1)=r_left[1]+rho_0*(r_wall[1]-r_left[1]);
1071 template <
class ELEMENT>
1093 "Trying to update the nodal position at a time level";
1094 error_message +=
"beyond the number of previous values in the nodes'";
1095 error_message +=
"position timestepper. This seems highly suspect!";
1096 error_message +=
"If you're sure the code behaves correctly";
1097 error_message +=
"in your application, remove this warning ";
1098 error_message +=
"or recompile with PARNOID switched off.";
1101 "AlgebraicRefineableQuarterCircleSectorMesh::";
1102 function_name +=
"node_update_in_upper_left_box()";
1105 OOMPH_CURRENT_FUNCTION,
1106 OOMPH_EXCEPTION_LOCATION);
1112 vector_ref_value(Upper_left_box));
1116 vector_geom_object_pt(Upper_left_box));
1119 double rho_0=ref_value[0];
1122 double rho_1=ref_value[1];
1130 unsigned n_dim=obj_br_pt->
ndim();
1134 s_br[0]=ref_value[2];
1154 r_box[0]=Lambda_x*r_br[0];
1155 r_box[1]=Lambda_y*r_tl[1];
1159 r_top[0]=Lambda_y*r_tl[0]+rho_0*(r_box[0]-Lambda_y*r_tl[0]);
1160 r_top[1]=Lambda_y*r_tl[1]+rho_0*(r_box[1]-Lambda_y*r_tl[1]);
1172 obj_wall_pt->position(t,s_wall,r_wall);
1176 node_pt->
x(t,0)=r_top[0]+rho_1*(r_wall[0]-r_top[0]);
1177 node_pt->
x(t,1)=r_top[1]+rho_1*(r_wall[1]-r_top[1]);
1185 template <
class ELEMENT>
1192 vector_ref_value(Lower_right_box));
1196 vector_geom_object_pt(Lower_right_box));
1212 double rho_1=ref_value[1];
1228 geom_object_pt[0] = obj_br_pt;
1233 ref_value[2]=s_br[0];
1249 geom_object_pt[1] = obj_tl_pt;
1254 ref_value[3]=s_tl[0];
1262 xi_wall[0]=xi_lo+rho_1*fract_mid*(xi_hi-xi_lo);
1271 geom_object_pt[2] = obj_wall_pt;
1276 ref_value[4]=s_wall[0];
1290 template <
class ELEMENT>
1297 vector_ref_value(Upper_left_box));
1301 vector_geom_object_pt(Upper_left_box));
1316 double rho_0=ref_value[0];
1331 geom_object_pt[0] = obj_br_pt;
1336 ref_value[2]=s_br[0];
1350 geom_object_pt[1] = obj_tl_pt;
1355 ref_value[3]=s_tl[0];
1363 xi_wall[0]=xi_hi+rho_0*(1.0-fract_mid)*(xi_lo-xi_hi);
1371 geom_object_pt[2] = obj_wall_pt;
1376 ref_value[4]=s_wall[0];
void node_update_in_lower_right_box(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for a node that is located in the lower right box.
GeomObject * geom_object_pt(const unsigned &i)
Return pointer to i-th geometric object involved in default (usually first) update function...
Vector< Node * > Node_pt
Vector of pointers to nodes.
void node_update_in_upper_left_box(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for a node that is located in the upper left box.
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
std::vector< bool > Boundary_coordinate_exists
Vector of boolean data that indicates whether the boundary coordinates have been set for the boundary...
void kill_node_update_info(const int &id=0)
Erase algebraic node update information for id-th node update function. Id defaults to 0...
void update_node_update_in_lower_right_box(AlgebraicNode *&node_pt)
Update algebraic node update function for nodes in lower right box.
void add_node_update_info(const int &id, AlgebraicMesh *mesh_pt, const Vector< GeomObject *> &geom_object_pt, const Vector< double > &ref_value, const bool &called_from_constructor=false)
Add algebraic update information for node: What's the ID of the mesh update function (typically used ...
A general Finite Element class.
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
void node_update_in_central_box(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for a node that is located in the central box.
double Fract_mid
Fraction along wall where outer ring is to be divided.
unsigned long nelement() const
Return number of elements in the mesh.
Vector< double > & vector_ref_value()
Return vector of reference values involved in default (usually first) update function.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
double Xi_lo
Lower limit for the (1D) coordinates along the wall.
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
QuarterCircleSectorDomain * Domain_pt
Pointer to Domain.
void setup_boundary_element_info()
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned ndim() const
Access function to # of Eulerian coordinates.
QuarterCircleSectorMesh(GeomObject *wall_pt, const double &xi_lo, const double &fract_mid, const double &xi_hi, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to geometric object that specifies the wall, start and end coordinates on t...
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Circular sector as domain. Domain is bounded by curved boundary which is represented by a GeomObject...
double ref_value(const unsigned &i)
Return i-th reference value involved in default (usually first) update function.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
double Xi_hi
Upper limit for the (1D) coordinates along the wall.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
GeomObject * Wall_pt
Pointer to the geometric object that represents the curved wall (mesh boundary 1) ...
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...
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
void update_node_update_in_upper_left_box(AlgebraicNode *&node_pt)
Update algebraic node update function for nodes in upper left box.
unsigned nnode() const
Return the number of nodes.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
void setup_algebraic_node_update()
Setup algebraic update operation for all nodes.