33#include "navier_stokes.h"
36#include "fluid_interface.h"
39#include "constitutive.h"
45#include "meshes/rectangular_quadmesh.h"
101template <
class ELEMENT>
103 public virtual ElasticRefineableRectangularQuadMesh<ELEMENT>
119 const bool& periodic_in_x,
120 TimeStepper* time_stepper_pt=
121 &Mesh::Default_TimeStepper)
122 : RectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
123 periodic_in_x,time_stepper_pt),
124 ElasticRectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
125 periodic_in_x,time_stepper_pt),
126 ElasticRefineableRectangularQuadMesh<ELEMENT>(nx,ny1+ny2,lx,h1+h2,
135 this->set_nboundary(5);
138 for(
unsigned e=0;e<nx;e++)
141 FiniteElement* el_pt = this->finite_element_pt(nx*(ny1-1)+e);
144 const unsigned n_node = el_pt->nnode();
148 for(
unsigned n=0;n<3;n++)
150 Node* nod_pt = el_pt->node_pt(n_node-3+n);
151 this->convert_to_boundary_node(nod_pt);
152 this->add_boundary_node(4,nod_pt);
157 this->setup_boundary_element_info();
172template <
class ELEMENT,
class TIMESTEPPER>
194 void unsteady_run(
const double &t_max,
const double &dt);
228 const unsigned &pdof,
229 const double &pvalue)
232 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
258template <
class ELEMENT,
class TIMESTEPPER>
263 add_time_stepper_pt(
new TIMESTEPPER);
266 const unsigned n_x = 3;
269 const unsigned n_y1 = 3;
272 const unsigned n_y2 = 3;
275 const double l_x = 1.0;
279 const double h1 = 1.0;
282 const double h2 = 1.0;
293 Bulk_mesh_pt->max_refinement_level() = 4;
298 Surface_mesh_pt =
new Mesh;
302 create_interface_elements();
319 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
325 const unsigned n_node = Bulk_mesh_pt->nboundary_node(
b);
335 if(
b!=4) { Bulk_mesh_pt->boundary_node_pt(
b,
n)->pin(0); }
338 if(
b==0 ||
b==2) { Bulk_mesh_pt->boundary_node_pt(
b,
n)->pin(1); }
344 if(
b==0 ||
b==2) { Bulk_mesh_pt->boundary_node_pt(
b,
n)->pin_position(1); }
350 const unsigned n_node = Bulk_mesh_pt->nnode();
351 for(
unsigned n=0;
n<
n_node;
n++) { Bulk_mesh_pt->node_pt(
n)->pin_position(0); }
384 el_pt->constitutive_law_pt() = Constitutive_law_pt;
414 el_pt->constitutive_law_pt() = Constitutive_law_pt;
419 fix_pressure(0,0,0.0);
422 set_boundary_conditions();
436template <
class ELEMENT,
class TIMESTEPPER>
446 for(
unsigned i=0;
i<2;
i++)
466template <
class ELEMENT,
class TIMESTEPPER>
470 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
476 const unsigned n_node = Bulk_mesh_pt->nboundary_node(
b);
483 if(
b!=4) { Bulk_mesh_pt->boundary_node_pt(
b,
n)->set_value(0,0.0); }
489 Bulk_mesh_pt->boundary_node_pt(
b,
n)->set_value(1,0.0);
501template<
class ELEMENT,
class TIMESTEPPER>
505 delete_interface_elements();
517template<
class ELEMENT,
class TIMESTEPPER>
521 this->create_interface_elements();
527 const unsigned n_node = Bulk_mesh_pt->nnode();
528 for(
unsigned n=0;
n<
n_node;
n++) { Bulk_mesh_pt->node_pt(
n)->pin_position(0); }
539 fix_pressure(0,0,0.0);
543 Bulk_mesh_pt->element_pt());
546 set_boundary_conditions();
557template <
class ELEMENT,
class TIMESTEPPER>
561 const unsigned n_element = this->Bulk_mesh_pt->nboundary_element(4);
568 this->Bulk_mesh_pt->boundary_element_pt(4,
e));
577 const int face_index = this->Bulk_mesh_pt->face_index_at_boundary(4,
e);
601 (Surface_mesh_pt->element_pt(
e));
618template <
class ELEMENT,
class TIMESTEPPER>
627 delete Surface_mesh_pt->element_pt(
e);
631 Surface_mesh_pt->flush_element_and_node_storage();
640template <
class ELEMENT,
class TIMESTEPPER>
645 const unsigned n_node = Bulk_mesh_pt->nnode();
669template <
class ELEMENT,
class TIMESTEPPER>
674 cout <<
"Time is now " <<
time_pt()->time() << std::endl;
679 (Surface_mesh_pt->element_pt(0));
683 Trace_file <<
time_pt()->time() <<
" "
684 <<
el_pt->node_pt(0)->x(1) << std::endl;
690 const unsigned npts = 5;
721template <
class ELEMENT,
class TIMESTEPPER>
750 Trace_file <<
"time, interface height" << std::endl;
756 set_initial_condition();
835 error_stream <<
"Definition of Global_Physical_Variables::ReSt is "
836 <<
"inconsistant with those\n"
837 <<
"of Global_Physical_Variables::Re and "
838 <<
"Global_Physical_Variables::St." << std::endl;
847 const double dt = 0.0025;
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
ElasticRefineableTwoLayerMesh(const unsigned &nx, const unsigned &ny1, const unsigned &ny2, const double &lx, const double &h1, const double &h2, const bool &periodic_in_x, 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.
void deform_free_surface(const double &epsilon, const unsigned &n_periods)
Deform the mesh/free surface to a prescribed function.
ofstream Trace_file
Trace file.
void doc_solution(DocInfo &doc_info)
Document the solution.
InterfaceProblem()
Constructor.
ConstitutiveLaw * Constitutive_law_pt
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.
double Lx
Width of domain.
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 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)
Vector< double > G(2)
Direction of gravity.
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....