37 #include "navier_stokes.h" 40 #include "fluid_interface.h" 43 #include "meshes/two_layer_spine_mesh.h" 47 using namespace oomph;
94 template <
class ELEMENT,
class TIMESTEPPER>
105 const unsigned &n_y2,
const double &l_x,
106 const double &h1,
const double &h2);
112 void set_initial_condition();
115 void set_boundary_conditions();
118 void doc_solution(DocInfo &doc_info);
121 void unsteady_run(
const double &t_max,
const double &dt);
131 Bulk_mesh_pt->node_update();
142 void deform_free_surface(
const double &epsilon,
const unsigned &n_periods);
146 const unsigned &pdof,
147 const double &pvalue)
150 dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e))->
151 fix_pressure(pdof,pvalue);
164 Mesh* Surface_mesh_pt;
173 template <
class ELEMENT,
class TIMESTEPPER>
176 const unsigned &n_y2,
const double &l_x,
177 const double& h1,
const double &h2) : Lx(l_x)
181 add_time_stepper_pt(
new TIMESTEPPER);
186 (n_x,n_y1,n_y2,l_x,h1,h2,
true,time_stepper_pt());
191 for(
unsigned i=0;i<n_x;i++)
195 FiniteElement *interface_element_pt =
new 196 SpineLineFluidInterfaceElement<ELEMENT>(
199 this->Surface_mesh_pt->add_element_pt(interface_element_pt);
211 for(
unsigned b=0;b<5;b++)
214 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
217 for (
unsigned n=0;n<n_node;n++)
223 if(b==0 || b==3) {
Bulk_mesh_pt->boundary_node_pt(b,n)->pin(1); }
236 for(
unsigned e=0;e<n_lower;e++)
240 lower_layer_element_pt(e));
258 for(
unsigned e=0;e<n_upper;e++)
262 upper_layer_element_pt(e));
289 unsigned n_interface_element = Surface_mesh_pt->nelement();
292 for(
unsigned e=0;e<n_interface_element;e++)
295 SpineLineFluidInterfaceElement<ELEMENT>* el_pt =
296 dynamic_cast<SpineLineFluidInterfaceElement<ELEMENT>*
> 297 (Surface_mesh_pt->element_pt(e));
311 this->add_sub_mesh(Surface_mesh_pt);
313 this->build_global_mesh();
317 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
328 template <
class ELEMENT,
class TIMESTEPPER>
335 for(
unsigned n=0;n<n_node;n++)
338 for(
unsigned i=0;i<2;i++)
347 assign_initial_values_impulsive();
358 template <
class ELEMENT,
class TIMESTEPPER>
363 for(
unsigned b=0;b<5;b++)
366 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
369 for(
unsigned n=0;n<n_node;n++)
390 template <
class ELEMENT,
class TIMESTEPPER>
398 for(
unsigned i=0;i<n_spine;i++)
401 double x_value =
Bulk_mesh_pt->boundary_node_pt(0,i)->x(0);
405 1.0 + epsilon*(cos(2.0*n_periods*MathematicalConstants::Pi*x_value/
Lx));
418 template <
class ELEMENT,
class TIMESTEPPER>
423 cout <<
"Time is now " << time_pt()->time() << std::endl;
428 <<
Bulk_mesh_pt->spine_pt(0)->height() <<
" " << std::endl;
434 const unsigned npts = 5;
437 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
439 some_file.open(filename);
455 template <
class ELEMENT,
class TIMESTEPPER>
461 const double epsilon = 0.1;
464 const unsigned n_periods = 1;
473 doc_info.set_directory(
"RESLT");
480 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
484 Trace_file <<
"time, free surface height" << std::endl;
493 const unsigned n_timestep = unsigned(t_max/dt);
502 for(
unsigned t=1;t<=n_timestep;t++)
505 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
508 unsteady_newton_solve(dt);
529 int main(
int argc,
char* argv[])
532 CommandLineArgs::setup(argc,argv);
542 const double dt = 0.0025;
545 if(CommandLineArgs::Argc>1) { t_max = 0.005; }
548 const unsigned n_x = 12;
551 const unsigned n_y1 = 12;
554 const unsigned n_y2 = 12;
557 const double l_x = 1.0;
560 const double h1 = 1.0;
563 const double h2 = 1.0;
572 problem(n_x,n_y1,n_y2,l_x,h1,h2);
double Lx
Width of domain.
TwoLayerSpineMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the specific bulk mesh.
int main(int argc, char *argv[])
Driver code for two-dimensional two fluid interface problem.
InterfaceProblem()
Constructor.
Vector< double > G(2)
Direction of gravity.
Mesh * Surface_mesh_pt
Pointer to the "surface" mesh.
double St
Strouhal number.
ofstream Trace_file
Trace file.
void actions_before_newton_solve()
No actions required before solve step.
double ReSt
Womersley number (Reynolds x Strouhal)
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.
~InterfaceProblem()
Destructor (empty)
double Density_Ratio
Ratio of density in upper fluid to density in lower fluid. Reynolds number etc. is based on density i...
double Re
Reynolds number.
void actions_after_newton_solve()
Update after solve can remain empty, because the update is performed automatically after every Newton...
void set_boundary_conditions()
Set boundary conditions.
void actions_before_newton_convergence_check()
Spine heights/lengths are unknowns in the problem so their values get corrected during each Newton st...
void set_initial_condition()
Set initial conditions.
void unsteady_run(const double &t_max, const double &dt)
Do unsteady run up to maximum time t_max with given timestep dt.
double Viscosity_Ratio
Ratio of viscosity in upper fluid to viscosity in lower fluid. Reynolds number etc. is based on viscosity in lower fluid.
Namespace for physical parameters.
void deform_free_surface(const double &epsilon, const unsigned &n_periods)
Deform the mesh/free surface to a prescribed function.
double ReInvFr
Product of Reynolds number and inverse of Froude number.
ElasticRefineableTwoLayerMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the (specific) "bulk" mesh.
void doc_solution(DocInfo &doc_info)
Document the solution.
double Ca
Capillary number.