26 #ifndef OOMPH_QUARTER_CIRCLE_SECTOR_MESH_TEMPLATE_CC
27 #define OOMPH_QUARTER_CIRCLE_SECTOR_MESH_TEMPLATE_CC
43 template<
class ELEMENT>
47 const double& fract_mid,
50 : Wall_pt(wall_pt), Xi_lo(xi_lo), Fract_mid(fract_mid), Xi_hi(xi_hi)
53 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
74 Node_pt.resize(n_p * n_p + (n_p - 1) * n_p + (n_p - 1) * (n_p - 1));
88 unsigned long node_count = 0;
112 Node_pt[node_count]->x(0) = r[0];
113 Node_pt[node_count]->x(1) = r[1];
124 for (
unsigned l1 = 1; l1 < n_p; l1++)
127 unsigned jnod_local = l1;
131 jnod_local, time_stepper_pt);
137 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
140 Node_pt[node_count]->x(0) = r[0];
141 Node_pt[node_count]->x(1) = r[1];
153 for (
unsigned l2 = 1; l2 < n_p; l2++)
159 unsigned jnod_local = n_p * l2;
163 jnod_local, time_stepper_pt);
171 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
174 Node_pt[node_count]->x(0) = r[0];
175 Node_pt[node_count]->x(1) = r[1];
187 for (
unsigned l1 = 1; l1 < n_p; l1++)
190 unsigned jnod_local = l1 + n_p * l2;
200 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
201 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
203 Node_pt[node_count]->x(0) = r[0];
204 Node_pt[node_count]->x(1) = r[1];
218 for (
unsigned l2 = 0; l2 < n_p; l2++)
221 unsigned jnod_local_old = (n_p - 1) + l2 * n_p;
230 for (
unsigned l1 = 1; l1 < n_p - 1; l1++)
236 unsigned jnod_local = l1;
240 jnod_local, time_stepper_pt);
246 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
249 Node_pt[node_count]->x(0) = r[0];
250 Node_pt[node_count]->x(1) = r[1];
260 for (
unsigned l2 = 1; l2 < n_p; l2++)
263 unsigned jnod_local = l1 + l2 * n_p;
273 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
274 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
276 Node_pt[node_count]->x(0) = r[0];
277 Node_pt[node_count]->x(1) = r[1];
291 unsigned jnod_local = n_p - 1;
295 jnod_local, time_stepper_pt);
304 Node_pt[node_count]->x(0) = r[0];
305 Node_pt[node_count]->x(1) = r[1];
313 Node_pt[node_count]->set_coordinates_on_boundary(1, zeta);
320 for (
unsigned l2 = 1; l2 < n_p; l2++)
323 unsigned jnod_local = (n_p - 1) + l2 * n_p;
327 jnod_local, time_stepper_pt);
334 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
336 Node_pt[node_count]->x(0) = r[0];
337 Node_pt[node_count]->x(1) = r[1];
344 Node_pt[node_count]->set_coordinates_on_boundary(1, zeta);
359 for (
unsigned l1 = 0; l1 < n_p; l1++)
362 unsigned jnod_local_old = n_p * (n_p - 1) + l1;
365 unsigned jnod_local = l1;
377 for (
unsigned l2 = 1; l2 < n_p; l2++)
380 unsigned jnod_local_old = n_p * (n_p - 1) + l2;
383 unsigned jnod_local = (n_p - 1) + l2 * n_p;
393 for (
unsigned l2 = 1; l2 < n_p - 1; l2++)
399 unsigned jnod_local = n_p * l2;
403 jnod_local, time_stepper_pt);
410 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
413 Node_pt[node_count]->x(0) = r[0];
414 Node_pt[node_count]->x(1) = r[1];
425 for (
unsigned l1 = 1; l1 < n_p - 1; l1++)
428 unsigned jnod_local = l1 + n_p * l2;
438 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
439 s[1] = -1.0 + 2.0 * double(l2) / double(n_p - 1);
441 Node_pt[node_count]->x(0) = r[0];
442 Node_pt[node_count]->x(1) = r[1];
454 jnod_local = n_p * (n_p - 1);
458 jnod_local, time_stepper_pt);
467 Node_pt[node_count]->x(0) = r[0];
468 Node_pt[node_count]->x(1) = r[1];
476 Node_pt[node_count]->set_coordinates_on_boundary(1, zeta);
484 for (
unsigned l1 = 1; l1 < n_p - 1; l1++)
487 unsigned jnod_local = n_p * (n_p - 1) + l1;
491 jnod_local, time_stepper_pt);
497 s[0] = -1.0 + 2.0 * double(l1) / double(n_p - 1);
500 Node_pt[node_count]->x(0) = r[0];
501 Node_pt[node_count]->x(1) = r[1];
509 Node_pt[node_count]->set_coordinates_on_boundary(1, zeta);
517 unsigned n_element = this->
nelement();
518 for (
unsigned e = 0;
e < n_element;
e++)
521 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(this->
element_pt(
e));
555 template<
class ELEMENT>
557 ELEMENT>::setup_algebraic_node_update()
564 if (central_box_pt == 0)
566 std::ostringstream error_message;
568 <<
"Element in AlgebraicRefineableQuarterCircleSectorMesh must be\n ";
569 error_message <<
"derived from AlgebraicElementBase\n";
570 error_message <<
"but it is of type: "
573 "AlgebraicRefineableQuarterCircleSectorMesh::";
574 function_name +=
"setup_algebraic_node_update()";
576 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
594 Lambda_x = x_box / r_br[0];
599 this->Wall_pt->locate_zeta(xi, obj_br_pt, s_br);
609 Lambda_y = y_box / r_tl[1];
614 this->Wall_pt->locate_zeta(xi, obj_tl_pt, s_tl);
625 for (
unsigned jnod = 0; jnod < nnodes; jnod++)
638 ref_value[0] = x / x_box;
641 ref_value[1] = y / y_box;
644 geom_object_pt[0] = obj_br_pt;
649 ref_value[2] = s_br[0];
653 geom_object_pt[1] = obj_tl_pt;
658 ref_value[3] = s_tl[0];
662 ->add_node_update_info(Central_box,
681 for (
unsigned i0 = 0; i0 < nnod_lin; i0++)
684 double rho_0 = double(i0) / double(nnod_lin - 1);
686 for (
unsigned i1 = 0; i1 < nnod_lin; i1++)
689 double rho_1 = double(i1) / double(nnod_lin - 1);
692 unsigned jnod = i0 + i1 * nnod_lin;
701 ref_value[0] = rho_0;
704 ref_value[1] = rho_1;
707 geom_object_pt[0] = obj_br_pt;
713 ref_value[2] = s_br[0];
716 geom_object_pt[1] = obj_tl_pt;
722 ref_value[3] = s_tl[0];
735 this->Wall_pt->locate_zeta(xi_wall, obj_wall_pt, s_wall);
738 geom_object_pt[2] = obj_wall_pt;
744 ref_value[4] = s_wall[0];
748 ->add_node_update_info(Lower_right_box,
767 for (
unsigned i0 = 0; i0 < nnod_lin; i0++)
770 double rho_0 = double(i0) / double(nnod_lin - 1);
772 for (
unsigned i1 = 0; i1 < nnod_lin; i1++)
775 double rho_1 = double(i1) / double(nnod_lin - 1);
778 unsigned jnod = i0 + i1 * nnod_lin;
787 ref_value[0] = rho_0;
790 ref_value[1] = rho_1;
793 geom_object_pt[0] = obj_br_pt;
799 ref_value[2] = s_br[0];
802 geom_object_pt[1] = obj_tl_pt;
808 ref_value[3] = s_tl[0];
822 this->Wall_pt->locate_zeta(xi_wall, obj_wall_pt, s_wall);
825 geom_object_pt[2] = obj_wall_pt;
831 ref_value[4] = s_wall[0];
835 ->add_node_update_info(Upper_left_box,
849 template<
class ELEMENT>
851 ELEMENT>::node_update_in_central_box(
const unsigned&
t,
871 "Trying to update the nodal position at a time level\n";
872 error_message +=
"beyond the number of previous values in the nodes'\n";
873 error_message +=
"position timestepper. This seems highly suspect!\n";
874 error_message +=
"If you're sure the code behaves correctly\n";
875 error_message +=
"in your application, remove this warning \n";
876 error_message +=
"or recompile with PARNOID switched off.\n";
879 "AlgebraicRefineableQuarterCircleSectorMesh::";
880 function_name +=
"node_update_in_central_box()",
882 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
894 double rho_x = ref_value[0];
897 double rho_y = ref_value[1];
906 unsigned n_dim = obj_br_pt->
ndim();
910 s_br[0] = ref_value[2];
923 s_tl[0] = ref_value[3];
929 node_pt->
x(
t, 0) = r_br[0] * Lambda_x * rho_x;
930 node_pt->
x(
t, 1) = r_tl[1] * Lambda_y * rho_y;
938 template<
class ELEMENT>
940 ELEMENT>::node_update_in_lower_right_box(
const unsigned&
t,
960 "Trying to update the nodal position at a time level";
961 error_message +=
"beyond the number of previous values in the nodes'";
962 error_message +=
"position timestepper. This seems highly suspect!";
963 error_message +=
"If you're sure the code behaves correctly";
964 error_message +=
"in your application, remove this warning ";
965 error_message +=
"or recompile with PARNOID switched off.";
968 "AlgebraicRefineableQuarterCircleSectorMesh::";
969 function_name +=
"node_update_in_lower_right_box()",
971 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
983 double rho_0 = ref_value[0];
986 double rho_1 = ref_value[1];
994 unsigned n_dim = obj_br_pt->
ndim();
998 s_br[0] = ref_value[2];
1011 s_tl[0] = ref_value[3];
1018 r_box[0] = Lambda_x * r_br[0];
1019 r_box[1] = Lambda_y * r_tl[1];
1023 r_left[0] = Lambda_x * r_br[0] + rho_1 * (r_box[0] - Lambda_x * r_br[0]);
1024 r_left[1] = Lambda_x * r_br[1] + rho_1 * (r_box[1] - Lambda_x * r_br[1]);
1033 s_wall[0] = ref_value[4];
1036 obj_wall_pt->position(
t, s_wall, r_wall);
1039 node_pt->
x(
t, 0) = r_left[0] + rho_0 * (r_wall[0] - r_left[0]);
1040 node_pt->
x(
t, 1) = r_left[1] + rho_0 * (r_wall[1] - r_left[1]);
1046 template<
class ELEMENT>
1048 ELEMENT>::node_update_in_upper_left_box(
const unsigned&
t,
1068 "Trying to update the nodal position at a time level";
1069 error_message +=
"beyond the number of previous values in the nodes'";
1070 error_message +=
"position timestepper. This seems highly suspect!";
1071 error_message +=
"If you're sure the code behaves correctly";
1072 error_message +=
"in your application, remove this warning ";
1073 error_message +=
"or recompile with PARNOID switched off.";
1076 "AlgebraicRefineableQuarterCircleSectorMesh::";
1077 function_name +=
"node_update_in_upper_left_box()";
1080 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1092 double rho_0 = ref_value[0];
1095 double rho_1 = ref_value[1];
1103 unsigned n_dim = obj_br_pt->
ndim();
1107 s_br[0] = ref_value[2];
1127 r_box[0] = Lambda_x * r_br[0];
1128 r_box[1] = Lambda_y * r_tl[1];
1132 r_top[0] = Lambda_y * r_tl[0] + rho_0 * (r_box[0] - Lambda_y * r_tl[0]);
1133 r_top[1] = Lambda_y * r_tl[1] + rho_0 * (r_box[1] - Lambda_y * r_tl[1]);
1145 obj_wall_pt->position(
t, s_wall, r_wall);
1149 node_pt->
x(
t, 0) = r_top[0] + rho_1 * (r_wall[0] - r_top[0]);
1150 node_pt->
x(
t, 1) = r_top[1] + rho_1 * (r_wall[1] - r_top[1]);
1157 template<
class ELEMENT>
1182 double rho_1 = ref_value[1];
1195 this->Wall_pt->locate_zeta(xi, obj_br_pt, s_br);
1198 geom_object_pt[0] = obj_br_pt;
1203 ref_value[2] = s_br[0];
1215 this->Wall_pt->locate_zeta(xi, obj_tl_pt, s_tl);
1218 geom_object_pt[1] = obj_tl_pt;
1223 ref_value[3] = s_tl[0];
1231 xi_wall[0] = xi_lo + rho_1 * fract_mid * (xi_hi - xi_lo);
1237 this->Wall_pt->locate_zeta(xi_wall, obj_wall_pt, s_wall);
1240 geom_object_pt[2] = obj_wall_pt;
1245 ref_value[4] = s_wall[0];
1257 template<
class ELEMENT>
1281 double rho_0 = ref_value[0];
1293 this->Wall_pt->locate_zeta(xi, obj_br_pt, s_br);
1296 geom_object_pt[0] = obj_br_pt;
1301 ref_value[2] = s_br[0];
1312 this->Wall_pt->locate_zeta(xi, obj_tl_pt, s_tl);
1315 geom_object_pt[1] = obj_tl_pt;
1320 ref_value[3] = s_tl[0];
1328 xi_wall[0] = xi_hi + rho_0 * (1.0 - fract_mid) * (xi_lo - xi_hi);
1333 this->Wall_pt->locate_zeta(xi_wall, obj_wall_pt, s_wall);
1336 geom_object_pt[2] = obj_wall_pt;
1341 ref_value[4] = s_wall[0];
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
GeomObject * geom_object_pt(const unsigned &i)
Return pointer to i-th geometric object involved in default (usually first) update function.
double ref_value(const unsigned &i)
Return i-th reference value involved in default (usually first) update function.
void kill_node_update_info(const int &id=0)
Erase algebraic node update information for id-th node update function. Id defaults to 0.
Vector< GeomObject * > & vector_geom_object_pt(const int &id)
Return vector of geometric objects involved in id-th update function.
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 ...
Vector< double > & vector_ref_value()
Return vector of reference values involved in default (usually first) update function.
Algebraic version of RefineableQuarterCircleSectorMesh.
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
A general Finite Element class.
virtual Node * construct_node(const unsigned &n)
Construct the local node n and return a pointer to the newly created node object.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
unsigned nnode() const
Return the number of nodes.
virtual Node * construct_boundary_node(const unsigned &n)
Construct the local node n as a boundary node; that is a node that MAY be placed on a mesh boundary a...
/////////////////////////////////////////////////////////////////////
unsigned ndim() const
Access function to # of Eulerian coordinates.
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
void macro_map(const Vector< double > &s, Vector< double > &r)
The mapping from local to global coordinates at the current time : r(s)
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
Vector< Node * > Node_pt
Vector of pointers to nodes.
std::vector< bool > Boundary_coordinate_exists
Vector of boolean data that indicates whether the boundary coordinates have been set for the boundary...
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
unsigned long nelement() const
Return number of elements in the mesh.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
An OomphLibError object which should be thrown when an run-time error is encountered....
void setup_boundary_element_info()
Setup lookup schemes which establish whic elements are located next to mesh's boundaries (wrapper to ...
Circular sector as domain. Domain is bounded by curved boundary which is represented by a GeomObject....
2D quarter ring mesh class. The domain is specified by the GeomObject that identifies boundary 1.
GeomObject *& wall_pt()
Access function to GeomObject representing wall.
double Fract_mid
Fraction along wall where outer ring is to be divided.
double Xi_hi
Upper limit for the (1D) coordinates along the wall.
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...
QuarterCircleSectorDomain * Domain_pt
Pointer to Domain.
double Xi_lo
Lower limit for the (1D) coordinates along the wall.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...