26 #ifndef OOMPH_FSI_DRIVEN_CAVITY_MESH_TEMPLATE_CC
27 #define OOMPH_FSI_DRIVEN_CAVITY_MESH_TEMPLATE_CC
40 template<
class ELEMENT>
46 const double& gap_fraction,
52 Gap_fraction(gap_fraction),
56 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
70 for (
unsigned b = 0; b < nbound; b++)
79 unsigned nnod = this->
nnode();
80 for (
unsigned j = 0; j < nnod; j++)
82 if (this->
node_pt(j)->is_on_boundary())
84 std::ostringstream error_message;
85 error_message <<
"Node " << j <<
"is still on boundary " << std::endl;
88 OOMPH_CURRENT_FUNCTION,
89 OOMPH_EXCEPTION_LOCATION);
105 double dzeta = lx / double(
nx);
110 for (
unsigned e = 0;
e < nelem;
e++)
115 for (
unsigned i = 0;
i < nnode_1d;
i++)
121 if (
e > ((ny - 1) *
nx) - 1)
123 for (
unsigned i = 0;
i < nnode_1d;
i++)
129 unsigned ix =
e - (
ny - 1) *
nx;
133 double(ix) * dzeta + double(
i) * dzeta / double(nnode_1d - 1);
144 for (
unsigned i = 0;
i < nnode_1d;
i++)
161 if (
e %
nx ==
nx - 1)
163 for (
unsigned i = 0;
i < nnode_1d;
i++)
200 template<
class ELEMENT>
221 "Trying to update the nodal position at a time level";
222 error_message +=
"beyond the number of previous values in the nodes'";
223 error_message +=
"position timestepper. This seems highly suspect!";
224 error_message +=
"If you're sure the code behaves correctly";
225 error_message +=
"in your application, remove this warning ";
226 error_message +=
"or recompile with PARNOID switched off.";
228 std::string function_name =
"AlgebraicFSIDrivenCavityMesh::";
229 function_name +=
"algebraic_node_update()";
232 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
241 double x_bottom = ref_value[0];
246 double fract = ref_value[1];
273 node_pt->
x(
t, 0) = x_bottom + fract * (r_wall[0] - x_bottom);
274 node_pt->
x(
t, 1) = fract * r_wall[1];
282 template<
class ELEMENT>
286 unsigned nnod = this->nnode();
287 for (
unsigned j = 0; j < nnod; j++)
295 double x = nod_pt->
x(0);
296 double y = nod_pt->
x(1);
312 this->Wall_pt->locate_zeta(zeta, geom_obj_pt,
s);
320 if ((std::fabs(r_wall[0] - x) > 1.0e-15) &&
321 (std::fabs(r_wall[1] - y) > 1.0e-15))
323 std::ostringstream error_stream;
324 error_stream <<
"Wall must be in its undeformed position when\n"
325 <<
"algebraic node update information is set up!\n "
326 <<
"x-discrepancy: " << std::fabs(r_wall[0] - x)
328 <<
"y-discrepancy: " << std::fabs(r_wall[1] - y)
332 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
343 geom_object_pt[0] = geom_obj_pt;
349 ref_value[0] = r_wall[0];
354 ref_value[1] = y / r_wall[1];
366 ref_value[3] = zeta[0];
387 template<
class ELEMENT>
410 double zeta = ref_value[3];
440 geom_object_pt[0] = geom_obj_pt;
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
void setup_algebraic_node_update()
Function to setup the algebraic node update.
////////////////////////////////////////////////////////////////////
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.
double Gap_fraction
Fraction of the gap next to moving lid, relative to the height of the domain.
FSIDrivenCavityMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, const double &gap_fraction, GeomObject *wall_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements, number of elements, fractional height of the gap above the movi...
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...
/////////////////////////////////////////////////////////////////////
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
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.
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.
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.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nelement() const
Return number of elements in the mesh.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
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...
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 ...
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.
const unsigned & nx() const
Access function for number of elements in x directions.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...