30 #include "navier_stokes.h"
35 #include "meshes/quarter_circle_sector_mesh.h"
36 #include "meshes/one_d_lagrangian_mesh.h"
40 using namespace oomph;
89 cout <<
"\n\n======================================================" <<std::endl;
90 cout <<
"\nSetting parameters. \n\n";
91 cout <<
"Prescribed: Square of Womersley number: Alpha_sq = "
93 cout <<
" Density ratio: Density_ratio = "
95 cout <<
" Wall thickness: H = "
97 cout <<
" Poisson ratio: Nu = "
99 cout <<
" Pressure perturbation: Pcos = "
100 <<
Pcos << std::endl;
104 cout <<
"\nDependent: Stress ratio: Q = "
108 cout <<
" Timescale ratio: Lambda_sq = "
112 cout <<
" Reynolds number: Re = "
116 cout <<
" Womersley number: ReSt = "
117 <<
ReSt << std::endl;
118 cout <<
"\n======================================================\n\n"
125 void pcos_load(
const Vector<double>& xi,
const Vector<double> &x,
126 const Vector<double>&
N, Vector<double>& load)
128 for(
unsigned i=0;i<2;i++)
129 {load[i] = (
Pext -
Pcos*cos(2.0*xi[0]))*
N[i];}
146 typedef AlgebraicElement<RefineableQCrouzeixRaviartElement<2> >
FLUID_ELEMENT;
156 const double& eps_ampl,
const double& pcos_initial,
157 const double& pcos_duration);
171 Fluid_mesh_pt->node_update();
188 unsigned n_node = Fluid_mesh_pt->nboundary_node(1);
189 for (
unsigned n=0;n<n_node;n++)
191 Fluid_mesh_pt->boundary_node_pt(1,n)->set_auxiliary_node_update_fct_pt(
192 FSI_functions::apply_no_slip_on_moving_wall);
204 FSI_functions::setup_fluid_load_info_for_solid_elements<FLUID_ELEMENT,2>
205 (
this,1,Fluid_mesh_pt,Wall_mesh_pt);
211 void doc_solution(
const unsigned& i, DocInfo& doc_info, ofstream& trace_file);
219 void set_initial_condition();
222 void set_wall_initial_condition();
225 void set_fluid_initial_condition();
267 cout <<
"Setting wall ic" << std::endl;
268 set_wall_initial_condition();
270 cout <<
"Setting fluid ic" << std::endl;
271 set_fluid_initial_condition();
289 Fluid_mesh_pt->node_update();
295 unsigned n_node = Fluid_mesh_pt->nnode();
298 for(
unsigned n=0;n<n_node;n++)
302 for(
unsigned i=0;i<2;i++)
304 Fluid_mesh_pt->node_pt(n)->set_value(i,0.0);
309 Fluid_mesh_pt->assign_initial_values_impulsive();
323 GeomObject* ic_geom_object_pt=
325 Wall_time_stepper_pt);
328 static_cast<PseudoBucklingRing*
>(ic_geom_object_pt)->set_T(1.0);
334 static_cast<PseudoBucklingRing*
>(ic_geom_object_pt)->set_R_0(1.00);
337 SolidInitialCondition* IC_pt =
new SolidInitialCondition(ic_geom_object_pt);
341 SolidMesh::Solid_IC_problem.set_static_initial_condition(
342 this,Wall_mesh_pt,IC_pt,time);
353 DocInfo& doc_info, ofstream& trace_file)
362 doc_info.enable_doc();
363 cout <<
"Full doc step " << doc_info.number()
364 <<
" for time " << time_stepper_pt()->time_pt()->time() << std::endl;
369 doc_info.disable_doc();
370 cout <<
"Only trace for time "
371 << time_stepper_pt()->time_pt()->time() << std::endl;
376 if (doc_info.is_doc_enabled())
379 ofstream some_file;
char filename[100];
382 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
385 some_file.open(filename);
387 Fluid_mesh_pt->output(some_file,5);
394 Vector<double> s(1,1.0);
396 trace_file << time_pt()->time()
398 <<
" " << Doc_displacement_elem_pt->interpolated_x(s,1)
399 <<
" " << Veloc_trace_node_pt->x(0)
400 <<
" " << Veloc_trace_node_pt->x(1)
401 <<
" " << Veloc_trace_node_pt->value(0)
402 <<
" " << Veloc_trace_node_pt->value(1)
403 <<
" " << Fluid_mesh_pt->nelement()
405 <<
" " << Fluid_mesh_pt->nrefinement_overruled()
406 <<
" " << Fluid_mesh_pt->max_error()
407 <<
" " << Fluid_mesh_pt->min_error()
408 <<
" " << Fluid_mesh_pt->max_permitted_error()
409 <<
" " << Fluid_mesh_pt->min_permitted_error()
410 <<
" " << Fluid_mesh_pt->max_keep_unrefined();
414 if (doc_info.is_doc_enabled())
415 {trace_file <<
" " <<doc_info.number() <<
" ";}
416 else {trace_file <<
" " <<-1 <<
" ";}
419 trace_file << std::endl;
422 if (doc_info.is_doc_enabled()) {doc_info.number()++;}
431 const double& eps_ampl,
const double& pcos_initial,
432 const double& pcos_duration) :
433 Eps_ampl(eps_ampl), Pcos_initial(pcos_initial),
434 Pcos_duration(pcos_duration)
458 double L = 2.0*atan(1.0);
491 double fract_mid=0.5;
495 MeshAsGeomObject *wall_mesh_as_geometric_object_pt
499 Fluid_mesh_pt =
new AlgebraicRefineableQuarterCircleSectorMesh<FLUID_ELEMENT >
500 (wall_mesh_as_geometric_object_pt,
504 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
505 Fluid_mesh_pt->spatial_error_estimator_pt()=error_estimator_pt;
518 for (
unsigned n=0;n<n_node;n++)
530 for (
unsigned n=0;n<n_node;n++)
536 node_pt->set_auxiliary_node_update_fct_pt(
537 FSI_functions::apply_no_slip_on_moving_wall);
540 for(
unsigned i=0;i<2;i++) {node_pt->pin(i);}
547 for (
unsigned n=0;n<n_node;n++)
578 for(
unsigned e=0;e<n_element;e++)
589 el_pt->evaluate_shape_derivs_by_direct_fd();
610 for(
unsigned e=0;e<n_wall_element;e++)
644 FSI_functions::setup_fluid_load_info_for_solid_elements<FLUID_ELEMENT,2>
648 cout <<
"# of dofs " << assign_eqn_numbers() << std::endl;
665 doc_info.set_directory(
"RESLT");
671 ofstream trace_file(
"RESLT/trace_ring.dat");
674 trace_file <<
"VARIABLES=\"time\",\"V_c_t_r_l\"";
675 trace_file <<
",\"x<sub>1</sub><sup>(track)</sup>\"";
676 trace_file <<
",\"x<sub>2</sub><sup>(track)</sup>\"";
677 trace_file <<
",\"u<sub>1</sub><sup>(track)</sup>\"";
678 trace_file <<
",\"u<sub>2</sub><sup>(track)</sup>\"";
679 trace_file <<
",\"N<sub>element</sub>\"";
680 trace_file <<
",\"N<sub>dof</sub>\"";
681 trace_file <<
",\"# of under-refined elements\"";
682 trace_file <<
",\"max. error\"";
683 trace_file <<
",\"min. error\"";
684 trace_file <<
",\"max. permitted error\"";
685 trace_file <<
",\"min. permitted error\"";
686 trace_file <<
",\"max. permitted # of unrefined elements\"";
687 trace_file <<
",\"doc number\"";
688 trace_file << std::endl;
698 if (CommandLineArgs::Argc>1)
701 cout <<
"Only doing nstep steps for validation: " << nstep << std::endl;
789 for(
unsigned i=1;i<=nstep;i++)
792 doc_info.disable_doc();
795 unsigned max_adapt=1;
796 unsteady_newton_solve(dt,max_adapt,first);
815 int main(
int argc,
char* argv[])
819 CommandLineArgs::setup(argc,argv);
825 double pcos_initial=1.0e-6;
828 double pcos_duration=0.3;
834 FSIRingProblem problem(nelem,eps_ampl,pcos_initial,pcos_duration);
FSI Ring problem: a fluid-structure interaction problem in which a viscous fluid bounded by an initia...
double Pcos_initial
Initial pcos.
OneDLagrangianMesh< SOLID_ELEMENT > * Wall_mesh_pt
Pointer to wall mesh.
GeomObject * Undef_geom_pt
Pointer to geometric object that represents the undeformed wall shape.
AlgebraicElement< RefineableQCrouzeixRaviartElement< 2 > > FLUID_ELEMENT
There are very few element types that will work for this problem. Rather than passing the element typ...
Node * Veloc_trace_node_pt
Pointer to node on coarsest mesh on which velocity is traced.
void set_initial_condition()
Setup initial condition for both domains.
AlgebraicRefineableQuarterCircleSectorMesh< FLUID_ELEMENT > * Fluid_mesh_pt
Pointer to fluid mesh.
void set_wall_initial_condition()
Setup initial condition for wall.
void actions_after_newton_solve()
Update after solve (empty)
Newmark< 2 > * Wall_time_stepper_pt
Pointer to wall timestepper.
void doc_solution(const unsigned &i, DocInfo &doc_info, ofstream &trace_file)
Doc solution: Pass number of timestep, i (we append to tracefile after every timestep but do a full d...
BDF< 2 > * Fluid_time_stepper_pt
Pointer to fluid timestepper.
double Eps_ampl
Amplitude of initial deformation.
SOLID_ELEMENT * Doc_displacement_elem_pt
Element used for documenting displacement.
FSIRingProblem(const unsigned &nelement_wall, const double &eps_ampl, const double &pcos_initial, const double &pcos_duration)
Constructor: Number of elements in wall mesh, amplitude of the initial wall deformation,...
double Pcos_duration
Duration of initial pcos.
FSIHermiteBeamElement SOLID_ELEMENT
Typedef to specify the solid element used.
void actions_before_newton_solve()
Update before solve (empty)
void dynamic_run()
Do dynamic run.
void set_fluid_initial_condition()
Setup initial condition for fluid.
void actions_after_adapt()
Update the problem specs after adaptation:
void actions_before_newton_convergence_check()
Update the problem specs before checking Newton convergence.
int main(int argc, char *argv[])
Driver for fsi ring test problem.
Namespace for physical parameters.
double Pext
External Pressure.
double Alpha_sq
Square of Womersly number (a frequency parameter)
double ReSt
Reynolds x Strouhal number.
void set_params()
Set the parameters that are used in the code as a function of the Womersley number,...
double Lambda_sq
Timescale ratio (non-dimensation density)
void pcos_load(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Non-FSI load function, a constant external pressure plus a (small) sinusoidal perturbation of wavenum...
double Pcos
Perturbation pressure.
double Re
Reynolds number.
double Density_ratio
Density ratio of the solid and the fluid.
double H
Nondimensional thickness of the beam.