30 #ifndef OOMPH_FSI_DRIVEN_CAVITY_MESH_TEMPLATE_CC 31 #define OOMPH_FSI_DRIVEN_CAVITY_MESH_TEMPLATE_CC 45 template <
class ELEMENT>
51 const double& gap_fraction,
55 Nx(nx), Ny(ny), Gap_fraction(gap_fraction), Wall_pt(wall_pt)
58 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
72 for (
unsigned b=0;b<nbound;b++)
81 unsigned nnod=this->
nnode();
82 for (
unsigned j=0;j<nnod;j++)
84 if (this->
node_pt(j)->is_on_boundary())
86 std::ostringstream error_message;
87 error_message <<
"Node " << j <<
"is still on boundary " << std::endl;
90 OOMPH_CURRENT_FUNCTION,
91 OOMPH_EXCEPTION_LOCATION);
107 double dzeta= lx/double(nx);
112 for (
unsigned e=0;
e<nelem;
e++)
117 for (
unsigned i=0;
i<nnode_1d;
i++)
125 for (
unsigned i=0;
i<nnode_1d;
i++)
131 unsigned ix=
e-(ny-1)*nx;
134 zeta[0]=double(ix)*dzeta+double(
i)*dzeta/double(nnode_1d-1);
138 set_coordinates_on_boundary(3,zeta);
144 for (
unsigned i=0;
i<nnode_1d;
i++)
163 for (
unsigned i=0;
i<nnode_1d;
i++)
202 template<
class ELEMENT>
225 "Trying to update the nodal position at a time level";
226 error_message +=
"beyond the number of previous values in the nodes'";
227 error_message +=
"position timestepper. This seems highly suspect!";
228 error_message +=
"If you're sure the code behaves correctly";
229 error_message +=
"in your application, remove this warning ";
230 error_message +=
"or recompile with PARNOID switched off.";
233 "AlgebraicFSIDrivenCavityMesh::";
234 function_name +=
"algebraic_node_update()";
237 OOMPH_CURRENT_FUNCTION,
238 OOMPH_EXCEPTION_LOCATION);
247 double x_bottom=ref_value[0];
252 double fract=ref_value[1];
276 geom_obj_pt->position(t,s,r_wall);
279 node_pt->
x(t,0)=x_bottom+fract*(r_wall[0]-x_bottom);
280 node_pt->
x(t,1)=fract*r_wall[1];
292 template<
class ELEMENT>
298 unsigned nnod=this->
nnode();
299 for (
unsigned j=0;j<nnod;j++)
307 double x=nod_pt->
x(0);
308 double y=nod_pt->
x(1);
332 if ((std::fabs(r_wall[0]-x)>1.0
e-15)&&(std::fabs(r_wall[1]-y)>1.0
e-15))
334 std::ostringstream error_stream;
336 <<
"Wall must be in its undeformed position when\n" 337 <<
"algebraic node update information is set up!\n " 338 <<
"x-discrepancy: " << std::fabs(r_wall[0]-x) << std::endl
339 <<
"y-discrepancy: " << std::fabs(r_wall[1]-y) << std::endl;
343 OOMPH_CURRENT_FUNCTION,
344 OOMPH_EXCEPTION_LOCATION);
355 geom_object_pt[0]=geom_obj_pt;
361 ref_value[0]=r_wall[0];
366 ref_value[1]=y/r_wall[1];
378 ref_value[3]=zeta[0];
406 template<
class ELEMENT>
429 double zeta=ref_value[3];
458 geom_object_pt[0]=geom_obj_pt;
void update_node_update(AlgebraicNode *&node_pt)
Update the node update data for specified node following any mesh adapation.
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 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 ...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
double Gap_fraction
Fraction of the gap next to moving lid, relative to the height of the domain.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
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.
GeomObject * Wall_pt
Pointer to geometric object that represents the moving wall.
unsigned nboundary() const
Return number of boundaries.
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
void setup_boundary_element_info()
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void setup_algebraic_node_update()
Function to setup the algebraic node update.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nnode() const
Return number of nodes in the mesh.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
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...
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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>,...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Vector< GeomObject * > & vector_geom_object_pt(const int &id)
Return vector of geometric objects involved in id-th update function.
void remove_boundary_nodes()
Clear all pointers to boundary nodes.