33 #include "navier_stokes.h"
36 #include "meshes/simple_rectangular_quadmesh.h"
40 using namespace oomph;
58 WavyWall(
const double& l,
const double& amplitude)
59 : GeomObject(1,2),
L(l),
A(amplitude) {}
62 void position(
const Vector<double>& zeta, Vector<double>& r)
const
65 r[1]=
A*(1.0-cos(2.0*MathematicalConstants::Pi*zeta[0]/
L));
88 template <
class ELEMENT>
103 GeomObject* substrate_pt,
104 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper);
110 typedef double (*HeightFctPt)(
const double& x);
115 return Height_fct_pt;
124 if (Height_fct_pt==0)
126 return Default_height;
130 return Height_fct_pt(x);
139 unsigned n_spine=nspine();
140 for (
unsigned i=0;i<n_spine;i++)
144 double x=spine_pt(i)->geom_parameter(0);
147 spine_pt(i)->height()=height_fct(x);
161 double w = spine_node_pt->fraction();
164 double h = spine_node_pt->spine_pt()->height();
167 Vector<double> x_spine_origin(1);
168 x_spine_origin[0]=spine_node_pt->spine_pt()->geom_parameter(0);
171 Vector<double> spine_base(2);
172 spine_node_pt->spine_pt()->geom_object_pt(0)->
173 position(x_spine_origin,spine_base);
176 spine_node_pt->x(0) = spine_base[0];
177 spine_node_pt->x(1) = spine_base[1]+w*h;
205 template<
class ELEMENT>
210 GeomObject* substrate_pt,
211 TimeStepper* time_stepper_pt) :
212 SimpleRectangularQuadMesh<ELEMENT>(nx,ny,lx,h,time_stepper_pt),
213 Default_height(h), Height_fct_pt(0), Substrate_pt(substrate_pt)
225 unsigned np =
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
228 unsigned nspine = (np-1)*nx+1;
229 Spine_pt.reserve(nspine);
233 double dx=lx/double(nx);
241 Spine* new_spine_pt=
new Spine(h);
242 Spine_pt.push_back(new_spine_pt);
245 SpineNode* nod_pt=element_node_pt(0,0);
248 nod_pt->spine_pt() = new_spine_pt;
251 nod_pt->fraction() = 0.0;
254 nod_pt->spine_mesh_pt() =
this;
257 nod_pt->node_update_fct_id()=0;
266 Vector<double> parameters(1);
272 new_spine_pt->set_geom_parameter(parameters);
278 Vector<GeomObject*> geom_object_pt(1);
282 new_spine_pt->set_geom_object_pt(geom_object_pt);
288 for(
unsigned i=0;i<ny;i++)
291 for(
unsigned l1=1;l1<np;l1++)
294 SpineNode* nod_pt=element_node_pt(i*nx,l1*np);
297 nod_pt->spine_pt() = new_spine_pt;
300 nod_pt->fraction()=(double(i)+double(l1)/double(np-1))/
double(ny);
303 nod_pt->spine_mesh_pt() =
this;
306 nod_pt->node_update_fct_id()=0;
316 for(
unsigned j=0;j<nx;j++)
321 for(
unsigned l2=1;l2<npmax;l2++)
324 new_spine_pt=
new Spine(h);
327 Spine_pt.push_back(new_spine_pt);
330 SpineNode* nod_pt=element_node_pt(j,l2);
333 nod_pt->spine_pt() = new_spine_pt;
336 nod_pt->fraction() = 0.0;
339 nod_pt->spine_mesh_pt() =
this;
342 nod_pt->node_update_fct_id()=0;
350 Vector<double> parameters(1);
353 parameters[0]=x_lo+double(j)*dx + double(l2)*dx/double(np-1);
356 new_spine_pt->set_geom_parameter(parameters);
361 Vector<GeomObject*> geom_object_pt(1);
365 new_spine_pt->set_geom_object_pt(geom_object_pt);
369 for(
unsigned i=0;i<ny;i++)
372 for(
unsigned l1=1;l1<np;l1++)
375 SpineNode* nod_pt=element_node_pt(i*nx+j,l1*np+l2);
378 nod_pt->spine_pt() = new_spine_pt;
381 nod_pt->fraction()=(double(i)+double(l1)/double(np-1))/
double(ny);
384 nod_pt->spine_mesh_pt() =
this;
387 nod_pt->node_update_fct_id()=0;
457 template<
class ELEMENT>
504 template<
class ELEMENT>
523 GeomObject* substrate_pt=
534 mesh_pt()->update_spine_heights();
537 mesh_pt()->node_update();
540 unsigned nspine=mesh_pt()->nspine();
541 for (
unsigned i=0;i<nspine;i++)
543 mesh_pt()->spine_pt(i)->spine_height_pt()->pin(0);
550 unsigned num_bound = mesh_pt()->nboundary();
551 for(
unsigned ibound=0;ibound<num_bound;ibound++)
553 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
554 for (
unsigned inod=0;inod<num_nod;inod++)
559 for (
unsigned i=0;i<2;i++)
561 mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
567 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
575 for (
unsigned ibound=0;ibound<num_bound-1;ibound++)
577 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
578 for (
unsigned inod=0;inod<num_nod;inod++)
582 for (
unsigned i=0;i<2;i++)
584 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
589 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
597 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
598 for (
unsigned inod=0;inod<num_nod;inod++)
600 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
602 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,y*(Ly-y));
603 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
610 unsigned n_element = mesh_pt()->nelement();
611 for(
unsigned e=0;e<n_element;e++)
614 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
620 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
630 template<
class ELEMENT>
641 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
643 some_file.open(filename);
644 mesh_pt()->output(some_file,npts);
659 doc_info.set_directory(
"RESLT");
669 problem.newton_solve();
688 problem.newton_solve();
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void doc_solution(DocInfo &doc_info)
Doc the solution.
ChannelSpineFlowProblem()
Constructor.
void actions_after_newton_solve()
Update the after solve (empty)
double Ly
Width of channel.
void actions_before_newton_solve()
Update the problem specs before solve. Update the nodal positions.
SimpleSpineMesh< ELEMENT > * mesh_pt()
Overload access to mesh.
~ChannelSpineFlowProblem()
Destructor: (empty)
////////////////////////////////////////////////////////////////////
void update_spine_heights()
Update the spine heights according to the function specified by height_fct_pt().
virtual void spine_node_update(SpineNode *spine_node_pt)
General node update function implements pure virtual function defined in SpineMesh base class and per...
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,...
double Default_height
Default height.
GeomObject * Substrate_pt
Pointer to GeomObject that specifies the "substrate" (the lower wall)
double height_fct(const double &x)
Height function – this is called by update_spine_heights() when spine heights are assigned.
HeightFctPt Height_fct_pt
Pointer to height function.
HeightFctPt & height_fct_pt()
Access function: Pointer to height function.
////////////////////////////////////////////////////////////////////
WavyWall(const double &l, const double &litude)
Constructor: Pass wavelength and amplitude.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position vector to wavy wall.
////////////////////////////////////////////////////////////////////
double L
Length of indented region.
double A
Amplitude of indentation.
double X_indent_start
Start of indented region.
double L_total
Total length of domain.
double height(const double &x)
Height of domain.
double Re
Reynolds number.
double H
Undeformed height of domain.
int main()
Driver for channel flow problem with spine mesh.