37 #include "navier_stokes.h" 40 #include "fluid_interface.h" 43 #include "constitutive.h" 49 #include "meshes/rectangular_quadmesh.h" 53 using namespace oomph;
95 template <
class ELEMENT,
class TIMESTEPPER>
105 const double &l_x,
const double &h);
111 void set_initial_condition();
114 void set_boundary_conditions();
117 void doc_solution(DocInfo &doc_info);
120 void unsteady_run(
const double &t_max,
const double &dt);
134 Bulk_mesh_pt->set_lagrangian_nodal_coordinates();
138 void deform_free_surface(
const double &epsilon,
const unsigned &n_periods);
162 template <
class ELEMENT,
class TIMESTEPPER>
165 const double &l_x,
const double& h) : Lx(l_x)
169 add_time_stepper_pt(
new TIMESTEPPER);
174 (n_x,n_y,l_x,h,
true,time_stepper_pt());
186 for(
unsigned e=0;e<n_x;e++)
190 FiniteElement* bulk_element_pt =
194 FiniteElement* interface_element_pt =
195 new ElasticLineFluidInterfaceElement<ELEMENT>(bulk_element_pt,2);
198 this->Surface_mesh_pt->add_element_pt(interface_element_pt);
203 add_sub_mesh(Surface_mesh_pt);
219 for(
unsigned b=0;b<n_boundary;b++)
222 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
225 for(
unsigned n=0;n<n_node;n++)
259 for(
unsigned n=0;n<n_node;n++) {
Bulk_mesh_pt->node_pt(n)->pin_position(0); }
269 const unsigned n_element_bulk =
Bulk_mesh_pt->nelement();
272 for(
unsigned e=0;e<n_element_bulk;e++)
275 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
Bulk_mesh_pt->element_pt(e));
296 Data* external_pressure_data_pt =
new Data(1);
299 external_pressure_data_pt->pin(0);
300 external_pressure_data_pt->set_value(0,1.31);
303 const unsigned n_interface_element = Surface_mesh_pt->nelement();
306 for(
unsigned e=0;e<n_interface_element;e++)
309 ElasticLineFluidInterfaceElement<ELEMENT>* el_pt =
310 dynamic_cast<ElasticLineFluidInterfaceElement<ELEMENT>*
> 311 (Surface_mesh_pt->element_pt(e));
320 el_pt->set_external_pressure_data(external_pressure_data_pt);
328 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
339 template <
class ELEMENT,
class TIMESTEPPER>
343 const unsigned n_node = mesh_pt()->nnode();
346 for(
unsigned n=0;n<n_node;n++)
349 for(
unsigned i=0;i<2;i++)
352 mesh_pt()->node_pt(n)->set_value(i,0.0);
358 assign_initial_values_impulsive();
369 template <
class ELEMENT,
class TIMESTEPPER>
376 for(
unsigned b=0;b<n_boundary;b++)
379 const unsigned n_node =
Bulk_mesh_pt->nboundary_node(b);
382 for(
unsigned n=0;n<n_node;n++)
406 template <
class ELEMENT,
class TIMESTEPPER>
414 for(
unsigned n=0;n<n_node;n++)
417 const double current_x_pos =
Bulk_mesh_pt->node_pt(n)->x(0);
418 const double current_y_pos =
Bulk_mesh_pt->node_pt(n)->x(1);
421 const double new_y_pos = current_y_pos
422 + (1.0-fabs(1.0-current_y_pos))*epsilon
423 *(cos(2.0*n_periods*MathematicalConstants::Pi*current_x_pos/
Lx));
435 template <
class ELEMENT,
class TIMESTEPPER>
440 cout <<
"Time is now " << time_pt()->time() << std::endl;
443 ElasticLineFluidInterfaceElement<ELEMENT>* el_pt =
444 dynamic_cast<ElasticLineFluidInterfaceElement<ELEMENT>*
> 450 << el_pt->node_pt(0)->x(1) << std::endl;
456 const unsigned npts = 5;
459 sprintf(filename,
"%s/soln%i.dat",
460 doc_info.directory().c_str(),doc_info.number());
461 some_file.open(filename);
470 sprintf(filename,
"%s/interface_soln%i.dat",
471 doc_info.directory().c_str(),doc_info.number());
472 some_file.open(filename);
487 template <
class ELEMENT,
class TIMESTEPPER>
493 const double epsilon = 0.1;
496 const unsigned n_periods = 1;
505 doc_info.set_directory(
"RESLT");
512 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
516 Trace_file <<
"time, free surface height" << std::endl;
525 const unsigned n_timestep = unsigned(t_max/dt);
534 for(
unsigned t=1;t<=n_timestep;t++)
537 cout <<
"\nTimestep " << t <<
" of " << n_timestep << std::endl;
540 unsteady_newton_solve(dt);
561 int main(
int argc,
char* argv[])
564 CommandLineArgs::setup(argc,argv);
574 const double dt = 0.0025;
577 if(CommandLineArgs::Argc>1) { t_max = 0.005; }
580 const unsigned n_x = 12;
583 const unsigned n_y = 12;
586 const double l_x = 1.0;
589 const double h = 1.0;
598 QPVDElement<2,3> > , BDF<2> >
599 problem(n_x,n_y,l_x,h);
double Lx
Width of domain.
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, computed automatically)
~InterfaceProblem()
Destructor (empty)
ElasticRectangularQuadMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the (specific) "bulk" mesh.
double Re
Reynolds number.
void actions_after_newton_solve()
No actions required after solve step.
void set_boundary_conditions()
Set boundary conditions.
void set_initial_condition()
Set initial conditions.
InterfaceProblem(const unsigned &n_x, const unsigned &n_y, const double &l_x, const double &h)
Constructor for single fluid free surface problem.
void unsteady_run(const double &t_max, const double &dt)
Do unsteady run up to maximum time t_max with given timestep dt.
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.
void actions_before_implicit_timestep()
Actions before the timestep: For maximum stability, reset the current nodal positions to be the "stre...
void doc_solution(DocInfo &doc_info)
Document the solution.
ConstitutiveLaw * Constitutive_law_pt
double Nu
Pseudo-solid Poisson ratio.
double Ca
Capillary number.
int main(int argc, char *argv[])
Driver code for two-dimensional single fluid free surface problem.