28 #include "constitutive.h"
29 #include "navier_stokes.h"
30 #include "meshes/tetgen_mesh.h"
34 using namespace oomph;
67 template<
class ELEMENT>
86 void doc_solution(DocInfo& doc_info);
91 return Inflow_boundary_id.size();
97 return Outflow_boundary_id.size();
103 return Inflow_boundary_id.size()+Outflow_boundary_id.size();
109 void create_parallel_outflow_lagrange_elements();
133 template<
class ELEMENT>
138 string node_file_name=
"fluid_iliac.1.node";
139 string element_file_name=
"fluid_iliac.1.ele";
140 string face_file_name=
"fluid_iliac.1.face";
141 bool split_corner_elements=
true;
143 Fluid_mesh_pt =
new TetgenMesh<ELEMENT>(node_file_name,
146 split_corner_elements);
149 Fluid_mesh_pt->setup_boundary_element_info();
155 Inflow_boundary_id.resize(22);
156 for(
unsigned i=0; i<22; i++)
158 Inflow_boundary_id[i]=215+i;
162 Outflow_boundary_id.resize(11);
163 for(
unsigned i=0; i<11; i++)
166 Outflow_boundary_id[i]=237+i;
175 unsigned n=nfluid_traction_boundary();
176 Parallel_outflow_lagrange_multiplier_mesh_pt.resize(n);
177 for (
unsigned i=0;i<n;i++)
179 Parallel_outflow_lagrange_multiplier_mesh_pt[i]=
new Mesh;
183 create_parallel_outflow_lagrange_elements();
192 add_sub_mesh(Fluid_mesh_pt);
195 n=nfluid_traction_boundary();
196 for (
unsigned i=0;i<n;i++)
198 add_sub_mesh(Parallel_outflow_lagrange_multiplier_mesh_pt[i]);
207 unsigned nbound=Fluid_mesh_pt->nboundary();
210 std::vector<bool> pin_velocity(nbound,
true);
213 for (
unsigned in_out=0;in_out<2;in_out++)
216 n=nfluid_inflow_traction_boundary();
217 if (in_out==1) n=nfluid_outflow_traction_boundary();
218 for (
unsigned i=0;i<n;i++)
224 b=Inflow_boundary_id[i];
228 b=Outflow_boundary_id[i];
231 pin_velocity[b]=
false;
238 for(
unsigned b=0;b<nbound;b++)
242 unsigned num_nod=Fluid_mesh_pt->nboundary_node(b);
243 for (
unsigned inod=0;inod<num_nod;inod++)
245 Node* nod_pt=Fluid_mesh_pt->boundary_node_pt(b,inod);
254 bool is_in_or_outflow_node=
false;
255 for (
unsigned in_out=0;in_out<2;in_out++)
258 n=nfluid_inflow_traction_boundary();
259 if (in_out==1) n=nfluid_outflow_traction_boundary();
260 for (
unsigned i=0;i<n;i++)
266 bb=Inflow_boundary_id[i];
270 bb=Outflow_boundary_id[i];
273 if(nod_pt->is_on_boundary(bb))
275 is_in_or_outflow_node=
true;
282 if(is_in_or_outflow_node)
285 BoundaryNodeBase *bnod_pt =
286 dynamic_cast<BoundaryNodeBase*
>
287 (Fluid_mesh_pt->boundary_node_pt(b,inod) );
291 unsigned first_index=bnod_pt->index_of_first_value_assigned_by_face_element();
295 for (
unsigned l=0;l<2;l++)
297 nod_pt->pin(first_index+l);
306 unsigned n_element = Fluid_mesh_pt->nelement();
307 for(
unsigned e=0;e<n_element;e++)
311 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(Fluid_mesh_pt->element_pt(e));
319 std::cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
327 template<
class ELEMENT>
335 for (
unsigned in_out=0;in_out<2;in_out++)
338 unsigned n=nfluid_inflow_traction_boundary();
339 if (in_out==1) n=nfluid_outflow_traction_boundary();
340 for (
unsigned i=0;i<n;i++)
346 b=Inflow_boundary_id[i];
350 b=Outflow_boundary_id[i];
354 unsigned n_element = Fluid_mesh_pt->nboundary_element(b);
357 for(
unsigned e=0;e<n_element;e++)
360 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
361 Fluid_mesh_pt->boundary_element_pt(b,e));
364 int face_index = Fluid_mesh_pt->face_index_at_boundary(b,e);
367 ImposeParallelOutflowElement<ELEMENT>* el_pt =
new
368 ImposeParallelOutflowElement<ELEMENT>(bulk_elem_pt,face_index);
371 Parallel_outflow_lagrange_multiplier_mesh_pt[count]->
372 add_element_pt(el_pt);
395 template<
class ELEMENT>
408 sprintf(filename,
"%s/fluid_soln%i.dat",doc_info.directory().c_str(),
410 some_file.open(filename);
411 Fluid_mesh_pt->output(some_file,npts);
423 int main(
int argc,
char **argv)
426 CommandLineArgs::setup(argc,argv);
432 doc_info.set_directory(
"RESLT");
442 double Re_increment=100.0;
446 for (
unsigned istep=0;istep<nstep;istep++)
449 problem.newton_solve();
Unstructured fluid problem.
Vector< unsigned > Inflow_boundary_id
IDs of fluid mesh boundaries along which inflow boundary conditions are applied.
void actions_before_newton_solve()
Update the problem specs before solve: empty.
~UnstructuredFluidProblem()
Destructor (empty)
Vector< Mesh * > Parallel_outflow_lagrange_multiplier_mesh_pt
Meshes of FaceElements imposing parallel outflow and a pressure at the in/outflow.
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.
TetgenMesh< ELEMENT > * Fluid_mesh_pt
Bulk fluid mesh.
unsigned nfluid_traction_boundary()
Return total number of fluid outflow traction boundaries.
void create_parallel_outflow_lagrange_elements()
Create Lagrange multiplier elements that enforce parallel outflow.
void actions_after_newton_solve()
Update the problem specs before solve: empty.
/////////////////////////////////////////////////////////////// /////////////////////////////////////...
double P_in
Fluid pressure on inflow boundary.
double Re
Default Reynolds number.
double P_out
Fluid pressure on outflow boundary.
int main(int argc, char **argv)
Demonstrate how to solve an unstructured 3D fluids problem.