31 #include "navier_stokes.h"
33 #include "constitutive.h"
36 #include "meshes/triangle_mesh.h"
41 using namespace oomph;
47 template<
class ELEMENT>
49 public virtual SolidMesh
56 const std::string& element_file_name,
57 const std::string& poly_file_name,
58 TimeStepper* time_stepper_pt=
59 &Mesh::Default_TimeStepper) :
60 TriangleMesh<ELEMENT>(node_file_name,element_file_name,
61 poly_file_name, time_stepper_pt)
64 set_lagrangian_nodal_coordinates();
67 this->identify_boundaries();
75 this->set_nboundary(3);
77 unsigned n_node=this->nnode();
78 for (
unsigned j=0;j<n_node;j++)
80 Node* nod_pt=this->node_pt(j);
83 if (nod_pt->x(0)<0.226)
87 if ((nod_pt->x(1)<4.08)&&(nod_pt->x(1)>0.113))
89 this->remove_boundary_node(0,nod_pt);
91 this->add_boundary_node(1,nod_pt);
95 if (nod_pt->x(0)>8.28)
99 if ((nod_pt->x(1)<4.08)&&(nod_pt->x(1)>0.113))
101 this->remove_boundary_node(0,nod_pt);
103 this->add_boundary_node(2,nod_pt);
106 this->setup_boundary_element_info();
145 template<
class ELEMENT>
160 return Fluid_mesh_pt;
164 void set_boundary_conditions();
167 void doc_solution(DocInfo& doc_info);
181 template<
class ELEMENT>
186 string fluid_node_file_name=
"fluid.fig.1.node";
187 string fluid_element_file_name=
"fluid.fig.1.ele";
188 string fluid_poly_file_name=
"fluid.fig.1.poly";
190 fluid_element_file_name,
191 fluid_poly_file_name);
194 this->set_boundary_conditions();
197 add_sub_mesh(fluid_mesh_pt());
203 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
213 template<
class ELEMENT>
217 std::ofstream solid_bc_file(
"pinned_solid_nodes.dat");
218 std::ofstream u_bc_file(
"pinned_u_nodes.dat");
219 std::ofstream v_bc_file(
"pinned_v_nodes.dat");
224 unsigned nbound=Fluid_mesh_pt->nboundary();
225 for(
unsigned ibound=0;ibound<nbound;ibound++)
227 unsigned num_nod=Fluid_mesh_pt->nboundary_node(ibound);
228 for (
unsigned inod=0;inod<num_nod;inod++)
231 Node* nod_pt=Fluid_mesh_pt->boundary_node_pt(ibound,inod);
240 u_bc_file << nod_pt->x(0) <<
" " << nod_pt->x(1) << std::endl;
245 v_bc_file << nod_pt->x(0) <<
" " << nod_pt->x(1) << std::endl;
248 for(
unsigned i=0;i<2;i++)
251 SolidNode* nod_pt=Fluid_mesh_pt->boundary_node_pt(ibound,inod);
252 nod_pt->pin_position(i);
255 solid_bc_file << nod_pt->x(i) <<
" ";
257 solid_bc_file << std::endl;
262 solid_bc_file.close();
265 unsigned n_element = fluid_mesh_pt()->nelement();
266 for(
unsigned e=0;e<n_element;e++)
269 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(fluid_mesh_pt()->element_pt(e));
275 el_pt->constitutive_law_pt() =
286 double y_min=fluid_mesh_pt()->boundary_node_pt(ibound,0)->x(1);
289 unsigned num_nod= fluid_mesh_pt()->nboundary_node(ibound);
290 for (
unsigned inod=1;inod<num_nod;inod++)
292 double y=fluid_mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
302 double y_mid=0.5*(y_min+y_max);
305 for (
unsigned ibound=0;ibound<fluid_mesh_pt()->nboundary();ibound++)
307 unsigned num_nod= fluid_mesh_pt()->nboundary_node(ibound);
308 for (
unsigned inod=0;inod<num_nod;inod++)
313 double y=fluid_mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
314 double veloc=1.5/(y_max-y_min)*
315 (y-y_min)*(y_max-y)/((y_mid-y_min)*(y_max-y_mid));
316 fluid_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,veloc);
317 fluid_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
324 fluid_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
326 fluid_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
338 template<
class ELEMENT>
349 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
351 some_file.open(filename);
352 fluid_mesh_pt()->output(some_file,npts);
382 doc_info.set_directory(
"RESLT_TH");
389 TTaylorHoodElement<2>,
390 TPVDElement<2,3> > > problem;
393 problem.
fluid_mesh_pt()->output_boundaries(
"RESLT_TH/boundaries.dat");
396 problem.doc_solution(doc_info);
400 double re_increment=5.0;
402 for (
unsigned i=0;i<nstep;i++)
405 problem.newton_solve();
408 problem.doc_solution(doc_info);
421 doc_info.set_directory(
"RESLT_CR");
431 TCrouzeixRaviartElement<2>,
432 TPVDBubbleEnrichedElement<2,3> > > problem;
435 problem.
fluid_mesh_pt()->output_boundaries(
"RESLT_CR/boundaries.dat");
438 problem.doc_solution(doc_info);
442 double re_increment=5.0;
444 for (
unsigned i=0;i<nstep;i++)
447 problem.newton_solve();
450 problem.doc_solution(doc_info);
Triangle-based mesh upgraded to become a (pseudo-) solid mesh.
ElasticTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor:
void identify_boundaries()
Function used to identify the domain boundaries.
virtual ~ElasticTriangleMesh()
Empty Destructor.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
~UnstructuredFluidProblem()
Destructor (empty)
void set_boundary_conditions()
Set the boundary conditions.
UnstructuredFluidProblem()
Constructor.
ElasticTriangleMesh< ELEMENT > * Fluid_mesh_pt
Fluid mesh.
ElasticTriangleMesh< ELEMENT > *& fluid_mesh_pt()
Access function for the fluid mesh.
void doc_solution(DocInfo &doc_info)
Doc the solution.
Namespace for physical parameters.
ConstitutiveLaw * Constitutive_law_pt
Constitutive law used to determine the mesh deformation.
double Nu
Pseudo-solid Poisson ratio.
double Re
Reynolds number.
int main()
///////////////////////////////////////////////////////////////////// ///////////////////////////////...