33 #include "navier_stokes.h"
36 #include "fluid_interface.h"
39 #include "meshes/two_layer_spine_mesh.h"
43 using namespace oomph;
90 template <
class ELEMENT,
class TIMESTEPPER>
101 const unsigned &n_y2,
const double &l_x,
102 const double &h1,
const double &h2);
127 Bulk_mesh_pt->node_update();
142 const unsigned &pdof,
143 const double &pvalue)
146 dynamic_cast<ELEMENT*
>(Bulk_mesh_pt->element_pt(e))->
147 fix_pressure(pdof,pvalue);
160 Mesh* Surface_mesh_pt;
169 template <
class ELEMENT,
class TIMESTEPPER>
172 const unsigned &n_y2,
const double &l_x,
173 const double& h1,
const double &h2) : Lx(l_x)
177 add_time_stepper_pt(
new TIMESTEPPER);
182 (n_x,n_y1,n_y2,l_x,h1,h2,
true,time_stepper_pt());
187 for(
unsigned i=0;i<n_x;i++)
191 FiniteElement *interface_element_pt =
new
192 SpineLineFluidInterfaceElement<ELEMENT>(
207 for(
unsigned b=0;b<5;b++)
210 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
213 for (
unsigned n=0;n<n_node;n++)
219 if(b==0 || b==3) {
Bulk_mesh_pt->boundary_node_pt(b,n)->pin(1); }
232 for(
unsigned e=0;e<n_lower;e++)
236 lower_layer_element_pt(e));
254 for(
unsigned e=0;e<n_upper;e++)
258 upper_layer_element_pt(e));
288 for(
unsigned e=0;e<n_interface_element;e++)
291 SpineLineFluidInterfaceElement<ELEMENT>* el_pt =
292 dynamic_cast<SpineLineFluidInterfaceElement<ELEMENT>*
>
309 this->build_global_mesh();
313 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
324 template <
class ELEMENT,
class TIMESTEPPER>
328 const unsigned n_node = Bulk_mesh_pt->nnode();
331 for(
unsigned n=0;n<n_node;n++)
334 for(
unsigned i=0;i<2;i++)
337 Bulk_mesh_pt->node_pt(n)->set_value(i,0.0);
343 assign_initial_values_impulsive();
354 template <
class ELEMENT,
class TIMESTEPPER>
359 for(
unsigned b=0;b<5;b++)
362 const unsigned n_node = Bulk_mesh_pt->nboundary_node(b);
365 for(
unsigned n=0;n<n_node;n++)
368 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(0,0.0);
374 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(1,0.0);
386 template <
class ELEMENT,
class TIMESTEPPER>
391 const unsigned n_spine = Bulk_mesh_pt->nspine();
394 for(
unsigned i=0;i<n_spine;i++)
397 double x_value = Bulk_mesh_pt->boundary_node_pt(0,i)->x(0);
400 Bulk_mesh_pt->spine_pt(i)->height() =
401 1.0 + epsilon*(cos(2.0*n_periods*MathematicalConstants::Pi*x_value/Lx));
405 Bulk_mesh_pt->node_update();
414 template <
class ELEMENT,
class TIMESTEPPER>
419 cout <<
"Time is now " << time_pt()->time() << std::endl;
424 << Bulk_mesh_pt->spine_pt(0)->height() <<
" " << std::endl;
430 const unsigned npts = 5;
433 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
435 some_file.open(filename);
438 Bulk_mesh_pt->output(some_file,npts);
439 Surface_mesh_pt->output(some_file,npts);
451 template <
class ELEMENT,
class TIMESTEPPER>
457 const double epsilon = 0.1;
460 const unsigned n_periods = 1;
463 deform_free_surface(epsilon,n_periods);
469 doc_info.set_directory(
"RESLT");
476 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
480 Trace_file <<
"time, free surface height" << std::endl;
486 set_initial_condition();
489 const unsigned n_timestep = unsigned(t_max/dt);
492 doc_solution(doc_info);
498 for(
unsigned t=1;t<=n_timestep;t++)
501 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
504 unsteady_newton_solve(dt);
507 doc_solution(doc_info);
525 int main(
int argc,
char* argv[])
528 CommandLineArgs::setup(argc,argv);
538 const double dt = 0.0025;
541 if(CommandLineArgs::Argc>1) { t_max = 0.005; }
544 const unsigned n_x = 12;
547 const unsigned n_y1 = 12;
550 const unsigned n_y2 = 12;
553 const double l_x = 1.0;
556 const double h1 = 1.0;
559 const double h2 = 1.0;
568 problem(n_x,n_y1,n_y2,l_x,h1,h2);
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Mesh * Surface_mesh_pt
Pointer to the "surface" mesh.
void set_initial_condition()
Set initial conditions.
TwoLayerSpineMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the specific bulk mesh.
void deform_free_surface(const double &epsilon, const unsigned &n_periods)
Deform the mesh/free surface to a prescribed function.
void doc_solution(DocInfo &doc_info)
Doc the solution.
InterfaceProblem()
Constructor.
void set_boundary_conditions()
Set boundary conditions.
~InterfaceProblem()
Destructor (empty)
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 actions_before_newton_convergence_check()
Spine heights/lengths are unknowns in the problem so their values get corrected during each Newton st...
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_after_newton_solve()
Update after solve can remain empty, because the update is performed automatically after every Newton...
Namespace for physical parameters.
double ReSt
Womersley number (Reynolds x Strouhal)
Vector< double > G(2)
Direction of gravity.
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....
ofstream Trace_file
Trace file.
int main(int argc, char *argv[])
/////////////////////////////////////////////////////////////////////// /////////////////////////////...