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,
53 TimeStepper* time_stepper_pt)
55 Nx(nx), Ny(ny), Gap_fraction(gap_fraction), Wall_pt(wall_pt)
58 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
71 unsigned nbound=this->nboundary();
72 for (
unsigned b=0;b<nbound;b++)
76 this->remove_boundary_nodes(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;
89 throw OomphLibError(error_message.str(),
90 OOMPH_CURRENT_FUNCTION,
91 OOMPH_EXCEPTION_LOCATION);
97 this->set_nboundary(6);
100 unsigned nnode_1d=this->finite_element_pt(0)->nnode_1d();
103 Vector<double> zeta(1);
107 double dzeta= lx/double(nx);
111 unsigned nelem=this->nelement();
112 for (
unsigned e=0;e<nelem;e++)
117 for (
unsigned i=0;i<nnode_1d;i++)
119 this->add_boundary_node(0, this->finite_element_pt(e)->node_pt(i));
125 for (
unsigned i=0;i<nnode_1d;i++)
127 this->add_boundary_node(3,
128 this->finite_element_pt(e)->node_pt(2*nnode_1d+i));
131 unsigned ix=e-(ny-1)*nx;
134 zeta[0]=double(ix)*dzeta+double(i)*dzeta/double(nnode_1d-1);
137 this->finite_element_pt(e)->node_pt(2*nnode_1d+i)->
138 set_coordinates_on_boundary(3,zeta);
144 for (
unsigned i=0;i<nnode_1d;i++)
146 Node* nod_pt=this->finite_element_pt(e)->node_pt(i*nnode_1d);
151 this->add_boundary_node(4,nod_pt);
156 this->add_boundary_node(5,nod_pt);
163 for (
unsigned i=0;i<nnode_1d;i++)
165 Node* nod_pt=this->finite_element_pt(e)->node_pt((i+1)*nnode_1d-1);
170 this->add_boundary_node(2,nod_pt);
175 this->add_boundary_node(1,nod_pt);
183 this->setup_boundary_element_info();
186 this->Boundary_coordinate_exists[3] =
true;
202 template<
class ELEMENT>
204 const unsigned& t, AlgebraicNode*& node_pt)
222 if (t>node_pt->position_time_stepper_pt()->nprev_values())
224 std::string error_message =
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.";
232 std::string function_name =
233 "AlgebraicFSIDrivenCavityMesh::";
234 function_name +=
"algebraic_node_update()";
236 throw OomphLibError(error_message,
237 OOMPH_CURRENT_FUNCTION,
238 OOMPH_EXCEPTION_LOCATION);
243 Vector<double> ref_value(node_pt->vector_ref_value());
247 double x_bottom=ref_value[0];
252 double fract=ref_value[1];
268 Vector<GeomObject*> geom_object_pt(node_pt->vector_geom_object_pt());
272 GeomObject* geom_obj_pt=geom_object_pt[0];
275 Vector<double> r_wall(2);
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++)
304 AlgebraicNode* nod_pt=node_pt(j);
307 double x=nod_pt->x(0);
308 double y=nod_pt->x(1);
311 Vector<double> zeta(1);
322 GeomObject* geom_obj_pt;
324 this->
Wall_pt->locate_zeta(zeta,geom_obj_pt,s);
327 Vector<double> r_wall(2);
328 geom_obj_pt->position(s,r_wall);
332 if ((std::fabs(r_wall[0]-x)>1.0e-15)&&(std::fabs(r_wall[1]-y)>1.0e-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);
350 Vector<GeomObject*> geom_object_pt(1);
355 geom_object_pt[0]=geom_obj_pt;
358 Vector<double> ref_value(4);
361 ref_value[0]=r_wall[0];
366 ref_value[1]=y/r_wall[1];
378 ref_value[3]=zeta[0];
381 nod_pt->add_node_update_info(
406 template<
class ELEMENT>
408 AlgebraicNode*& node_pt)
411 Vector<double> ref_value(node_pt->vector_ref_value());
429 double zeta=ref_value[3];
432 Vector<GeomObject*> geom_object_pt(node_pt->vector_geom_object_pt());
439 Vector<double> zeta_wall(1);
451 GeomObject* geom_obj_pt;
452 this->
Wall_pt->locate_zeta(zeta_wall,geom_obj_pt,s);
458 geom_object_pt[0]=geom_obj_pt;
482 node_pt->kill_node_update_info();
485 node_pt->add_node_update_info(
void update_node_update(AlgebraicNode *&node_pt)
Update the node update data for specified node following any mesh adapation.
double Gap_fraction
Fraction of the gap next to moving lid, relative to the height of the domain.
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
GeomObject * Wall_pt
Pointer to geometric object that represents the moving wall.
void setup_algebraic_node_update()
Function to setup the algebraic node update.
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...