32 #include "constitutive.h" 33 #include "navier_stokes.h" 34 #include "meshes/tetgen_mesh.h" 38 using namespace oomph;
71 template<
class ELEMENT>
90 void doc_solution(DocInfo& doc_info);
95 return Inflow_boundary_id.size();
101 return Outflow_boundary_id.size();
107 return Inflow_boundary_id.size()+Outflow_boundary_id.size();
113 void create_parallel_outflow_lagrange_elements();
137 template<
class ELEMENT>
142 string node_file_name=
"fluid_iliac.1.node";
143 string element_file_name=
"fluid_iliac.1.ele";
144 string face_file_name=
"fluid_iliac.1.face";
145 bool split_corner_elements=
true;
147 Fluid_mesh_pt =
new TetgenMesh<ELEMENT>(node_file_name,
150 split_corner_elements);
153 Fluid_mesh_pt->setup_boundary_element_info();
159 Inflow_boundary_id.resize(22);
160 for(
unsigned i=0; i<22; i++)
162 Inflow_boundary_id[i]=215+i;
166 Outflow_boundary_id.resize(11);
167 for(
unsigned i=0; i<11; i++)
170 Outflow_boundary_id[i]=237+i;
179 unsigned n=nfluid_traction_boundary();
180 Parallel_outflow_lagrange_multiplier_mesh_pt.resize(n);
181 for (
unsigned i=0;i<n;i++)
183 Parallel_outflow_lagrange_multiplier_mesh_pt[i]=
new Mesh;
187 create_parallel_outflow_lagrange_elements();
196 add_sub_mesh(Fluid_mesh_pt);
199 n=nfluid_traction_boundary();
200 for (
unsigned i=0;i<n;i++)
202 add_sub_mesh(Parallel_outflow_lagrange_multiplier_mesh_pt[i]);
211 unsigned nbound=Fluid_mesh_pt->nboundary();
214 std::vector<bool> pin_velocity(nbound,
true);
217 for (
unsigned in_out=0;in_out<2;in_out++)
220 n=nfluid_inflow_traction_boundary();
221 if (in_out==1) n=nfluid_outflow_traction_boundary();
222 for (
unsigned i=0;i<n;i++)
228 b=Inflow_boundary_id[i];
232 b=Outflow_boundary_id[i];
235 pin_velocity[b]=
false;
242 for(
unsigned b=0;b<nbound;b++)
246 unsigned num_nod=Fluid_mesh_pt->nboundary_node(b);
247 for (
unsigned inod=0;inod<num_nod;inod++)
249 Node* nod_pt=Fluid_mesh_pt->boundary_node_pt(b,inod);
258 bool is_in_or_outflow_node=
false;
259 for (
unsigned in_out=0;in_out<2;in_out++)
262 n=nfluid_inflow_traction_boundary();
263 if (in_out==1) n=nfluid_outflow_traction_boundary();
264 for (
unsigned i=0;i<n;i++)
270 bb=Inflow_boundary_id[i];
274 bb=Outflow_boundary_id[i];
277 if(nod_pt->is_on_boundary(bb))
279 is_in_or_outflow_node=
true;
286 if(is_in_or_outflow_node)
289 BoundaryNodeBase *bnod_pt =
290 dynamic_cast<BoundaryNodeBase*
> 291 (Fluid_mesh_pt->boundary_node_pt(b,inod) );
295 unsigned first_index=bnod_pt->index_of_first_value_assigned_by_face_element();
299 for (
unsigned l=0;l<2;l++)
301 nod_pt->pin(first_index+l);
310 unsigned n_element = Fluid_mesh_pt->nelement();
311 for(
unsigned e=0;e<n_element;e++)
315 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(Fluid_mesh_pt->element_pt(e));
323 std::cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
331 template<
class ELEMENT>
339 for (
unsigned in_out=0;in_out<2;in_out++)
342 unsigned n=nfluid_inflow_traction_boundary();
343 if (in_out==1) n=nfluid_outflow_traction_boundary();
344 for (
unsigned i=0;i<n;i++)
350 b=Inflow_boundary_id[i];
354 b=Outflow_boundary_id[i];
358 unsigned n_element = Fluid_mesh_pt->nboundary_element(b);
361 for(
unsigned e=0;e<n_element;e++)
364 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
365 Fluid_mesh_pt->boundary_element_pt(b,e));
368 int face_index = Fluid_mesh_pt->face_index_at_boundary(b,e);
371 ImposeParallelOutflowElement<ELEMENT>* el_pt =
new 372 ImposeParallelOutflowElement<ELEMENT>(bulk_elem_pt,face_index);
375 Parallel_outflow_lagrange_multiplier_mesh_pt[count]->
376 add_element_pt(el_pt);
399 template<
class ELEMENT>
412 sprintf(filename,
"%s/fluid_soln%i.dat",doc_info.directory().c_str(),
414 some_file.open(filename);
415 Fluid_mesh_pt->output(some_file,npts);
427 int main(
int argc,
char **argv)
430 CommandLineArgs::setup(argc,argv);
436 doc_info.set_directory(
"RESLT");
446 double Re_increment=100.0;
450 for (
unsigned istep=0;istep<nstep;istep++)
453 problem.newton_solve();
Unstructured fluid problem.
void create_parallel_outflow_lagrange_elements()
Create Lagrange multiplier elements that enforce parallel outflow.
UnstructuredFluidProblem()
Constructor:
double P_in
Fluid pressure on inflow boundary.
int main(int argc, char **argv)
Demonstrate how to solve an unstructured 3D fluids problem.
TetgenMesh< ELEMENT > * Fluid_mesh_pt
Bulk fluid mesh.
Vector< unsigned > Outflow_boundary_id
IDs of fluid mesh boundaries along which inflow boundary conditions are applied.
~UnstructuredFluidProblem()
Destructor (empty)
void actions_after_newton_solve()
Update the problem specs before solve: empty.
unsigned nfluid_traction_boundary()
Return total number of fluid outflow traction boundaries.
double P_out
Fluid pressure on outflow boundary.
unsigned nfluid_inflow_traction_boundary()
Return total number of fluid inflow traction boundaries.
void doc_solution(DocInfo &doc_info)
Doc the solution.
unsigned nfluid_outflow_traction_boundary()
Return total number of fluid outflow traction boundaries.
void actions_before_newton_solve()
Update the problem specs before solve: empty.
double Re
Default Reynolds number.
Vector< Mesh * > Parallel_outflow_lagrange_multiplier_mesh_pt
Meshes of FaceElements imposing parallel outflow and a pressure at the in/outflow.
Vector< unsigned > Inflow_boundary_id
IDs of fluid mesh boundaries along which inflow boundary conditions are applied.