30 #include "navier_stokes.h"
33 #include "meshes/channel_with_leaflet_mesh.h"
36 using namespace oomph;
53 Leaflet(
const double& length,
const double& d_x,
const double& d_y,
54 const double& x_0,
const double& period, Time* time_pt)
55 : GeomObject(1,2), Length(length), D_x(d_x), D_y(d_y), X_0(x_0),
56 T(period),Time_pt(time_pt) {}
65 void position(
const unsigned& t,
const Vector<double>& xi,
66 Vector<double>& r)
const
68 using namespace MathematicalConstants;
71 r[0] = X_0 + D_x*xi[0]*xi[0]/Length/Length*sin(2.0*Pi*Time_pt->time(t)/T);
72 r[1] = xi[0]*(1.0+D_y/Length*0.5*(1.0-cos(4.0*Pi*Time_pt->time(t)/T)));
76 void position(
const Vector<double>& xi, Vector<double>& r)
const
88 double&
d_x() {
return D_x;}
91 double d_y() {
return D_y;}
94 double x_0() {
return X_0;}
146 template<
class ELEMENT>
162 const double& l_right,
const double& h_leaflet,
164 const unsigned& nleft,
const unsigned& nright,
165 const unsigned& ny1,
const unsigned& ny2,
166 const double& d_x,
const double& d_y,
167 const double& x_0,
const double& period);
173 RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
mesh_pt()
177 return dynamic_cast<RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
>(
188 void actions_after_adapt();
191 void actions_before_implicit_timestep();
194 void doc_solution(DocInfo& doc_info);
209 template <
class ELEMENT>
211 const double& l_left,
212 const double& l_right,
const double& h_leaflet,
214 const unsigned& nleft,
const unsigned& nright,
215 const unsigned& ny1,
const unsigned& ny2,
216 const double& d_x,
const double& d_y,
217 const double& x_0,
const double& period)
220 add_time_stepper_pt(
new BDF<2>);
223 Leaflet_pt =
new Leaflet(h_leaflet, d_x, d_y, x_0, period, time_pt()) ;
226 Problem::mesh_pt()=
new RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>(
236 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
237 dynamic_cast<RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
>(mesh_pt())->
238 spatial_error_estimator_pt()=error_estimator_pt;
243 unsigned n_element = mesh_pt()->nelement();
244 for(
unsigned e=0;e<n_element;e++)
247 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
261 unsigned num_bound = mesh_pt()->nboundary();
262 for(
unsigned ibound=0;ibound<num_bound;ibound++)
264 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
265 for (
unsigned inod=0;inod<num_nod;inod++)
267 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
271 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
278 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
279 for (
unsigned inod=0;inod<num_nod;inod++)
281 double ycoord = mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
282 double uy = 6.0*(ycoord/h_tot)*(1.0-(ycoord/h_tot));
284 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,uy);
285 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
289 RefineableNavierStokesEquations<2>::
290 pin_redundant_nodal_pressures(Problem::mesh_pt()->element_pt());
293 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
304 template <
class ELEMENT>
308 mesh_pt()->node_update();
312 for(
unsigned ibound=4;ibound<6;ibound++)
314 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
315 for (
unsigned inod=0;inod<num_nod;inod++)
318 Node* node_pt=mesh_pt()->boundary_node_pt(ibound,inod);
321 FSI_functions::apply_no_slip_on_moving_wall(node_pt);
331 template<
class ELEMENT>
335 RefineableNavierStokesEquations<2>::
336 unpin_all_pressure_dofs(mesh_pt()->element_pt());
339 RefineableNavierStokesEquations<2>::
340 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
349 template<
class ELEMENT>
361 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
363 some_file.open(filename);
364 mesh_pt()->output(some_file,npts);
368 sprintf(filename,
"%s/boundaries%i.dat",doc_info.directory().c_str(),
370 some_file.open(filename);
371 mesh_pt()->output_boundaries(some_file);
386 int main(
int argc,
char* argv[])
390 CommandLineArgs::setup(argc,argv);
394 doc_info.set_directory(
"RESLT");
401 double h_leaflet = 0.5;
412 double period = 20.0;
433 problem(l_left, l_right, h_leaflet,
434 h_tot,nleft, nright,ny1,ny2,
440 unsigned nsteps_per_period=40;
446 unsigned nstep=nsteps_per_period*nperiod;
447 if (CommandLineArgs::Argc>1)
453 double dt=period/double(nsteps_per_period);
456 problem.initialise_dt(dt);
460 unsigned max_adapt=5;
461 if (CommandLineArgs::Argc>1)
469 problem.steady_newton_solve(max_adapt);
483 for (
unsigned istep=0;istep<nstep;istep++)
486 problem.unsteady_newton_solve(dt,max_adapt,first);
int main(int argc, char *argv[])
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
RefineableAlgebraicChannelWithLeafletMesh< ELEMENT > * mesh_pt()
Overloaded access function to specific mesh.
void actions_after_newton_solve()
Update after solve (empty)
ChannelWithLeafletProblem(const double &l_left, const double &l_right, const double &h_leaflet, const double &h_tot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, const double &d_x, const double &d_y, const double &x_0, const double &period)
Constructor: Pass the length of the domain at the left of the leaflet lleft,the length of the domain ...
void actions_before_newton_solve()
Update before solve (empty)
~ChannelWithLeafletProblem()
Destructor (empty)
void actions_after_adapt()
Actions after adaptation: Pin redundant pressure dofs.
GeomObject * Leaflet_pt
Pointer to the GeomObject.
void actions_before_implicit_timestep()
Update the velocity boundary condition on the moving leaflet.
void doc_solution(DocInfo &doc_info)
Doc the solution.
GeomObject representing a vertical leaflet that performs bending and stretching oscillations.
void position(const Vector< double > &xi, Vector< double > &r) const
Steady version: Get current shape.
virtual ~Leaflet()
Destructor – emtpy.
double T
Period of the oscillations.
double D_x
Horizontal displacement of tip.
double & d_x()
Amplitude of horizontal tip displacement.
void position(const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
Position vector, r, to the point identified by its 1D Lagrangian coordinate, xi (passed as a 1D Vec...
double Length
Length in terms of Lagrangian coordinates.
double length()
Length of the leaflet.
double d_y()
Amplitude of vertical tip displacement.
unsigned ngeom_data() const
Number of geometric Data in GeomObject: None.
Time * Time_pt
Pointer to the global time object.
Leaflet(const double &length, const double &d_x, const double &d_y, const double &x_0, const double &period, Time *time_pt)
Constructor: Pass length (in Lagrangian coordinates), the amplitude of the horizontal and vertical de...
double x_0()
x-coordinate of leaflet origin
double D_y
Vertical displacement of tip.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
double Re
Reynolds number.