34 #include "navier_stokes.h" 39 #include "meshes/quarter_circle_sector_mesh.h" 40 #include "meshes/one_d_lagrangian_mesh.h" 44 using namespace oomph;
93 cout <<
"\n\n======================================================" <<std::endl;
94 cout <<
"\nSetting parameters. \n\n";
95 cout <<
"Prescribed: Square of Womersley number: Alpha_sq = " 96 << Alpha_sq << std::endl;
97 cout <<
" Density ratio: Density_ratio = " 98 << Density_ratio << std::endl;
99 cout <<
" Wall thickness: H = " 101 cout <<
" Poisson ratio: Nu = " 103 cout <<
" Pressure perturbation: Pcos = " 104 << Pcos << std::endl;
108 cout <<
"\nDependent: Stress ratio: Q = " 112 cout <<
" Timescale ratio: Lambda_sq = " 113 << Lambda_sq << std::endl;
116 cout <<
" Reynolds number: Re = " 120 cout <<
" Womersley number: ReSt = " 121 << ReSt << std::endl;
122 cout <<
"\n======================================================\n\n" 129 void pcos_load(
const Vector<double>& xi,
const Vector<double> &x,
130 const Vector<double>&
N, Vector<double>& load)
132 for(
unsigned i=0;i<2;i++)
133 {load[i] = (Pext - Pcos*cos(2.0*xi[0]))*N[i];}
150 typedef AlgebraicElement<RefineableQCrouzeixRaviartElement<2> >
FLUID_ELEMENT;
160 const double& eps_ampl,
const double& pcos_initial,
161 const double& pcos_duration);
175 Fluid_mesh_pt->node_update();
192 unsigned n_node = Fluid_mesh_pt->nboundary_node(1);
193 for (
unsigned n=0;n<n_node;n++)
195 Fluid_mesh_pt->boundary_node_pt(1,n)->set_auxiliary_node_update_fct_pt(
196 FSI_functions::apply_no_slip_on_moving_wall);
208 FSI_functions::setup_fluid_load_info_for_solid_elements<FLUID_ELEMENT,2>
209 (
this,1,Fluid_mesh_pt,Wall_mesh_pt);
215 void doc_solution(
const unsigned& i, DocInfo& doc_info, ofstream& trace_file);
223 void set_initial_condition();
226 void set_wall_initial_condition();
229 void set_fluid_initial_condition();
271 cout <<
"Setting wall ic" << std::endl;
272 set_wall_initial_condition();
274 cout <<
"Setting fluid ic" << std::endl;
275 set_fluid_initial_condition();
293 Fluid_mesh_pt->node_update();
299 unsigned n_node = Fluid_mesh_pt->nnode();
302 for(
unsigned n=0;n<n_node;n++)
306 for(
unsigned i=0;i<2;i++)
308 Fluid_mesh_pt->node_pt(n)->set_value(i,0.0);
313 Fluid_mesh_pt->assign_initial_values_impulsive();
327 GeomObject* ic_geom_object_pt=
329 Wall_time_stepper_pt);
332 static_cast<PseudoBucklingRing*
>(ic_geom_object_pt)->set_T(1.0);
338 static_cast<PseudoBucklingRing*
>(ic_geom_object_pt)->set_R_0(1.00);
341 SolidInitialCondition* IC_pt =
new SolidInitialCondition(ic_geom_object_pt);
345 SolidMesh::Solid_IC_problem.set_static_initial_condition(
346 this,Wall_mesh_pt,IC_pt,time);
357 DocInfo& doc_info, ofstream& trace_file)
366 doc_info.enable_doc();
367 cout <<
"Full doc step " << doc_info.number()
368 <<
" for time " << time_stepper_pt()->time_pt()->time() << std::endl;
373 doc_info.disable_doc();
374 cout <<
"Only trace for time " 375 << time_stepper_pt()->time_pt()->time() << std::endl;
380 if (doc_info.is_doc_enabled())
383 ofstream some_file;
char filename[100];
386 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
389 some_file.open(filename);
391 Fluid_mesh_pt->output(some_file,5);
398 Vector<double> s(1,1.0);
400 trace_file << time_pt()->time()
402 <<
" " << Doc_displacement_elem_pt->interpolated_x(s,1)
403 <<
" " << Veloc_trace_node_pt->x(0)
404 <<
" " << Veloc_trace_node_pt->x(1)
405 <<
" " << Veloc_trace_node_pt->value(0)
406 <<
" " << Veloc_trace_node_pt->value(1)
407 <<
" " << Fluid_mesh_pt->nelement()
409 <<
" " << Fluid_mesh_pt->nrefinement_overruled()
410 <<
" " << Fluid_mesh_pt->max_error()
411 <<
" " << Fluid_mesh_pt->min_error()
412 <<
" " << Fluid_mesh_pt->max_permitted_error()
413 <<
" " << Fluid_mesh_pt->min_permitted_error()
414 <<
" " << Fluid_mesh_pt->max_keep_unrefined();
418 if (doc_info.is_doc_enabled())
419 {trace_file <<
" " <<doc_info.number() <<
" ";}
420 else {trace_file <<
" " <<-1 <<
" ";}
423 trace_file << std::endl;
426 if (doc_info.is_doc_enabled()) {doc_info.number()++;}
435 const double& eps_ampl,
const double& pcos_initial,
436 const double& pcos_duration) :
437 Eps_ampl(eps_ampl), Pcos_initial(pcos_initial),
438 Pcos_duration(pcos_duration)
462 double L = 2.0*atan(1.0);
495 double fract_mid=0.5;
499 MeshAsGeomObject *wall_mesh_as_geometric_object_pt
503 Fluid_mesh_pt =
new AlgebraicRefineableQuarterCircleSectorMesh<FLUID_ELEMENT >
504 (wall_mesh_as_geometric_object_pt,
508 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
509 Fluid_mesh_pt->spatial_error_estimator_pt()=error_estimator_pt;
522 for (
unsigned n=0;n<n_node;n++)
534 for (
unsigned n=0;n<n_node;n++)
540 node_pt->set_auxiliary_node_update_fct_pt(
541 FSI_functions::apply_no_slip_on_moving_wall);
544 for(
unsigned i=0;i<2;i++) {node_pt->pin(i);}
551 for (
unsigned n=0;n<n_node;n++)
582 for(
unsigned e=0;e<n_element;e++)
593 el_pt->evaluate_shape_derivs_by_direct_fd();
614 for(
unsigned e=0;e<n_wall_element;e++)
648 FSI_functions::setup_fluid_load_info_for_solid_elements<FLUID_ELEMENT,2>
652 cout <<
"# of dofs " << assign_eqn_numbers() << std::endl;
669 doc_info.set_directory(
"RESLT");
675 ofstream trace_file(
"RESLT/trace_ring.dat");
678 trace_file <<
"VARIABLES=\"time\",\"V_c_t_r_l\"";
679 trace_file <<
",\"x<sub>1</sub><sup>(track)</sup>\"";
680 trace_file <<
",\"x<sub>2</sub><sup>(track)</sup>\"";
681 trace_file <<
",\"u<sub>1</sub><sup>(track)</sup>\"";
682 trace_file <<
",\"u<sub>2</sub><sup>(track)</sup>\"";
683 trace_file <<
",\"N<sub>element</sub>\"";
684 trace_file <<
",\"N<sub>dof</sub>\"";
685 trace_file <<
",\"# of under-refined elements\"";
686 trace_file <<
",\"max. error\"";
687 trace_file <<
",\"min. error\"";
688 trace_file <<
",\"max. permitted error\"";
689 trace_file <<
",\"min. permitted error\"";
690 trace_file <<
",\"max. permitted # of unrefined elements\"";
691 trace_file <<
",\"doc number\"";
692 trace_file << std::endl;
702 if (CommandLineArgs::Argc>1)
705 cout <<
"Only doing nstep steps for validation: " << nstep << std::endl;
793 for(
unsigned i=1;i<=nstep;i++)
796 doc_info.disable_doc();
799 unsigned max_adapt=1;
800 unsteady_newton_solve(dt,max_adapt,first);
819 int main(
int argc,
char* argv[])
823 CommandLineArgs::setup(argc,argv);
829 double pcos_initial=1.0e-6;
832 double pcos_duration=0.3;
838 FSIRingProblem problem(nelem,eps_ampl,pcos_initial,pcos_duration);
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...
double Density_ratio
Density ratio of the solid and the fluid.
void set_params()
Set the parameters that are used in the code as a function of the Womersley number, the density ratio and H.
double Lambda_sq
Timescale ratio (non-dimensation density)
double Pcos
Perturbation pressure.
AlgebraicRefineableQuarterCircleSectorMesh< FLUID_ELEMENT > * Fluid_mesh_pt
Pointer to fluid mesh.
void set_fluid_initial_condition()
Setup initial condition for fluid.
double Pcos_initial
Initial pcos.
void dynamic_run()
Do dynamic run.
double ReSt
Reynolds x Strouhal number.
void set_initial_condition()
Setup initial condition for both domains.
double Eps_ampl
Amplitude of initial deformation.
double Pcos_duration
Duration of initial pcos.
double Pext
External Pressure.
double Re
Reynolds number.
BDF< 2 > * Fluid_time_stepper_pt
Pointer to fluid timestepper.
Namespace for physical parameters.
double H
Nondimensional thickness of the beam.
GeomObject * Undef_geom_pt
Pointer to geometric object that represents the undeformed wall shape.
SOLID_ELEMENT * Doc_displacement_elem_pt
Element used for documenting displacement.
Newmark< 2 > * Wall_time_stepper_pt
Pointer to wall timestepper.
FSIHermiteBeamElement SOLID_ELEMENT
Typedef to specify the solid element used.
void actions_after_adapt()
Update the problem specs after adaptation:
double Alpha_sq
Square of Womersly number (a frequency parameter)
void actions_after_newton_solve()
Update after solve (empty)
int main(int argc, char *argv[])
Driver for fsi ring test problem.
FSIRingProblem(const unsigned &nelement_wall, const double &eps_ampl, const double &pcos_initial, const double &pcos_duration)
void pcos_load(const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
void set_wall_initial_condition()
Setup initial condition for wall.
AlgebraicElement< RefineableQCrouzeixRaviartElement< 2 > > FLUID_ELEMENT
There are very few element types that will work for this problem. Rather than passing the element typ...
OneDLagrangianMesh< SOLID_ELEMENT > * Wall_mesh_pt
Pointer to wall mesh.
void actions_before_newton_solve()
Update before solve (empty)
Node * Veloc_trace_node_pt
Pointer to node on coarsest mesh on which velocity is traced.
void actions_before_newton_convergence_check()
Update the problem specs before checking Newton convergence.