33 #include "constitutive.h"
34 #include "navier_stokes.h"
37 #include "meshes/tetgen_mesh.h"
40 using namespace oomph;
62 const Vector<double>& x,
63 const Vector<double>& n,
64 Vector<double>& traction)
77 const Vector<double>& x,
78 const Vector<double>& n,
79 Vector<double>& traction)
96 template<
class ELEMENT>
109 void doc_solution(DocInfo& doc_info);
114 return Inflow_boundary_id.size();
120 return Outflow_boundary_id.size();
126 return Inflow_boundary_id.size()+Outflow_boundary_id.size();
132 void create_fluid_traction_elements();
155 template<
class ELEMENT>
160 string node_file_name=
"fsi_bifurcation_fluid.1.node";
161 string element_file_name=
"fsi_bifurcation_fluid.1.ele";
162 string face_file_name=
"fsi_bifurcation_fluid.1.face";
163 bool split_corner_elements=
true;
164 Fluid_mesh_pt =
new TetgenMesh<ELEMENT>(node_file_name,
167 split_corner_elements);
176 Inflow_boundary_id.resize(1);
177 Inflow_boundary_id[0]=0;
180 Outflow_boundary_id.resize(2);
181 Outflow_boundary_id[0]=1;
182 Outflow_boundary_id[1]=2;
188 std::map<unsigned,bool> done;
191 for (
unsigned in_out=0;in_out<2;in_out++)
194 unsigned n=nfluid_inflow_traction_boundary();
195 if (in_out==1) n=nfluid_outflow_traction_boundary();
196 for (
unsigned i=0;i<n;i++)
202 b=Inflow_boundary_id[i];
206 b=Outflow_boundary_id[i];
210 unsigned num_nod=Fluid_mesh_pt->nboundary_node(b);
211 for (
unsigned inod=0;inod<num_nod;inod++)
214 Node* nod_pt=Fluid_mesh_pt->boundary_node_pt(b,inod);
231 unsigned nbound=Fluid_mesh_pt->nboundary();
232 for(
unsigned b=0;b<nbound;b++)
238 unsigned num_nod=Fluid_mesh_pt->nboundary_node(b);
239 for (
unsigned inod=0;inod<num_nod;inod++)
242 Node* nod_pt= Fluid_mesh_pt->boundary_node_pt(b,inod);
256 unsigned n_element = Fluid_mesh_pt->nelement();
257 for(
unsigned e=0;e<n_element;e++)
261 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(Fluid_mesh_pt->element_pt(e));
273 unsigned n=nfluid_traction_boundary();
274 Fluid_traction_mesh_pt.resize(n);
275 for (
unsigned i=0;i<n;i++)
277 Fluid_traction_mesh_pt[i]=
new Mesh;
281 create_fluid_traction_elements();
290 add_sub_mesh(Fluid_mesh_pt);
293 n=nfluid_traction_boundary();
294 for (
unsigned i=0;i<n;i++)
296 add_sub_mesh(Fluid_traction_mesh_pt[i]);
303 std::cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
312 template<
class ELEMENT>
320 for (
unsigned in_out=0;in_out<2;in_out++)
323 unsigned n=nfluid_inflow_traction_boundary();
324 if (in_out==1) n=nfluid_outflow_traction_boundary();
325 for (
unsigned i=0;i<n;i++)
331 b=Inflow_boundary_id[i];
335 b=Outflow_boundary_id[i];
339 unsigned n_element = Fluid_mesh_pt->nboundary_element(b);
342 for(
unsigned e=0;e<n_element;e++)
345 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
346 Fluid_mesh_pt->boundary_element_pt(b,e));
349 int face_index = Fluid_mesh_pt->face_index_at_boundary(b,e);
352 NavierStokesTractionElement<ELEMENT>* el_pt=
353 new NavierStokesTractionElement<ELEMENT>(bulk_elem_pt,
357 Fluid_traction_mesh_pt[count]->add_element_pt(el_pt);
362 el_pt->traction_fct_pt() =
367 el_pt->traction_fct_pt() =
383 template<
class ELEMENT>
396 sprintf(filename,
"%s/fluid_soln%i.dat",doc_info.directory().c_str(),
398 some_file.open(filename);
399 Fluid_mesh_pt->output(some_file,npts);
411 int main(
int argc,
char **argv)
414 CommandLineArgs::setup(argc,argv);
420 double Re_increment=100.0;
422 if (CommandLineArgs::Argc==2)
424 std::cout <<
"Validation -- only doing two steps" << std::endl;
432 doc_info.set_directory(
"RESLT_TH");
442 for (
unsigned istep=0;istep<nstep;istep++)
445 problem.newton_solve();
466 doc_info.set_directory(
"RESLT_CR");
476 for (
unsigned istep=0;istep<nstep;istep++)
479 problem.newton_solve();
Unstructured fluid problem.
Vector< unsigned > Inflow_boundary_id
IDs of fluid mesh boundaries along which inflow boundary conditions are applied.
~UnstructuredFluidProblem()
Destructor (empty)
unsigned nfluid_inflow_traction_boundary()
Return total number of fluid inflow traction boundaries.
UnstructuredFluidProblem()
Constructor:
Vector< unsigned > Outflow_boundary_id
IDs of fluid mesh boundaries along which inflow boundary conditions are applied.
unsigned nfluid_outflow_traction_boundary()
Return total number of fluid outflow traction boundaries.
void doc_solution(DocInfo &doc_info)
Doc the solution.
Vector< Mesh * > Fluid_traction_mesh_pt
Meshes of fluid traction elements that apply pressure at in/outflow.
TetgenMesh< ELEMENT > * Fluid_mesh_pt
Bulk fluid mesh.
unsigned nfluid_traction_boundary()
Return total number of fluid outflow traction boundaries.
void create_fluid_traction_elements()
Create fluid traction elements at inflow.
/////////////////////////////////////////////////////////////// /////////////////////////////////////...
double P_in
Fluid pressure on inflow boundary.
void prescribed_outflow_traction(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Applied traction on fluid at the inflow boundary.
double Re
Default Reynolds number.
double P_out
Fluid pressure on outflow boundary.
void prescribed_inflow_traction(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Applied traction on fluid at the inflow boundary.
int main(int argc, char **argv)
Demonstrate how to solve an unstructured 3D fluids problem.