33 #include "navier_stokes.h"
36 #include "fluid_interface.h"
39 #include "constitutive.h"
45 #include "meshes/rectangular_quadmesh.h"
49 using namespace oomph;
91 template <
class ELEMENT,
class TIMESTEPPER>
101 const double &l_x,
const double &h);
107 void set_initial_condition();
110 void set_boundary_conditions();
113 void doc_solution(DocInfo &doc_info);
116 void unsteady_run(
const double &t_max,
const double &dt);
130 Bulk_mesh_pt->set_lagrangian_nodal_coordinates();
134 void deform_free_surface(
const double &epsilon,
const unsigned &n_periods);
158 template <
class ELEMENT,
class TIMESTEPPER>
161 const double &l_x,
const double& h) : Lx(l_x)
165 add_time_stepper_pt(
new TIMESTEPPER);
170 (n_x,n_y,l_x,h,
true,time_stepper_pt());
182 for(
unsigned e=0;e<n_x;e++)
186 FiniteElement* bulk_element_pt =
190 FiniteElement* interface_element_pt =
191 new ElasticLineFluidInterfaceElement<ELEMENT>(bulk_element_pt,2);
215 for(
unsigned b=0;b<n_boundary;b++)
218 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
221 for(
unsigned n=0;n<n_node;n++)
255 for(
unsigned n=0;n<n_node;n++) {
Bulk_mesh_pt->node_pt(n)->pin_position(0); }
265 const unsigned n_element_bulk =
Bulk_mesh_pt->nelement();
268 for(
unsigned e=0;e<n_element_bulk;e++)
271 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
Bulk_mesh_pt->element_pt(e));
292 Data* external_pressure_data_pt =
new Data(1);
295 external_pressure_data_pt->pin(0);
296 external_pressure_data_pt->set_value(0,1.31);
302 for(
unsigned e=0;e<n_interface_element;e++)
305 ElasticLineFluidInterfaceElement<ELEMENT>* el_pt =
306 dynamic_cast<ElasticLineFluidInterfaceElement<ELEMENT>*
>
316 el_pt->set_external_pressure_data(external_pressure_data_pt);
324 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
335 template <
class ELEMENT,
class TIMESTEPPER>
339 const unsigned n_node = mesh_pt()->nnode();
342 for(
unsigned n=0;n<n_node;n++)
345 for(
unsigned i=0;i<2;i++)
348 mesh_pt()->node_pt(n)->set_value(i,0.0);
354 assign_initial_values_impulsive();
365 template <
class ELEMENT,
class TIMESTEPPER>
369 const unsigned n_boundary = Bulk_mesh_pt->nboundary();
372 for(
unsigned b=0;b<n_boundary;b++)
375 const unsigned n_node = Bulk_mesh_pt->nboundary_node(b);
378 for(
unsigned n=0;n<n_node;n++)
384 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(0,0.0);
390 Bulk_mesh_pt->boundary_node_pt(b,n)->set_value(1,0.0);
402 template <
class ELEMENT,
class TIMESTEPPER>
407 const unsigned n_node = Bulk_mesh_pt->nnode();
410 for(
unsigned n=0;n<n_node;n++)
413 const double current_x_pos = Bulk_mesh_pt->node_pt(n)->x(0);
414 const double current_y_pos = Bulk_mesh_pt->node_pt(n)->x(1);
417 const double new_y_pos = current_y_pos
418 + (1.0-fabs(1.0-current_y_pos))*epsilon
419 *(cos(2.0*n_periods*MathematicalConstants::Pi*current_x_pos/Lx));
422 Bulk_mesh_pt->node_pt(n)->x(1) = new_y_pos;
431 template <
class ELEMENT,
class TIMESTEPPER>
436 cout <<
"Time is now " << time_pt()->time() << std::endl;
439 ElasticLineFluidInterfaceElement<ELEMENT>* el_pt =
440 dynamic_cast<ElasticLineFluidInterfaceElement<ELEMENT>*
>
441 (Surface_mesh_pt->element_pt(0));
445 Trace_file << time_pt()->time() <<
" "
446 << el_pt->node_pt(0)->x(1) << std::endl;
452 const unsigned npts = 5;
455 sprintf(filename,
"%s/soln%i.dat",
456 doc_info.directory().c_str(),doc_info.number());
457 some_file.open(filename);
460 Bulk_mesh_pt->output(some_file,npts);
466 sprintf(filename,
"%s/interface_soln%i.dat",
467 doc_info.directory().c_str(),doc_info.number());
468 some_file.open(filename);
471 Surface_mesh_pt->output(some_file,npts);
483 template <
class ELEMENT,
class TIMESTEPPER>
489 const double epsilon = 0.1;
492 const unsigned n_periods = 1;
495 deform_free_surface(epsilon,n_periods);
501 doc_info.set_directory(
"RESLT");
508 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
509 Trace_file.open(filename);
512 Trace_file <<
"time, free surface height" << std::endl;
518 set_initial_condition();
521 const unsigned n_timestep = unsigned(t_max/dt);
524 doc_solution(doc_info);
530 for(
unsigned t=1;t<=n_timestep;t++)
533 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
536 unsteady_newton_solve(dt);
539 doc_solution(doc_info);
557 int main(
int argc,
char* argv[])
560 CommandLineArgs::setup(argc,argv);
570 const double dt = 0.0025;
573 if(CommandLineArgs::Argc>1) { t_max = 0.005; }
576 const unsigned n_x = 12;
579 const unsigned n_y = 12;
582 const double l_x = 1.0;
585 const double h = 1.0;
594 QPVDElement<2,3> > , BDF<2> >
595 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.
ofstream Trace_file
Trace file.
void doc_solution(DocInfo &doc_info)
Document the solution.
ConstitutiveLaw * Constitutive_law_pt
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)
double Lx
Width of domain.
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.
ElasticRectangularQuadMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the (specific) "bulk" mesh.
int main(int argc, char *argv[])
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Namespace for physical parameters.
double ReSt
Womersley number (Reynolds x Strouhal, computed automatically)
Vector< double > G(2)
Direction of gravity.
double Nu
Pseudo-solid Poisson ratio.
double St
Strouhal number.
double Ca
Capillary number.
double ReInvFr
Product of Reynolds number and inverse of Froude number.
double Re
Reynolds number.