33 #include "navier_stokes.h"
36 #include "fluid_interface.h"
39 #include "meshes/single_layer_spine_mesh.h"
43 using namespace oomph;
82 template<
class ELEMENT,
class TIMESTEPPER>
92 const double &l_x,
const double &h);
113 Mesh* Surface_mesh_pt;
123 Bulk_mesh_pt->node_update();
149 template<
class ELEMENT,
class TIMESTEPPER>
152 const double &l_x,
const double& h) : Lx(l_x)
156 add_time_stepper_pt(
new TIMESTEPPER);
161 new SingleLayerSpineMesh<ELEMENT>(n_x,n_y,l_x,h,
true,time_stepper_pt());
169 for(
unsigned i=0;i<n_x;i++)
173 FiniteElement *interface_element_pt =
174 new SpineLineFluidInterfaceElement<ELEMENT>(
199 for(
unsigned b=0;b<n_boundary;b++)
202 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
205 for(
unsigned n=0;n<n_node;n++)
229 const unsigned n_element_bulk =
Bulk_mesh_pt->nelement();
232 for(
unsigned e=0;e<n_element_bulk;e++)
235 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
Bulk_mesh_pt->element_pt(e));
252 Data* external_pressure_data_pt =
new Data(1);
255 external_pressure_data_pt->pin(0);
256 external_pressure_data_pt->set_value(0,1.31);
262 for(
unsigned e=0;e<n_interface_element;e++)
265 SpineLineFluidInterfaceElement<ELEMENT>* el_pt =
266 dynamic_cast<SpineLineFluidInterfaceElement<ELEMENT>*
>
276 el_pt->set_external_pressure_data(external_pressure_data_pt);
284 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
296 template <
class ELEMENT,
class TIMESTEPPER>
300 const unsigned n_node = Bulk_mesh_pt->nnode();
303 for(
unsigned n=0;n<n_node;n++)
306 for(
unsigned i=0;i<2;i++)
309 Bulk_mesh_pt->node_pt(n)->set_value(i,0.0);
315 assign_initial_values_impulsive();
326 template <
class ELEMENT,
class TIMESTEPPER>
330 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
333 for(
unsigned b=0;b<n_boundary;b++)
336 const unsigned n_node = Bulk_mesh_pt->nboundary_node(b);
339 for(
unsigned n=0;n<n_node;n++)
345 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(0,0.0);
351 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(1,0.0);
363 template <
class ELEMENT,
class TIMESTEPPER>
368 const unsigned n_spine = Bulk_mesh_pt->nspine();
371 for(
unsigned i=0;i<n_spine;i++)
374 double x_value = Bulk_mesh_pt->boundary_node_pt(0,i)->x(0);
377 Bulk_mesh_pt->spine_pt(i)->height() =
378 1.0 + epsilon*(cos(2.0*n_periods*MathematicalConstants::Pi*x_value/Lx));
382 Bulk_mesh_pt->node_update();
391 template<
class ELEMENT,
class TIMESTEPPER>
396 cout <<
"Time is now " << time_pt()->time() << std::endl;
400 Trace_file << time_pt()->time() <<
" "
401 << Bulk_mesh_pt->spine_pt(0)->height() <<
" " << std::endl;
407 const unsigned npts = 5;
410 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
412 some_file.open(filename);
415 Bulk_mesh_pt->output(some_file,npts);
416 Surface_mesh_pt->output(some_file,npts);
428 template<
class ELEMENT,
class TIMESTEPPER>
434 const double epsilon = 0.1;
437 const unsigned n_periods = 1;
440 deform_free_surface(epsilon,n_periods);
446 doc_info.set_directory(
"RESLT");
453 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
454 Trace_file.open(filename);
457 Trace_file <<
"time, free surface height" << std::endl;
463 set_initial_condition();
466 const unsigned n_timestep = unsigned(t_max/dt);
469 doc_solution(doc_info);
475 for(
unsigned t=1;t<=n_timestep;t++)
478 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
481 unsteady_newton_solve(dt);
484 doc_solution(doc_info);
502 int main(
int argc,
char* argv[])
505 CommandLineArgs::setup(argc,argv);
515 const double dt = 0.0025;
518 if(CommandLineArgs::Argc>1) { t_max = 0.005; }
521 const unsigned n_x = 12;
524 const unsigned n_y = 12;
527 const double l_x = 1.0;
530 const double h = 1.0;
539 problem(n_x,n_y,l_x,h);
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Mesh * Surface_mesh_pt
Pointer to the "surface" mesh.
void set_initial_condition()
Set initial conditions.
void deform_free_surface(const double &epsilon, const unsigned &n_periods)
Deform the mesh/free surface to a prescribed function.
SingleLayerSpineMesh< ELEMENT > * Bulk_mesh_pt
The bulk fluid mesh, complete with spines and update information.
void doc_solution(DocInfo &doc_info)
Doc the solution.
InterfaceProblem(const unsigned &n_x, const unsigned &n_y, const double &l_x, const double &h)
Constructor: Pass the number of elements and the lengths of the domain in the x and y directions (h i...
void set_boundary_conditions()
Set boundary conditions.
~InterfaceProblem()
Destructor (empty)
void actions_before_newton_convergence_check()
Spine heights/lengths are unknowns in the problem so their values get corrected during each Newton st...
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...
ElasticRectangularQuadMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the (specific) "bulk" mesh.
Namespace for physical parameters.
double ReSt
Womersley number (Reynolds x Strouhal, computed automatically)
Vector< double > G(2)
Direction of gravity.
double St
Strouhal number.
double Ca
Capillary number.
double ReInvFr
Product of Reynolds number and inverse of Froude number.
double Re
Reynolds number.
int main(int argc, char *argv[])
/////////////////////////////////////////////////////////////////////// /////////////////////////////...