26#ifndef OOMPH_COLLAPSIBLE_CHANNEL_MESH_TEMPLATE_HEADER
27#define OOMPH_COLLAPSIBLE_CHANNEL_MESH_TEMPLATE_HEADER
29#ifndef OOMPH_COLLAPSIBLE_CHANNEL_MESH_HEADER
30#error __FILE__ should only be included from collapsible_channel_mesh.h.
44 template<
class ELEMENT>
47 const unsigned& ncollapsible,
48 const unsigned& ndown,
62 Ncollapsible(ncollapsible),
68 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
76 unsigned nmacro = (nup + ncollapsible + ndown) *
ny;
106 for (
unsigned b = 0; b <
nbound; b++)
116 for (
unsigned j = 0;
j <
nnod;
j++)
118 if (this->
node_pt(
j)->is_on_boundary())
120 std::ostringstream error_message;
121 error_message <<
"Node " <<
j <<
"is still on boundary " << std::endl;
149 for (
unsigned e = 0;
e < nelem;
e++)
152 if (
e < nup + ncollapsible + ndown)
154 for (
unsigned i = 0;
i < nnode_1d;
i++)
160 if ((
e > (ny - 1) * (nup + ncollapsible + ndown) - 1) &&
161 (
e < (
ny - 1) * (nup + ncollapsible + ndown) + nup))
163 for (
unsigned i = 0;
i < nnode_1d;
i++)
171 if ((
e > (
ny - 1) * (nup + ncollapsible + ndown) + nup - 1) &&
172 (
e < (
ny - 1) * (nup + ncollapsible + ndown) + nup + ncollapsible))
174 for (
unsigned i = 0;
i < nnode_1d;
i++)
189 ->
node_pt((nnode_1d - 1) * nnode_1d +
i)
195 (
ny - 1) * (nup + ncollapsible + ndown) + nup + ncollapsible - 1) &&
196 (
e <
ny * (nup + ncollapsible + ndown)))
198 for (
unsigned i = 0;
i < nnode_1d;
i++)
206 if (
e % (nup + ncollapsible + ndown) == 0)
208 for (
unsigned i = 0;
i < nnode_1d;
i++)
215 if (
e % (nup + ncollapsible + ndown) == (nup + ncollapsible + ndown) - 1)
217 for (
unsigned i = 0;
i < nnode_1d;
i++)
242 template<
class ELEMENT>
262 std::string error_message =
263 "Trying to update the nodal position at a time level";
264 error_message +=
"beyond the number of previous values in the nodes'";
265 error_message +=
"position timestepper. This seems highly suspect!";
266 error_message +=
"If you're sure the code behaves correctly";
267 error_message +=
"in your application, remove this warning ";
268 error_message +=
"or recompile with PARNOID switched off.";
270 std::string
function_name =
"AlgebraicCollapsibleChannelMesh::";
288 double fract = ref_value[1];
323 template<
class ELEMENT>
327 double l_up = this->domain_pt()->l_up();
328 double l_collapsible = this->domain_pt()->l_collapsible();
332 for (
unsigned j = 0;
j <
nnod;
j++)
344 if ((x >= l_up) && (x <= (l_up + l_collapsible)))
368 if ((std::fabs(
r_wall[0] - x) > 1.0e-15) &&
369 (std::fabs(
r_wall[1] - y) > 1.0e-15))
372 error_stream <<
"Wall must be in its undeformed position when\n"
373 <<
"algebraic node update information is set up!\n "
374 <<
"x-discrepancy: " << std::fabs(
r_wall[0] - x)
376 <<
"y-discrepancy: " << std::fabs(
r_wall[1] - y)
402 ref_value[1] = y /
r_wall[1];
414 ref_value[3] =
zeta[0];
417 nod_pt->add_node_update_info(
this,
434 template<
class ELEMENT>
457 double zeta = ref_value[3];
510 node_pt->kill_node_update_info();
513 node_pt->add_node_update_info(
this,
void setup_algebraic_node_update()
Function to setup the algebraic node update.
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
Algebraic nodes are nodes with an algebraic positional update function.
Collapsible channel domain.
CollapsibleChannelMesh(const unsigned &nup, const unsigned &ncollapsible, const unsigned &ndown, const unsigned &ny, const double &lup, const double &lcollapsible, const double &ldown, const double &ly, GeomObject *wall_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in upstream/collapsible/ downstream segment and across the chann...
GeomObject *& wall_pt()
Access function to GeomObject representing wall.
CollapsibleChannelDomain * Domain_pt
Pointer to domain.
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
A general Finite Element class.
virtual void set_macro_elem_pt(MacroElement *macro_elem_pt)
Set pointer to macro element – can be overloaded in derived elements to perform additional tasks.
void position(const Vector< double > &zeta, Vector< double > &r) const
Return the parametrised position of the FiniteElement in its incarnation as a GeomObject,...
unsigned nnode() const
Return the number of nodes.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
A geometric object is an object that provides a parametrised description of its shape via the functio...
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...
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th 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.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned nboundary() const
Return number of boundaries.
void remove_boundary_nodes()
Clear all pointers to boundary nodes.
unsigned long nnode() const
Return number of nodes in the mesh.
virtual void node_update(const bool &update_all_solid_nodes=false)
Update nodal positions in response to changes in the domain shape. Uses the FiniteElement::get_x(....
void set_boundary_coordinate_exists(const unsigned &i)
Set boundary coordinate on the i-th boundary to be existing.
unsigned long nelement() const
Return number of elements in the mesh.
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
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 ...
void update_node_update(AlgebraicNode *&node_pt)
Update the node update data for specified node following any mesh adapation.
Simple rectangular 2D Quad mesh class. Nx : number of elements in the x direction.
const unsigned & ny() const
Access function for number of elements in y directions.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).