37 #include "navier_stokes.h" 40 #include "meshes/simple_rectangular_quadmesh.h" 44 using namespace oomph;
62 WavyWall(
const double& l,
const double& amplitude)
63 : GeomObject(1,2),
L(l),
A(amplitude) {}
66 void position(
const Vector<double>& zeta, Vector<double>& r)
const 69 r[1]=
A*(1.0-cos(2.0*MathematicalConstants::Pi*zeta[0]/
L));
92 template <
class ELEMENT>
107 GeomObject* substrate_pt,
108 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper);
114 typedef double (*HeightFctPt)(
const double& x);
119 return Height_fct_pt;
128 if (Height_fct_pt==0)
130 return Default_height;
134 return Height_fct_pt(x);
143 unsigned n_spine=nspine();
144 for (
unsigned i=0;i<n_spine;i++)
148 double x=spine_pt(i)->geom_parameter(0);
151 spine_pt(i)->height()=height_fct(x);
165 double w = spine_node_pt->fraction();
168 double h = spine_node_pt->spine_pt()->height();
171 Vector<double> x_spine_origin(1);
172 x_spine_origin[0]=spine_node_pt->spine_pt()->geom_parameter(0);
175 Vector<double> spine_base(2);
176 spine_node_pt->spine_pt()->geom_object_pt(0)->
177 position(x_spine_origin,spine_base);
180 spine_node_pt->x(0) = spine_base[0];
181 spine_node_pt->x(1) = spine_base[1]+w*h;
209 template<
class ELEMENT>
214 GeomObject* substrate_pt,
215 TimeStepper* time_stepper_pt) :
216 SimpleRectangularQuadMesh<ELEMENT>(nx,ny,lx,h,time_stepper_pt),
217 Default_height(h), Height_fct_pt(0), Substrate_pt(substrate_pt)
229 unsigned np =
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
232 unsigned nspine = (np-1)*nx+1;
233 Spine_pt.reserve(nspine);
237 double dx=lx/double(nx);
245 Spine* new_spine_pt=
new Spine(h);
246 Spine_pt.push_back(new_spine_pt);
249 SpineNode* nod_pt=element_node_pt(0,0);
252 nod_pt->spine_pt() = new_spine_pt;
255 nod_pt->fraction() = 0.0;
258 nod_pt->spine_mesh_pt() =
this;
261 nod_pt->node_update_fct_id()=0;
270 Vector<double> parameters(1);
276 new_spine_pt->set_geom_parameter(parameters);
282 Vector<GeomObject*> geom_object_pt(1);
286 new_spine_pt->set_geom_object_pt(geom_object_pt);
292 for(
unsigned i=0;i<ny;i++)
295 for(
unsigned l1=1;l1<np;l1++)
298 SpineNode* nod_pt=element_node_pt(i*nx,l1*np);
301 nod_pt->spine_pt() = new_spine_pt;
304 nod_pt->fraction()=(double(i)+double(l1)/double(np-1))/
double(ny);
307 nod_pt->spine_mesh_pt() =
this;
310 nod_pt->node_update_fct_id()=0;
320 for(
unsigned j=0;j<nx;j++)
325 for(
unsigned l2=1;l2<npmax;l2++)
328 new_spine_pt=
new Spine(h);
331 Spine_pt.push_back(new_spine_pt);
334 SpineNode* nod_pt=element_node_pt(j,l2);
337 nod_pt->spine_pt() = new_spine_pt;
340 nod_pt->fraction() = 0.0;
343 nod_pt->spine_mesh_pt() =
this;
346 nod_pt->node_update_fct_id()=0;
354 Vector<double> parameters(1);
357 parameters[0]=x_lo+double(j)*dx + double(l2)*dx/double(np-1);
360 new_spine_pt->set_geom_parameter(parameters);
365 Vector<GeomObject*> geom_object_pt(1);
369 new_spine_pt->set_geom_object_pt(geom_object_pt);
373 for(
unsigned i=0;i<ny;i++)
376 for(
unsigned l1=1;l1<np;l1++)
379 SpineNode* nod_pt=element_node_pt(i*nx+j,l1*np+l2);
382 nod_pt->spine_pt() = new_spine_pt;
385 nod_pt->fraction()=(double(i)+double(l1)/double(np-1))/
double(ny);
388 nod_pt->spine_mesh_pt() =
this;
391 nod_pt->node_update_fct_id()=0;
435 if ((x>X_indent_start)&&(x<(X_indent_start+L)))
437 return H + A*sin(MathematicalConstants::Pi*(x-X_indent_start)/L);
461 template<
class ELEMENT>
478 mesh_pt()->node_update();
486 void doc_solution(DocInfo& doc_info);
508 template<
class ELEMENT>
527 GeomObject* substrate_pt=
538 mesh_pt()->update_spine_heights();
541 mesh_pt()->node_update();
544 unsigned nspine=mesh_pt()->nspine();
545 for (
unsigned i=0;i<nspine;i++)
547 mesh_pt()->spine_pt(i)->spine_height_pt()->pin(0);
554 unsigned num_bound = mesh_pt()->nboundary();
555 for(
unsigned ibound=0;ibound<num_bound;ibound++)
557 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
558 for (
unsigned inod=0;inod<num_nod;inod++)
563 for (
unsigned i=0;i<2;i++)
565 mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
571 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
579 for (
unsigned ibound=0;ibound<num_bound-1;ibound++)
581 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
582 for (
unsigned inod=0;inod<num_nod;inod++)
586 for (
unsigned i=0;i<2;i++)
588 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
593 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
601 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
602 for (
unsigned inod=0;inod<num_nod;inod++)
604 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
606 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,y*(Ly-y));
607 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
614 unsigned n_element = mesh_pt()->nelement();
615 for(
unsigned e=0;e<n_element;e++)
618 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
624 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
634 template<
class ELEMENT>
645 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
647 some_file.open(filename);
648 mesh_pt()->output(some_file,npts);
663 doc_info.set_directory(
"RESLT");
673 problem.newton_solve();
692 problem.newton_solve();
void position(const Vector< double > &zeta, Vector< double > &r) const
Position vector to wavy wall.
SimpleSpineMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &h, GeomObject *substrate_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction, number of elements in y-direction, length in x direction, initial height of mesh, and pointer to timestepper (defaults to Steady timestepper)
void doc_solution(DocInfo &doc_info)
Doc the solution.
double height(const double &x)
Height of domain.
virtual void spine_node_update(SpineNode *spine_node_pt)
General node update function implements pure virtual function defined in SpineMesh base class and per...
void actions_after_newton_solve()
Update the after solve (empty)
GeomObject * Substrate_pt
Pointer to GeomObject that specifies the "substrate" (the lower wall)
HeightFctPt & height_fct_pt()
Access function: Pointer to height function.
ChannelSpineFlowProblem()
Constructor.
double Default_height
Default height.
HeightFctPt Height_fct_pt
Pointer to height function.
double Ly
Width of channel.
double L
Length of indented region.
~ChannelSpineFlowProblem()
Destructor: (empty)
double Re
Reynolds number.
double height_fct(const double &x)
Height function – this is called by update_spine_heights() when spine heights are assigned...
double L_total
Total length of domain.
Namespace for physical parameters.
double H
Undeformed height of domain.
void update_spine_heights()
Update the spine heights according to the function specified by height_fct_pt().
double X_indent_start
Start of indented region.
int main()
Driver for channel flow problem with spine mesh.
WavyWall(const double &l, const double &litude)
Constructor: Pass wavelength and amplitude.
void actions_before_newton_solve()
Update the problem specs before solve. Update the nodal positions.
double A
Amplitude of indentation.
SimpleSpineMesh< ELEMENT > * mesh_pt()
Overload access to mesh.