33 #include "navier_stokes.h"
36 #include "meshes/quarter_circle_sector_mesh.h"
40 using namespace oomph;
58 void body_force(
const double& time,
const Vector<double>& x,
59 Vector<double>& result)
67 Vector<double>& result)
83 template<
class ELEMENT>
91 NavierStokesEquations<2>::NavierStokesBodyForceFctPt body_force_fct_pt);
105 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
106 for (
unsigned inod=0;inod<num_nod;inod++)
109 double x=mesh_pt()->boundary_node_pt(ibound,inod)->x(0);
110 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
119 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,-sin(zeta));
122 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,cos(zeta));
126 unsigned num_bound = mesh_pt()->nboundary();
127 for(
unsigned ibound=0;ibound<num_bound;ibound++)
131 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
132 for (
unsigned inod=0;inod<num_nod;inod++)
134 for (
unsigned i=0;i<2;i++)
136 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
149 RefineableNavierStokesEquations<2>::
150 unpin_all_pressure_dofs(mesh_pt()->element_pt());
153 RefineableNavierStokesEquations<2>::
154 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
157 fix_pressure(0,0,0.0);
161 void doc_solution(DocInfo& doc_info);
170 const double &pvalue)
173 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
174 fix_pressure(pdof,pvalue);
184 template<
class ELEMENT>
186 NavierStokesEquations<2>::NavierStokesBodyForceFctPt body_force_fct_pt) :
187 Body_force_fct_pt(body_force_fct_pt)
194 double a_ellipse=1.0;
195 double b_ellipse=1.0;
198 GeomObject* Wall_pt=
new Ellipse(a_ellipse,b_ellipse);
202 double xi_hi=2.0*atan(1.0);
205 double fract_mid=0.5;
206 Problem::mesh_pt() =
new
207 RefineableQuarterCircleSectorMesh<ELEMENT>(
208 Wall_pt,xi_lo,fract_mid,xi_hi);
211 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
212 dynamic_cast<RefineableQuarterCircleSectorMesh<ELEMENT>*
>(
213 mesh_pt())->spatial_error_estimator_pt()=error_estimator_pt;
218 unsigned num_bound = mesh_pt()->nboundary();
219 for(
unsigned ibound=0;ibound<num_bound;ibound++)
221 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
222 for (
unsigned inod=0;inod<num_nod;inod++)
225 for (
unsigned i=0;i<2;i++)
227 mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
233 unsigned n_element = mesh_pt()->nelement();
238 for(
unsigned e=0;e<n_element;e++)
241 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
259 RefineableNavierStokesEquations<2>::
260 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
266 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
275 template<
class ELEMENT>
287 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
289 some_file.open(filename);
290 mesh_pt()->output(some_file,npts);
306 doc_info.set_directory(
"RESLT2");
309 unsigned max_adapt=3;
319 NavierStokesEquations<2>::Gamma[0]=1;
320 NavierStokesEquations<2>::Gamma[1]=1;
328 problem.newton_solve(max_adapt);
348 NavierStokesEquations<2>::Gamma[0]=0;
349 NavierStokesEquations<2>::Gamma[1]=0;
357 problem.newton_solve(max_adapt);
int main()
Driver for QuarterCircleDrivenCavityProblem2 test problem.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
void actions_after_newton_solve()
Update the after solve (empty)
QuarterCircleDrivenCavityProblem2(NavierStokesEquations< 2 >::NavierStokesBodyForceFctPt body_force_fct_pt)
Constructor.
void doc_solution(DocInfo &doc_info)
Doc the solution.
void actions_after_adapt()
After adaptation: Unpin pressure and pin redudant pressure dofs.
NavierStokesEquations< 2 >::NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
void fix_pressure(const unsigned &e, const unsigned &pdof, const double &pvalue)
Fix pressure in element e at pressure dof pdof and set to pvalue.
void actions_before_newton_solve()
Update the problem specs before solve. (Re-)set velocity boundary conditions just to be on the safe s...
~QuarterCircleDrivenCavityProblem2()
Destructor: Empty.
Namespace for physical parameters.
double Re_invFr
Reynolds/Froude number.
Vector< double > Gravity(2)
Gravity vector.
void zero_body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Zero functional body force.
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Functional body force.
double Re
Reynolds number.