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++)
110 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,1.0);
113 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
117 unsigned num_bound = mesh_pt()->nboundary();
118 for(
unsigned ibound=1;ibound<num_bound;ibound++)
120 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
121 for (
unsigned inod=0;inod<num_nod;inod++)
123 for (
unsigned i=0;i<2;i++)
125 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
136 RefineableNavierStokesEquations<2>::
137 unpin_all_pressure_dofs(mesh_pt()->element_pt());
140 RefineableNavierStokesEquations<2>::
141 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
144 fix_pressure(0,0,0.0);
148 void doc_solution(DocInfo& doc_info);
157 const double &pvalue)
160 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
161 fix_pressure(pdof,pvalue);
171 template<
class ELEMENT>
173 NavierStokesEquations<2>::NavierStokesBodyForceFctPt body_force_fct_pt) :
174 Body_force_fct_pt(body_force_fct_pt)
181 double a_ellipse=1.0;
182 double b_ellipse=1.0;
185 GeomObject* Wall_pt=
new Ellipse(a_ellipse,b_ellipse);
189 double xi_hi=2.0*atan(1.0);
192 double fract_mid=0.5;
193 Problem::mesh_pt() =
new
194 RefineableQuarterCircleSectorMesh<ELEMENT>(
195 Wall_pt,xi_lo,fract_mid,xi_hi);
198 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
199 dynamic_cast<RefineableQuarterCircleSectorMesh<ELEMENT>*
>(
200 mesh_pt())->spatial_error_estimator_pt()=error_estimator_pt;
205 unsigned num_bound = mesh_pt()->nboundary();
206 for(
unsigned ibound=0;ibound<num_bound;ibound++)
208 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
209 for (
unsigned inod=0;inod<num_nod;inod++)
212 for (
unsigned i=0;i<2;i++)
214 mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
220 unsigned n_element = mesh_pt()->nelement();
225 for(
unsigned e=0;e<n_element;e++)
228 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
246 RefineableNavierStokesEquations<2>::
247 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
253 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
262 template<
class ELEMENT>
274 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
276 some_file.open(filename);
277 mesh_pt()->output(some_file,npts);
293 doc_info.set_directory(
"RESLT");
296 unsigned max_adapt=3;
306 NavierStokesEquations<2>::Gamma[0]=1;
307 NavierStokesEquations<2>::Gamma[1]=1;
315 problem.newton_solve(max_adapt);
335 NavierStokesEquations<2>::Gamma[0]=0;
336 NavierStokesEquations<2>::Gamma[1]=0;
344 problem.newton_solve(max_adapt);
int main()
Driver for QuarterCircleDrivenCavityProblem test problem.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
~QuarterCircleDrivenCavityProblem()
Destructor: Empty.
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 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 actions_before_newton_solve()
Update the problem specs before solve. (Re-)set velocity boundary conditions just to be on the safe s...
void actions_after_newton_solve()
Update the after solve (empty)
QuarterCircleDrivenCavityProblem(NavierStokesEquations< 2 >::NavierStokesBodyForceFctPt body_force_fct_pt)
Constructor.
Namespace for physical parameters.
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Functional body force.
void zero_body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Zero functional body force.
double Re_invFr
Reynolds/Froude number.
double Re
Reynolds number.
Vector< double > Gravity(2)
Gravity vector.