29 #include "navier_stokes.h"
32 #include "constitutive.h"
35 #include "meshes/one_d_lagrangian_mesh.h"
38 #include "meshes/collapsible_channel_mesh.h"
42 using namespace oomph;
48 template <
class ELEMENT>
50 public virtual CollapsibleChannelMesh<ELEMENT>,
51 public virtual SolidMesh
60 const unsigned& ncollapsible,
61 const unsigned& ndown,
64 const double& lcollapsible,
68 TimeStepper* time_stepper_pt=
69 &Mesh::Default_TimeStepper) :
70 CollapsibleChannelMesh<ELEMENT>(nup, ncollapsible, ndown, ny,
71 lup, lcollapsible, ldown, ly,
78 set_lagrangian_nodal_coordinates();
150 void position(
const Vector<double>& zeta, Vector<double>& r)
const
161 void position(
const unsigned& t,
const Vector<double>& zeta,
162 Vector<double>& r)
const
177 DenseMatrix<double> &drdzeta,
178 RankThreeTensor<double> &ddrdzeta)
const
232 const Vector<double>& x,
233 const Vector<double>& n,
234 Vector<double>& traction)
254 void load(
const Vector<double>& xi,
const Vector<double>& x,
255 const Vector<double>& N, Vector<double>&
load)
257 for(
unsigned i=0;i<2;i++)
277 template <
class ELEMENT>
286 const unsigned& ncollapsible,
287 const unsigned& ndown,
290 const double& lcollapsible,
328 unsigned num_nod=bulk_mesh_pt()->nboundary_node(ibound);
329 for (
unsigned inod=0;inod<num_nod;inod++)
332 Node* node_pt=bulk_mesh_pt()->boundary_node_pt(ibound,inod);
335 FSI_functions::apply_no_slip_on_moving_wall(node_pt);
350 Mesh*
const &bulk_mesh_pt,
351 Mesh*
const &traction_mesh_pt);
358 void create_lagrange_multiplier_elements();
362 void delete_lagrange_multiplier_elements();
369 unsigned Ncollapsible;
394 Mesh* Applied_fluid_traction_mesh_pt;
400 OneDLagrangianMesh<FSIHermiteBeamElement>* Wall_mesh_pt;
426 template <
class ELEMENT>
429 const unsigned& ncollapsible,
430 const unsigned& ndown,
433 const double& lcollapsible,
439 Ncollapsible=ncollapsible;
443 Lcollapsible=lcollapsible;
449 Problem::Max_residuals=1000.0;
452 BDF<2>* fluid_time_stepper_pt=
new BDF<2>;
455 add_time_stepper_pt(fluid_time_stepper_pt);
458 Steady<2>* wall_time_stepper_pt =
new Steady<2>;
461 add_time_stepper_pt(wall_time_stepper_pt);
469 Wall_mesh_pt =
new OneDLagrangianMesh<FSIHermiteBeamElement>
470 (Ncollapsible,Lcollapsible,undeformed_wall_pt,wall_time_stepper_pt);
475 new MeshAsGeomObject(Wall_mesh_pt);
482 (nup, ncollapsible, ndown, ny,
483 lup, lcollapsible, ldown, ly,
485 fluid_time_stepper_pt);
491 bool update_all_solid_nodes=
true;
492 Bulk_mesh_pt->node_update(update_all_solid_nodes);
493 Bulk_mesh_pt->set_lagrangian_nodal_coordinates();
498 Applied_fluid_traction_mesh_pt =
new Mesh;
502 create_traction_elements(5,Bulk_mesh_pt,Applied_fluid_traction_mesh_pt);
506 Lagrange_multiplier_mesh_pt=
new SolidMesh;
507 create_lagrange_multiplier_elements();
510 add_sub_mesh(Bulk_mesh_pt);
511 add_sub_mesh(Applied_fluid_traction_mesh_pt);
512 add_sub_mesh(Wall_mesh_pt);
513 add_sub_mesh(Lagrange_multiplier_mesh_pt);
526 unsigned n_element=Bulk_mesh_pt->nelement();
527 for(
unsigned e=0;e<n_element;e++)
531 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
540 el_pt->constitutive_law_pt() = Constitutive_law_pt;
555 unsigned num_nod= bulk_mesh_pt()->nboundary_node(ibound);
556 for (
unsigned inod=0;inod<num_nod;inod++)
558 for(
unsigned i=0;i<2;i++)
560 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(i);
565 for(ibound=2;ibound<5;ibound++)
567 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
568 for (
unsigned inod=0;inod<num_nod;inod++)
570 for(
unsigned i=0;i<2;i++)
572 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(i);
579 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
580 for (
unsigned inod=0;inod<num_nod;inod++)
582 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(1);
588 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
589 for (
unsigned inod=0;inod<num_nod;inod++)
592 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->pin(1);
598 for (
unsigned ibound=0;ibound<6;ibound++)
602 unsigned num_nod= bulk_mesh_pt()->nboundary_node(ibound);
603 for (
unsigned inod=0;inod<num_nod;inod++)
605 for(
unsigned i=0;i<2;i++)
607 dynamic_cast<SolidNode*
>(bulk_mesh_pt()->
608 boundary_node_pt(ibound, inod))
616 unsigned nnod=bulk_mesh_pt()->nnode();
617 for (
unsigned j=0;j<nnod;j++)
619 SolidNode* nod_pt=
dynamic_cast<SolidNode*
>(bulk_mesh_pt()->node_pt(j));
620 if ((nod_pt->x(0)<=lup)||(nod_pt->x(0)>=(lup+lcollapsible)))
622 for(
unsigned i=0;i<2;i++)
624 nod_pt->pin_position(i);
635 unsigned n_el=Applied_fluid_traction_mesh_pt->nelement();
636 for(
unsigned e=0;e<n_el;e++)
639 NavierStokesTractionElement<ELEMENT> *el_pt =
640 dynamic_cast< NavierStokesTractionElement<ELEMENT>*
>(
641 Applied_fluid_traction_mesh_pt->element_pt(e));
655 n_element = wall_mesh_pt()->nelement();
656 for(
unsigned e=0;e<n_element;e++)
659 FSIHermiteBeamElement *elem_pt =
660 dynamic_cast<FSIHermiteBeamElement*
>(wall_mesh_pt()->element_pt(e));
673 elem_pt->undeformed_beam_pt() = undeformed_wall_pt;
678 elem_pt->set_normal_pointing_out_of_fluid();
689 for(
unsigned b=0;b<2;b++)
692 wall_mesh_pt()->boundary_node_pt(b,0)->pin_position(0);
693 wall_mesh_pt()->boundary_node_pt(b,0)->pin_position(1);
703 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
704 unsigned control_nod=num_nod/2;
705 Left_node_pt= bulk_mesh_pt()->boundary_node_pt(ibound, control_nod);
709 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
710 control_nod=num_nod/2;
711 Right_node_pt= bulk_mesh_pt()->boundary_node_pt(ibound, control_nod);
715 num_nod= wall_mesh_pt()->nnode();
716 Wall_node_pt=wall_mesh_pt()->node_pt(Ncollapsible/2);
729 num_nod= bulk_mesh_pt()->nboundary_node(ibound);
730 for (
unsigned inod=0;inod<num_nod;inod++)
732 bulk_mesh_pt()->boundary_node_pt(ibound, inod)->
733 set_auxiliary_node_update_fct_pt(
734 FSI_functions::apply_no_slip_on_moving_wall);
741 FSI_functions::setup_fluid_load_info_for_solid_elements<ELEMENT,2>
742 (
this,3,Bulk_mesh_pt,Wall_mesh_pt);
745 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
756 template <
class ELEMENT>
758 ofstream& trace_file)
768 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
770 some_file.open(filename);
771 bulk_mesh_pt()->output(some_file,npts);
775 sprintf(filename,
"%s/beam%i.dat",doc_info.directory().c_str(),
777 some_file.open(filename);
778 wall_mesh_pt()->output(some_file,npts);
784 unsigned nsteps=time_stepper_pt(1)->nprev_values();
785 for (
unsigned t=0;t<=nsteps;t++)
787 sprintf(filename,
"%s/wall%i-%i.dat",doc_info.directory().c_str(),
788 doc_info.number(),t);
789 some_file.open(filename);
790 unsigned n_elem=wall_mesh_pt()->nelement();
791 for (
unsigned ielem=0;ielem<n_elem;ielem++)
793 dynamic_cast<FSIHermiteBeamElement*
>(wall_mesh_pt()->element_pt(ielem))->
794 output(t,some_file,npts);
802 trace_file << time_pt()->time() <<
" "
803 << Wall_node_pt->x(1) <<
" "
804 << Left_node_pt->value(0) <<
" "
805 << Right_node_pt->value(0) <<
" "
818 template <
class ELEMENT>
820 const unsigned &b, Mesh*
const &bulk_mesh_pt, Mesh*
const &traction_mesh_pt)
824 unsigned n_element = bulk_mesh_pt->nboundary_element(b);
827 for(
unsigned e=0;e<n_element;e++)
830 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>
831 (bulk_mesh_pt->boundary_element_pt(b,e));
834 int face_index = bulk_mesh_pt->face_index_at_boundary(b,e);
837 NavierStokesTractionElement<ELEMENT>* flux_element_pt =
838 new NavierStokesTractionElement<ELEMENT>(bulk_elem_pt,face_index);
841 traction_mesh_pt->add_element_pt(flux_element_pt);
852 template<
class ELEMENT>
857 unsigned n_element = surface_mesh_pt->nelement();
860 for(
unsigned e=0;e<n_element;e++)
863 delete surface_mesh_pt->element_pt(e);
867 surface_mesh_pt->flush_element_and_node_storage();
875 template<
class ELEMENT>
883 unsigned n_element = bulk_mesh_pt()->nboundary_element(b);
886 for(
unsigned e=0;e<n_element;e++)
889 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
890 bulk_mesh_pt()->boundary_element_pt(b,e));
893 int face_index = bulk_mesh_pt()->face_index_at_boundary(b,e);
896 Lagrange_multiplier_mesh_pt->add_element_pt(
897 new ImposeDisplacementByLagrangeMultiplierElement<ELEMENT>(
898 bulk_elem_pt,face_index));
904 n_element=Lagrange_multiplier_mesh_pt->nelement();
905 for(
unsigned i=0;i<n_element;i++)
908 ImposeDisplacementByLagrangeMultiplierElement<ELEMENT> *el_pt =
909 dynamic_cast<ImposeDisplacementByLagrangeMultiplierElement<ELEMENT>*
>
910 (Lagrange_multiplier_mesh_pt->element_pt(i));
915 el_pt->set_boundary_shape_geom_object_pt(Wall_geom_object_pt,b);
918 unsigned nnod=el_pt->nnode();
919 for (
unsigned j=0;j<nnod;j++)
921 Node* nod_pt = el_pt->node_pt(j);
924 if ((nod_pt->is_on_boundary(2))||(nod_pt->is_on_boundary(4)))
928 unsigned n_bulk_value=el_pt->nbulk_value(j);
931 unsigned nval=nod_pt->nvalue();
932 for (
unsigned j=n_bulk_value;j<nval;j++)
949 template<
class ELEMENT>
954 unsigned n_element = Lagrange_multiplier_mesh_pt->nelement();
957 for(
unsigned e=0;e<n_element;e++)
960 delete Lagrange_multiplier_mesh_pt->element_pt(e);
964 Lagrange_multiplier_mesh_pt->flush_element_and_node_storage();
973 template <
class ELEMENT>
977 if (time_stepper_pt()->type()!=
"BDF")
979 std::ostringstream error_stream;
980 error_stream <<
"Timestepper has to be from the BDF family!\n"
981 <<
"You have specified a timestepper from the "
982 << time_stepper_pt()->type() <<
" family" << std::endl;
984 throw OomphLibError(error_stream.str(),
985 OOMPH_CURRENT_FUNCTION,
986 OOMPH_EXCEPTION_LOCATION);
990 unsigned num_nod = bulk_mesh_pt()->nnode();
991 for (
unsigned n=0;n<num_nod;n++)
995 x[0]=bulk_mesh_pt()->node_pt(n)->x(0);
996 x[1]=bulk_mesh_pt()->node_pt(n)->x(1);
999 bulk_mesh_pt()->node_pt(n)->set_value(0,6.0*(x[1]/Ly)*(1.0-(x[1]/Ly)));
1000 bulk_mesh_pt()->node_pt(n)->set_value(1,0.0);
1004 bulk_mesh_pt()->assign_initial_values_impulsive();
1005 wall_mesh_pt()->assign_initial_values_impulsive();
1021 CommandLineArgs::setup(argc,argv);
1024 unsigned coarsening_factor=4;
1025 if (CommandLineArgs::Argc>1)
1027 coarsening_factor=4;
1031 unsigned nup=20/coarsening_factor;
1032 unsigned ncollapsible=40/coarsening_factor;
1033 unsigned ndown=40/coarsening_factor;
1034 unsigned ny=16/coarsening_factor;
1038 double lcollapsible=10.0;
1054 <PseudoSolidNodeUpdateElement<
1055 QTaylorHoodElement<2>,
1056 QPVDElement<2,3> > >
1057 problem(nup, ncollapsible, ndown, ny,
1058 lup, lcollapsible, ldown, ly);
1064 <PseudoSolidNodeUpdateElement<
1065 QCrouzeixRaviartElement<2>,
1066 QPVDElement<2,3> > >
1067 problem(nup, ncollapsible, ndown, ny,
1068 lup, lcollapsible, ldown, ly);
1083 problem.time_pt()->time()=t_min;
1084 problem.initialise_dt(dt);
1087 problem.set_initial_condition();
1091 doc_info.set_directory(
"RESLT");
1094 ofstream trace_file;
1096 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
1097 trace_file.open(filename);
1100 problem.doc_solution(doc_info, trace_file);
1103 doc_info.number()++;
1106 unsigned nstep = unsigned((t_max-t_min)/dt);
1107 if (CommandLineArgs::Argc>1)
1113 for (
unsigned istep=0;istep<nstep;istep++)
1116 problem.unsteady_newton_solve(dt);
1119 problem.doc_solution(doc_info, trace_file);
1122 doc_info.number()++;
Upgrade mesh to solid mesh.
void create_lagrange_multiplier_elements()
Create elements that enforce prescribed boundary motion by Lagrange multipliers.
SolidMesh * Lagrange_multiplier_mesh_pt
Pointers to mesh of Lagrange multiplier elements.
void actions_after_newton_solve()
Update the problem after solve (empty)
ConstitutiveLaw * Constitutive_law_pt
Constitutive law used to determine the mesh deformation.
ElasticCollapsibleChannelMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the "bulk" mesh.
MeshAsGeomObject * Wall_geom_object_pt
Geometric object incarnation of the wall mesh.
ElasticCollapsibleChannelMesh< ELEMENT > * bulk_mesh_pt()
Access function for the specific bulk (fluid) mesh.
void delete_lagrange_multiplier_elements()
Delete elements that enforce prescribed boundary motion by Lagrange multipliers.
~FSICollapsibleChannelProblem()
Destructor (empty)
void actions_before_newton_convergence_check()
Update no slip before Newton convergence check.
void actions_before_newton_solve()
Update the problem specs before solve (empty)
OneDLagrangianMesh< FSIHermiteBeamElement > * wall_mesh_pt()
Access function for the wall mesh.
void delete_traction_elements(Mesh *const &traction_mesh_pt)
Delete prescribed traction elements from the surface 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 set_initial_condition()
Apply initial conditions.
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.
void doc_solution(DocInfo &doc_info, ofstream &trace_file)
Doc the solution.
int main(int argc, char *argv[])
Driver code for a collapsible channel problem with FSI. Presence of command line arguments indicates ...
Namespace to define the mapping [0,1] -> [0,1] that re-distributes nodal points across the channel wi...
double squash_fct(const double &s)
Mapping [0,1] -> [0,1] that re-distributes nodal points across the channel width.
double Delta
Boundary layer width.
double Fract_in_BL
Fraction of points in boundary layer.
Namespace for phyical parameters.
double P_ext
External pressure.
double ReSt
Womersley = Reynolds times Strouhal.
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.
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 Nu
Pseudo-solid Poisson ratio.
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 Lambda_sq
Pseudo-solid mass density.
double Re
Reynolds number.
double P_up
Default pressure on the left boundary.
double H
Non-dimensional wall thickness. As in Jensen & Heil (2003) paper.