34 #include "navier_stokes.h" 37 #include "meshes/channel_with_leaflet_mesh.h" 40 using namespace oomph;
57 Leaflet(
const double& length,
const double& d_x,
const double& d_y,
58 const double& x_0,
const double& period, Time* time_pt)
59 : GeomObject(1,2), Length(length), D_x(d_x), D_y(d_y), X_0(x_0),
60 T(period),Time_pt(time_pt) {}
69 void position(
const unsigned& t,
const Vector<double>& xi,
70 Vector<double>& r)
const 72 using namespace MathematicalConstants;
75 r[0] = X_0 + D_x*xi[0]*xi[0]/Length/Length*sin(2.0*Pi*Time_pt->time(t)/T);
76 r[1] = xi[0]*(1.0+D_y/Length*0.5*(1.0-cos(4.0*Pi*Time_pt->time(t)/T)));
80 void position(
const Vector<double>& xi, Vector<double>& r)
const 92 double&
d_x() {
return D_x;}
95 double d_y() {
return D_y;}
98 double x_0() {
return X_0;}
150 template<
class ELEMENT>
166 const double& l_right,
const double& h_leaflet,
168 const unsigned& nleft,
const unsigned& nright,
169 const unsigned& ny1,
const unsigned& ny2,
170 const double& d_x,
const double& d_y,
171 const double& x_0,
const double& period);
177 RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
mesh_pt()
181 return dynamic_cast<RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
>(
192 void actions_after_adapt();
195 void actions_before_implicit_timestep();
198 void doc_solution(DocInfo& doc_info);
213 template <
class ELEMENT>
215 const double& l_left,
216 const double& l_right,
const double& h_leaflet,
218 const unsigned& nleft,
const unsigned& nright,
219 const unsigned& ny1,
const unsigned& ny2,
220 const double& d_x,
const double& d_y,
221 const double& x_0,
const double& period)
224 add_time_stepper_pt(
new BDF<2>);
227 Leaflet_pt =
new Leaflet(h_leaflet, d_x, d_y, x_0, period, time_pt()) ;
230 Problem::mesh_pt()=
new RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>(
240 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
241 dynamic_cast<RefineableAlgebraicChannelWithLeafletMesh<ELEMENT>*
>(mesh_pt())->
242 spatial_error_estimator_pt()=error_estimator_pt;
247 unsigned n_element = mesh_pt()->nelement();
248 for(
unsigned e=0;e<n_element;e++)
251 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
265 unsigned num_bound = mesh_pt()->nboundary();
266 for(
unsigned ibound=0;ibound<num_bound;ibound++)
268 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
269 for (
unsigned inod=0;inod<num_nod;inod++)
271 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
275 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
282 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
283 for (
unsigned inod=0;inod<num_nod;inod++)
285 double ycoord = mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
286 double uy = 6.0*(ycoord/h_tot)*(1.0-(ycoord/h_tot));
288 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,uy);
289 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
293 RefineableNavierStokesEquations<2>::
294 pin_redundant_nodal_pressures(Problem::mesh_pt()->element_pt());
297 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
308 template <
class ELEMENT>
312 mesh_pt()->node_update();
316 for(
unsigned ibound=4;ibound<6;ibound++)
318 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
319 for (
unsigned inod=0;inod<num_nod;inod++)
322 Node* node_pt=mesh_pt()->boundary_node_pt(ibound,inod);
325 FSI_functions::apply_no_slip_on_moving_wall(node_pt);
335 template<
class ELEMENT>
339 RefineableNavierStokesEquations<2>::
340 unpin_all_pressure_dofs(mesh_pt()->element_pt());
343 RefineableNavierStokesEquations<2>::
344 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
353 template<
class ELEMENT>
365 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
367 some_file.open(filename);
368 mesh_pt()->output(some_file,npts);
372 sprintf(filename,
"%s/boundaries%i.dat",doc_info.directory().c_str(),
374 some_file.open(filename);
375 mesh_pt()->output_boundaries(some_file);
390 int main(
int argc,
char* argv[])
394 CommandLineArgs::setup(argc,argv);
398 doc_info.set_directory(
"RESLT");
405 double h_leaflet = 0.5;
416 double period = 20.0;
437 problem(l_left, l_right, h_leaflet,
438 h_tot,nleft, nright,ny1,ny2,
444 unsigned nsteps_per_period=40;
450 unsigned nstep=nsteps_per_period*nperiod;
451 if (CommandLineArgs::Argc>1)
457 double dt=period/double(nsteps_per_period);
460 problem.initialise_dt(dt);
464 unsigned max_adapt=5;
465 if (CommandLineArgs::Argc>1)
473 problem.steady_newton_solve(max_adapt);
487 for (
unsigned istep=0;istep<nstep;istep++)
490 problem.unsteady_newton_solve(dt,max_adapt,first);
void actions_before_implicit_timestep()
Update the velocity boundary condition on the moving leaflet.
void position(const Vector< double > &xi, Vector< double > &r) const
Steady version: Get current shape.
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.
double D_x
Horizontal displacement of tip.
void actions_before_newton_solve()
Update before solve (empty)
double x_0()
x-coordinate of leaflet origin
double T
Period of the oscillations.
void doc_solution(DocInfo &doc_info)
Doc the solution.
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...
int main(int argc, char *argv[])
double Length
Length in terms of Lagrangian coordinates.
double D_y
Vertical displacement of tip.
double & d_x()
Amplitude of horizontal tip displacement.
double Re
Reynolds number.
virtual ~Leaflet()
Destructor – emtpy.
void actions_after_newton_solve()
Update after solve (empty)
GeomObject * Leaflet_pt
Pointer to the GeomObject.
void actions_after_adapt()
Actions after adaptation: Pin redundant pressure dofs.
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 Vecto...
~ChannelWithLeafletProblem()
Destructor (empty)
unsigned ngeom_data() const
Number of geometric Data in GeomObject: None.
RefineableAlgebraicChannelWithLeafletMesh< ELEMENT > * mesh_pt()
Overloaded access function to specific mesh.
double d_y()
Amplitude of vertical tip displacement.
Time * Time_pt
Pointer to the global time object.
double length()
Length of the leaflet.