33 #include "axisym_navier_stokes.h"
34 #include "navier_stokes.h"
37 #include "fluid_interface.h"
40 #include "constitutive.h"
46 #include "oomph_crbond_bessel.h"
49 #include "meshes/rectangular_quadmesh.h"
53 using namespace oomph;
105 template <
class ELEMENT>
107 public virtual ElasticRefineableRectangularQuadMesh<ELEMENT>
122 TimeStepper* time_stepper_pt=
123 &Mesh::Default_TimeStepper)
124 : RectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
125 false,time_stepper_pt),
126 ElasticRectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
127 false,time_stepper_pt),
128 ElasticRefineableRectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
129 false,time_stepper_pt)
136 this->set_nboundary(5);
139 for(
unsigned e=0;e<nx;e++)
142 FiniteElement* el_pt = this->finite_element_pt(nx*(ny1-1)+e);
145 const unsigned n_node = el_pt->nnode();
149 for(
unsigned n=0;n<3;n++)
151 Node* nod_pt = el_pt->node_pt(n_node-3+n);
152 this->convert_to_boundary_node(nod_pt);
153 this->add_boundary_node(4,nod_pt);
158 this->setup_boundary_element_info();
172 template <
class ELEMENT,
class TIMESTEPPER>
185 void set_initial_condition();
188 void set_boundary_conditions();
191 void doc_solution(DocInfo &doc_info);
194 void unsteady_run(
const double &t_max,
const double &dt);
208 Bulk_mesh_pt->set_lagrangian_nodal_coordinates();
212 void actions_before_adapt();
215 void actions_after_adapt();
218 void create_interface_elements();
221 void delete_interface_elements();
224 void deform_free_surface(
const double &epsilon,
const double &k);
228 const unsigned &pdof,
229 const double &pvalue)
232 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
233 fix_pressure(pdof,pvalue);
258 template <
class ELEMENT,
class TIMESTEPPER>
263 add_time_stepper_pt(
new TIMESTEPPER);
266 const unsigned n_r = 3;
269 const unsigned n_z1 = 3;
272 const unsigned n_z2 = 3;
275 const double l_r = 1.0;
279 const double h1 = 1.0;
282 const double h2 = 1.0;
286 (n_r,n_z1,n_z2,l_r,h1,h2,time_stepper_pt());
289 Bulk_mesh_pt->spatial_error_estimator_pt() =
new Z2ErrorEstimator;
292 Bulk_mesh_pt->max_refinement_level() = 4;
297 Surface_mesh_pt =
new Mesh;
301 create_interface_elements();
304 add_sub_mesh(Bulk_mesh_pt);
305 add_sub_mesh(Surface_mesh_pt);
318 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
321 for(
unsigned b=0;b<n_boundary;b++)
324 const unsigned n_node = Bulk_mesh_pt->nboundary_node(b);
327 for(
unsigned n=0;n<n_node;n++)
336 Bulk_mesh_pt->boundary_node_pt(b,n)->pin(0);
337 Bulk_mesh_pt->boundary_node_pt(b,n)->pin(2);
344 if(b==0 || b==2) { Bulk_mesh_pt->boundary_node_pt(b,n)->pin(1); }
350 if(b==0 || b==2) { Bulk_mesh_pt->boundary_node_pt(b,n)->pin_position(1); }
356 const unsigned n_node = Bulk_mesh_pt->nnode();
357 for(
unsigned n=0;n<n_node;n++)
360 Bulk_mesh_pt->node_pt(n)->pin_position(0);
363 Bulk_mesh_pt->node_pt(n)->pin(2);
374 const unsigned n_lower = n_r*n_z1;
375 const unsigned n_upper = n_r*n_z2;
378 for(
unsigned e=0;e<n_lower;e++)
381 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
397 el_pt->constitutive_law_pt() = Constitutive_law_pt;
402 for(
unsigned e=n_lower;e<(n_lower+n_upper);e++)
405 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e));
427 el_pt->constitutive_law_pt() = Constitutive_law_pt;
432 fix_pressure(0,0,0.0);
435 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
436 Bulk_mesh_pt->element_pt());
439 set_boundary_conditions();
442 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
453 template <
class ELEMENT,
class TIMESTEPPER>
457 const unsigned n_node = Bulk_mesh_pt->nnode();
460 for(
unsigned n=0;n<n_node;n++)
463 for(
unsigned i=0;i<3;i++)
466 Bulk_mesh_pt->node_pt(n)->set_value(i,0.0);
472 assign_initial_values_impulsive();
483 template <
class ELEMENT,
class TIMESTEPPER>
487 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
490 for(
unsigned b=0;b<n_boundary;b++)
493 const unsigned n_node = Bulk_mesh_pt->nboundary_node(b);
496 for(
unsigned n=0;n<n_node;n++)
500 if(b!=4) { Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(0,0.0); }
504 if(b!=4) { Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(2,0.0); }
509 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(1,0.0);
520 template<
class ELEMENT,
class TIMESTEPPER>
524 delete_interface_elements();
527 rebuild_global_mesh();
536 template<
class ELEMENT,
class TIMESTEPPER>
540 this->create_interface_elements();
543 rebuild_global_mesh();
546 const unsigned n_node = Bulk_mesh_pt->nnode();
547 for(
unsigned n=0;n<n_node;n++) { Bulk_mesh_pt->node_pt(n)->pin_position(0); }
550 RefineableAxisymmetricNavierStokesEquations::
551 unpin_all_pressure_dofs(Bulk_mesh_pt->element_pt());
554 RefineableAxisymmetricNavierStokesEquations::
555 pin_redundant_nodal_pressures(Bulk_mesh_pt->element_pt());
558 fix_pressure(0,0,0.0);
561 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
562 Bulk_mesh_pt->element_pt());
565 set_boundary_conditions();
576 template <
class ELEMENT,
class TIMESTEPPER>
580 const unsigned n_element = this->Bulk_mesh_pt->nboundary_element(4);
583 for(
unsigned e=0;e<n_element;e++)
586 ELEMENT* bulk_elem_pt =
dynamic_cast<ELEMENT*
>(
587 this->Bulk_mesh_pt->boundary_element_pt(4,e));
592 if(bulk_elem_pt->viscosity_ratio_pt()
596 const int face_index = this->Bulk_mesh_pt->face_index_at_boundary(4,e);
599 FiniteElement* interface_element_element_pt =
600 new ElasticAxisymmetricFluidInterfaceElement<ELEMENT>(bulk_elem_pt,
604 this->Surface_mesh_pt->add_element_pt(interface_element_element_pt);
613 const unsigned n_interface_element = this->Surface_mesh_pt->nelement();
616 for(
unsigned e=0;e<n_interface_element;e++)
619 ElasticAxisymmetricFluidInterfaceElement<ELEMENT>* el_pt =
620 dynamic_cast<ElasticAxisymmetricFluidInterfaceElement<ELEMENT>*
>
621 (Surface_mesh_pt->element_pt(e));
638 template <
class ELEMENT,
class TIMESTEPPER>
642 const unsigned n_interface_element = Surface_mesh_pt->nelement();
645 for(
unsigned e=0;e<n_interface_element;e++)
647 delete Surface_mesh_pt->element_pt(e);
651 Surface_mesh_pt->flush_element_and_node_storage();
660 template <
class ELEMENT,
class TIMESTEPPER>
665 double j0, j1, y0, y1, j0p, j1p, y0p, y1p;
668 const unsigned n_node = Bulk_mesh_pt->nnode();
671 for(
unsigned n=0;n<n_node;n++)
674 const double current_r_pos = Bulk_mesh_pt->node_pt(n)->x(0);
675 const double current_z_pos = Bulk_mesh_pt->node_pt(n)->x(1);
678 CRBond_Bessel::bessjy01a(k*current_r_pos,j0,j1,y0,y1,j0p,j1p,y0p,y1p);
681 const double new_z_pos = current_z_pos
682 + (1.0-fabs(1.0-current_z_pos))*epsilon*j0;
685 Bulk_mesh_pt->node_pt(n)->x(1) = new_z_pos;
694 template <
class ELEMENT,
class TIMESTEPPER>
699 cout <<
"Time is now " << time_pt()->time() << std::endl;
702 ElasticAxisymmetricFluidInterfaceElement<ELEMENT>* el_pt =
703 dynamic_cast<ElasticAxisymmetricFluidInterfaceElement<ELEMENT>*
>
704 (Surface_mesh_pt->element_pt(0));
708 Trace_file << time_pt()->time() <<
" "
709 << el_pt->node_pt(0)->x(1) << std::endl;
715 const unsigned npts = 5;
718 sprintf(filename,
"%s/soln%i.dat",
719 doc_info.directory().c_str(),doc_info.number());
720 some_file.open(filename);
723 Bulk_mesh_pt->output(some_file,npts);
729 sprintf(filename,
"%s/interface_soln%i.dat",
730 doc_info.directory().c_str(),doc_info.number());
731 some_file.open(filename);
734 Surface_mesh_pt->output(some_file,npts);
746 template <
class ELEMENT,
class TIMESTEPPER>
752 const double epsilon = 0.1;
755 const double k_bessel = 3.8317;
758 deform_free_surface(epsilon,k_bessel);
764 doc_info.set_directory(
"RESLT");
771 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
772 Trace_file.open(filename);
775 Trace_file <<
"time, interface height" << std::endl;
781 set_initial_condition();
784 unsigned max_adapt = 2;
787 for(
unsigned i=0;i<2;i++) { refine_uniformly(); }
790 doc_solution(doc_info);
796 const unsigned n_timestep = unsigned(t_max/dt);
799 bool first_timestep =
true;
802 for(
unsigned t=1;t<=n_timestep;t++)
805 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
808 unsteady_newton_solve(dt,max_adapt,first_timestep);
811 first_timestep =
false;
817 doc_solution(doc_info);
835 int main(
int argc,
char* argv[])
838 CommandLineArgs::setup(argc,argv);
846 CommandLineArgs::specify_command_line_flag(
"--validation");
849 CommandLineArgs::parse_and_assign();
852 CommandLineArgs::doc_specified_flags();
859 std::ostringstream error_stream;
860 error_stream <<
"Definition of Global_Physical_Variables::ReSt is "
861 <<
"inconsistant with those\n"
862 <<
"of Global_Physical_Variables::Re and "
863 <<
"Global_Physical_Variables::St." << std::endl;
864 throw OomphLibError(error_stream.str(),
865 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
872 const double dt = 0.005;
875 if(CommandLineArgs::command_line_flag_has_been_set(
"--validation"))
888 RefineableAxisymmetricQCrouzeixRaviartElement,
889 RefineableQPVDElement<2,3> >,BDF<2> > problem;
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
ElasticRefineableTwoLayerMesh(const unsigned &nx, const unsigned &ny1, const unsigned &ny2, const double &lx, const double &h1, const double &h2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction, number of elements in y-direction in bottom and ...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Mesh * Surface_mesh_pt
Pointer to the "surface" mesh.
void set_initial_condition()
Set initial conditions.
void actions_after_adapt()
Rebuild the mesh of interface elements after adapting the bulk mesh.
ofstream Trace_file
Trace file.
void doc_solution(DocInfo &doc_info)
Document the solution.
InterfaceProblem()
Constructor.
ConstitutiveLaw * Constitutive_law_pt
double Lr
Width of domain.
void set_boundary_conditions()
Set boundary conditions.
~InterfaceProblem()
Destructor (empty)
void actions_before_adapt()
Strip off the interface elements before adapting the bulk mesh.
void create_interface_elements()
Create the 1d interface elements.
void fix_pressure(const unsigned &e, const unsigned &pdof, const double &pvalue)
Fix pressure in element e at pressure dof pdof and set to pvalue.
void deform_free_surface(const double &epsilon, const double &k)
Deform the mesh/free surface to a prescribed function.
void delete_interface_elements()
Delete the 1d interface elements.
ElasticRefineableTwoLayerMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the (specific) "bulk" mesh.
void actions_before_newton_solve()
No actions required before solve step.
void unsteady_run(const double &t_max, const double &dt)
Do unsteady run up to maximum time t_max with given timestep dt.
void actions_before_implicit_timestep()
Actions before the timestep: For maximum stability, reset the current nodal positions to be the "stre...
void actions_after_newton_solve()
No actions required after solve step.
int main(int argc, char *argv[])
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Namespace for physical parameters.
double ReSt
Womersley number (Reynolds x Strouhal)
double Nu
Pseudo-solid Poisson ratio.
double St
Strouhal number.
double Density_Ratio
Ratio of density in upper fluid to density in lower fluid. Reynolds number etc. is based on density i...
double Ca
Capillary number.
double ReInvFr
Product of Reynolds number and inverse of Froude number.
double Re
Reynolds number.
double Viscosity_Ratio
Ratio of viscosity in upper fluid to viscosity in lower fluid. Reynolds number etc....
Vector< double > G(3)
Direction of gravity.