34 #include "navier_stokes.h" 38 #include "meshes/one_d_lagrangian_mesh.h" 41 #include "meshes/collapsible_channel_mesh.h" 45 using namespace oomph;
69 if (s<0.5*Fract_in_BL)
73 else if (s>1.0-0.5*Fract_in_BL)
75 y=2.0*Delta/Fract_in_BL*s+1.0-2.0*Delta/
Fract_in_BL;
79 y=(1.0-2.0*
Delta)/(1.0-Fract_in_BL)*s+
114 void position(
const Vector<double>& zeta, Vector<double>& r)
const 125 void position(
const unsigned& t,
const Vector<double>& zeta,
126 Vector<double>& r)
const 141 DenseMatrix<double> &drdzeta,
142 RankThreeTensor<double> &ddrdzeta)
const 190 const Vector<double>& x,
191 const Vector<double>& n,
192 Vector<double>& traction)
212 void load(
const Vector<double>& xi,
const Vector<double>& x,
213 const Vector<double>& N, Vector<double>&
load)
215 for(
unsigned i=0;i<2;i++)
217 load[i] = -P_ext*N[i];
235 template <
class ELEMENT>
244 const unsigned& ncollapsible,
245 const unsigned& ndown,
248 const double& lcollapsible,
255 #ifdef MACRO_ELEMENT_NODE_UPDATE 291 void actions_before_adapt();
295 void actions_after_adapt();
308 Bulk_mesh_pt->node_update();
312 void doc_solution(DocInfo& doc_info,ofstream& trace_file);
315 void set_initial_condition();
320 void create_traction_elements(
const unsigned &b,
321 Mesh*
const &bulk_mesh_pt,
322 Mesh*
const &traction_mesh_pt);
325 void delete_traction_elements(Mesh*
const &traction_mesh_pt);
332 unsigned Ncollapsible;
352 #ifdef MACRO_ELEMENT_NODE_UPDATE 366 Mesh* Applied_fluid_traction_mesh_pt;
388 template <
class ELEMENT>
391 const unsigned& ncollapsible,
392 const unsigned& ndown,
395 const double& lcollapsible,
401 Ncollapsible=ncollapsible;
405 Lcollapsible=lcollapsible;
411 Problem::Max_residuals=1000.0;
414 BDF<2>* fluid_time_stepper_pt=
new BDF<2>;
417 add_time_stepper_pt(fluid_time_stepper_pt);
420 Steady<2>* wall_time_stepper_pt =
new Steady<2>;
423 add_time_stepper_pt(wall_time_stepper_pt);
432 (Ncollapsible,Lcollapsible,undeformed_wall_pt,wall_time_stepper_pt);
436 MeshAsGeomObject* wall_geom_object_pt=
437 new MeshAsGeomObject(Wall_mesh_pt);
439 #ifdef MACRO_ELEMENT_NODE_UPDATE 444 (nup, ncollapsible, ndown, ny,
445 lup, lcollapsible, ldown, ly,
447 fluid_time_stepper_pt);
453 Bulk_mesh_pt->node_update();
460 (nup, ncollapsible, ndown, ny,
461 lup, lcollapsible, ldown, ly,
464 fluid_time_stepper_pt);
468 if (CommandLineArgs::Argc>1)
471 Bulk_mesh_pt->refine_uniformly();
477 Applied_fluid_traction_mesh_pt =
new Mesh;
481 create_traction_elements(5,Bulk_mesh_pt,Applied_fluid_traction_mesh_pt);
484 add_sub_mesh(Bulk_mesh_pt);
485 add_sub_mesh(Applied_fluid_traction_mesh_pt);
486 add_sub_mesh(Wall_mesh_pt);
492 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
493 bulk_mesh_pt()->spatial_error_estimator_pt()=error_estimator_pt;
501 unsigned n_element=Bulk_mesh_pt->nelement();
502 for(
unsigned e=0;e<n_element;e++)
505 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
517 RefineableNavierStokesEquations<2>::
518 pin_redundant_nodal_pressures(Bulk_mesh_pt->element_pt());
528 unsigned num_nod= bulk_mesh_pt()->nboundary_node(ibound);
529 for (
unsigned inod=0;inod<num_nod;inod++)
531 for(
unsigned i=0;i<2;i++)
533 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(i);
538 for(ibound=2;ibound<5;ibound++)
540 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
541 for (
unsigned inod=0;inod<num_nod;inod++)
543 for(
unsigned i=0;i<2;i++)
545 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(i);
552 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
553 for (
unsigned inod=0;inod<num_nod;inod++)
555 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(1);
561 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
562 for (
unsigned inod=0;inod<num_nod;inod++)
565 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(1);
576 unsigned n_el=Applied_fluid_traction_mesh_pt->nelement();
577 for(
unsigned e=0;e<n_el;e++)
580 NavierStokesTractionElement<ELEMENT> *el_pt =
581 dynamic_cast< NavierStokesTractionElement<ELEMENT>*
>(
582 Applied_fluid_traction_mesh_pt->element_pt(e));
596 n_element = wall_mesh_pt()->nelement();
597 for(
unsigned e=0;e<n_element;e++)
600 FSIHermiteBeamElement *elem_pt =
601 dynamic_cast<FSIHermiteBeamElement*
>(wall_mesh_pt()->element_pt(e));
614 elem_pt->undeformed_beam_pt() = undeformed_wall_pt;
619 elem_pt->set_normal_pointing_out_of_fluid();
630 for(
unsigned b=0;b<2;b++)
633 wall_mesh_pt()->boundary_node_pt(b,0)->pin_position(0);
634 wall_mesh_pt()->boundary_node_pt(b,0)->pin_position(1);
644 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
645 unsigned control_nod=num_nod/2;
646 Left_node_pt= bulk_mesh_pt()->boundary_node_pt(ibound, control_nod);
650 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
651 control_nod=num_nod/2;
652 Right_node_pt= bulk_mesh_pt()->boundary_node_pt(ibound, control_nod);
656 num_nod= wall_mesh_pt()->nnode();
657 Wall_node_pt=wall_mesh_pt()->node_pt(Ncollapsible/2);
669 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
670 for (
unsigned inod=0;inod<num_nod;inod++)
672 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->
673 set_auxiliary_node_update_fct_pt(
674 FSI_functions::apply_no_slip_on_moving_wall);
683 FSI_functions::setup_fluid_load_info_for_solid_elements<ELEMENT,2>
684 (
this,3,Bulk_mesh_pt,Wall_mesh_pt);
687 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
698 template <
class ELEMENT>
700 ofstream& trace_file)
703 #ifdef MACRO_ELEMENT_NODE_UPDATE 706 if (CommandLineArgs::Argc>1)
708 FSI_functions::doc_fsi<MacroElementNodeUpdateNode>
709 (Bulk_mesh_pt,Wall_mesh_pt,doc_info);
715 if (CommandLineArgs::Argc>1)
717 FSI_functions::doc_fsi<AlgebraicNode>(Bulk_mesh_pt,Wall_mesh_pt,doc_info);
730 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
732 some_file.open(filename);
733 bulk_mesh_pt()->output(some_file,npts);
737 sprintf(filename,
"%s/beam%i.dat",doc_info.directory().c_str(),
739 some_file.open(filename);
740 wall_mesh_pt()->output(some_file,npts);
746 unsigned nsteps=time_stepper_pt(1)->nprev_values();
747 for (
unsigned t=0;t<=nsteps;t++)
749 sprintf(filename,
"%s/wall%i-%i.dat",doc_info.directory().c_str(),
750 doc_info.number(),t);
751 some_file.open(filename);
752 unsigned n_elem=wall_mesh_pt()->nelement();
753 for (
unsigned ielem=0;ielem<n_elem;ielem++)
755 dynamic_cast<FSIHermiteBeamElement*
>(wall_mesh_pt()->element_pt(ielem))->
756 output(t,some_file,npts);
764 trace_file << time_pt()->time() <<
" " 765 << Wall_node_pt->x(1) <<
" " 766 << Left_node_pt->value(0) <<
" " 767 << Right_node_pt->value(0) <<
" " 780 template <
class ELEMENT>
782 const unsigned &b, Mesh*
const &bulk_mesh_pt, Mesh*
const &traction_mesh_pt)
786 unsigned n_element = bulk_mesh_pt->nboundary_element(b);
789 for(
unsigned e=0;e<n_element;e++)
792 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
> 793 (bulk_mesh_pt->boundary_element_pt(b,e));
796 int face_index = bulk_mesh_pt->face_index_at_boundary(b,e);
799 NavierStokesTractionElement<ELEMENT>* flux_element_pt =
800 new NavierStokesTractionElement<ELEMENT>(bulk_elem_pt,face_index);
803 traction_mesh_pt->add_element_pt(flux_element_pt);
814 template<
class ELEMENT>
819 unsigned n_element = surface_mesh_pt->nelement();
822 for(
unsigned e=0;e<n_element;e++)
825 delete surface_mesh_pt->element_pt(e);
829 surface_mesh_pt->flush_element_and_node_storage();
838 template <
class ELEMENT>
842 if (time_stepper_pt()->type()!=
"BDF")
844 std::ostringstream error_stream;
845 error_stream <<
"Timestepper has to be from the BDF family!\n" 846 <<
"You have specified a timestepper from the " 847 << time_stepper_pt()->type() <<
" family" << std::endl;
849 throw OomphLibError(error_stream.str(),
850 OOMPH_CURRENT_FUNCTION,
851 OOMPH_EXCEPTION_LOCATION);
855 bulk_mesh_pt()->node_update();
858 unsigned num_nod = bulk_mesh_pt()->nnode();
859 for (
unsigned n=0;n<num_nod;n++)
863 x[0]=bulk_mesh_pt()->node_pt(n)->x(0);
864 x[1]=bulk_mesh_pt()->node_pt(n)->x(1);
867 bulk_mesh_pt()->node_pt(n)->set_value(0,6.0*(x[1]/Ly)*(1.0-(x[1]/Ly)));
868 bulk_mesh_pt()->node_pt(n)->set_value(1,0.0);
872 bulk_mesh_pt()->assign_initial_values_impulsive();
873 wall_mesh_pt()->assign_initial_values_impulsive();
884 template<
class ELEMENT>
888 delete_traction_elements(Applied_fluid_traction_mesh_pt);
891 rebuild_global_mesh();
900 template<
class ELEMENT>
905 create_traction_elements(5,Bulk_mesh_pt,Applied_fluid_traction_mesh_pt);
908 rebuild_global_mesh();
911 RefineableNavierStokesEquations<2>::
912 unpin_all_pressure_dofs(Bulk_mesh_pt->element_pt());
915 RefineableNavierStokesEquations<2>::
916 pin_redundant_nodal_pressures(Bulk_mesh_pt->element_pt());
920 unsigned n_element=Applied_fluid_traction_mesh_pt->nelement();
921 for(
unsigned e=0;e<n_element;e++)
924 NavierStokesTractionElement<ELEMENT> *el_pt =
925 dynamic_cast<NavierStokesTractionElement<ELEMENT>*
>(
926 Applied_fluid_traction_mesh_pt->element_pt(e));
946 unsigned num_nod= bulk_mesh_pt()->nboundary_node(ibound);
947 for (
unsigned inod=0;inod<num_nod;inod++)
949 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->
950 set_auxiliary_node_update_fct_pt(
951 FSI_functions::apply_no_slip_on_moving_wall);
962 FSI_functions::setup_fluid_load_info_for_solid_elements<ELEMENT,2>
963 (
this,3,Bulk_mesh_pt,Wall_mesh_pt);
975 int main(
int argc,
char* argv[])
979 CommandLineArgs::setup(argc,argv);
982 unsigned coarsening_factor=4;
983 if (CommandLineArgs::Argc>1)
989 unsigned nup=20/coarsening_factor;
990 unsigned ncollapsible=40/coarsening_factor;
991 unsigned ndown=40/coarsening_factor;
992 unsigned ny=16/coarsening_factor;
996 double lcollapsible=10.0;
1008 #ifdef MACRO_ELEMENT_NODE_UPDATE 1014 <MacroElementNodeUpdateElement<RefineableQTaylorHoodElement<2> > >
1015 problem(nup, ncollapsible, ndown, ny,
1016 lup, lcollapsible, ldown, ly);
1022 <MacroElementNodeUpdateElement<RefineableQCrouzeixRaviartElement<2> > >
1023 problem(nup, ncollapsible, ndown, ny,
1024 lup, lcollapsible, ldown, ly);
1034 <AlgebraicElement<RefineableQTaylorHoodElement<2> > >
1035 problem(nup, ncollapsible, ndown, ny,
1036 lup, lcollapsible, ldown, ly);
1042 <AlgebraicElement<RefineableQCrouzeixRaviartElement<2> > >
1043 problem(nup, ncollapsible, ndown, ny,
1044 lup, lcollapsible, ldown, ly);
1062 problem.time_pt()->time()=t_min;
1063 problem.initialise_dt(dt);
1066 problem.set_initial_condition();
1070 doc_info.set_directory(
"RESLT");
1073 ofstream trace_file;
1075 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
1076 trace_file.open(filename);
1079 problem.doc_solution(doc_info, trace_file);
1082 doc_info.number()++;
1085 unsigned nstep = unsigned((t_max-t_min)/dt);
1086 if (CommandLineArgs::Argc>1)
1093 problem.bulk_mesh_pt()->max_permitted_error()=1.0e-3;
1094 problem.bulk_mesh_pt()->min_permitted_error()=1.0e-5;
1097 if (CommandLineArgs::Argc>1)
1100 problem.bulk_mesh_pt()->max_permitted_error()=0.5e-2;
1101 problem.bulk_mesh_pt()->min_permitted_error()=0.5e-4;
1106 unsigned max_adapt=3;
1110 for (
unsigned istep=0;istep<nstep;istep++)
1113 problem.unsteady_newton_solve(dt,max_adapt,first);
1116 problem.doc_solution(doc_info, trace_file);
1119 doc_info.number()++;
void actions_before_newton_convergence_check()
Update before checking Newton convergence: Update the nodal positions in the fluid mesh in response t...
OneDLagrangianMesh< FSIHermiteBeamElement > * wall_mesh_pt()
Access function for the wall mesh.
void actions_before_newton_solve()
Update the problem specs before solve (empty)
~FSICollapsibleChannelProblem()
Destructor (empty)
RefineableAlgebraicCollapsibleChannelMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the "bulk" mesh.
void set_initial_condition()
Apply initial conditions.
MacroElementNodeUpdateRefineableCollapsibleChannelMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the "bulk" mesh.
void load(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Load function: Apply a constant external pressure to the wall. Note: This is the load without the flu...
double Sigma0
2nd Piola Kirchhoff pre-stress. As in Jensen & Heil (2003) paper.
double Q
Fluid structure interaction parameter: Ratio of stresses used for non-dimensionalisation of fluid to ...
double P_up
Default pressure on the left boundary.
double ReSt
Womersley = Reynolds times Strouhal.
void doc_solution(DocInfo &doc_info, ofstream &trace_file)
Doc the solution.
FSICollapsibleChannelProblem(const unsigned &nup, const unsigned &ncollapsible, const unsigned &ndown, const unsigned &ny, const double &lup, const double &lcollapsible, const double &ldown, const double &ly)
Constructor: The arguments are the number of elements and the lengths of the domain.
double Delta
Boundary layer width.
double Re
Reynolds number.
void actions_after_newton_solve()
Update the problem after solve (empty)
int main(int argc, char *argv[])
void actions_before_adapt()
Actions before adapt: Wipe the mesh of prescribed traction elements.
double Fract_in_BL
Fraction of points in boundary layer.
RefineableAlgebraicCollapsibleChannelMesh< ELEMENT > * bulk_mesh_pt()
Access function for the specific bulk (fluid) mesh.
void create_traction_elements(const unsigned &b, Mesh *const &bulk_mesh_pt, Mesh *const &traction_mesh_pt)
Create the prescribed traction elements on boundary b.
void prescribed_traction(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Traction applied on the fluid at the left (inflow) boundary.
Namespace for phyical parameters.
double H
Non-dimensional wall thickness. As in Jensen & Heil (2003) paper.
virtual CollapsibleChannelDomain::BLSquashFctPt & bl_squash_fct_pt()
Function pointer for function that squashes the mesh near the walls. Default trivial mapping (the ide...
double squash_fct(const double &s)
Mapping [0,1] -> [0,1] that re-distributes nodal points across the channel width. ...
double P_ext
External pressure.
void delete_traction_elements(Mesh *const &traction_mesh_pt)
Delete prescribed traction elements from the surface mesh.
void actions_after_adapt()
Actions after adapt: Rebuild the mesh of prescribed traction elements.
MacroElementNodeUpdateRefineableCollapsibleChannelMesh< ELEMENT > * bulk_mesh_pt()
Access function for the specific bulk (fluid) mesh.