37 #include "navier_stokes.h" 40 #include "meshes/quarter_circle_sector_mesh.h" 44 using namespace oomph;
62 void body_force(
const double& time,
const Vector<double>& x,
63 Vector<double>& result)
71 Vector<double>& result)
87 template<
class ELEMENT>
95 NavierStokesEquations<2>::NavierStokesBodyForceFctPt body_force_fct_pt);
109 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
110 for (
unsigned inod=0;inod<num_nod;inod++)
114 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,1.0);
117 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
121 unsigned num_bound = mesh_pt()->nboundary();
122 for(
unsigned ibound=1;ibound<num_bound;ibound++)
124 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
125 for (
unsigned inod=0;inod<num_nod;inod++)
127 for (
unsigned i=0;i<2;i++)
129 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(i,0.0);
140 RefineableNavierStokesEquations<2>::
141 unpin_all_pressure_dofs(mesh_pt()->element_pt());
144 RefineableNavierStokesEquations<2>::
145 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
148 fix_pressure(0,0,0.0);
152 void doc_solution(DocInfo& doc_info);
161 const double &pvalue)
164 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
165 fix_pressure(pdof,pvalue);
175 template<
class ELEMENT>
177 NavierStokesEquations<2>::NavierStokesBodyForceFctPt body_force_fct_pt) :
178 Body_force_fct_pt(body_force_fct_pt)
185 double a_ellipse=1.0;
186 double b_ellipse=1.0;
189 GeomObject* Wall_pt=
new Ellipse(a_ellipse,b_ellipse);
193 double xi_hi=2.0*atan(1.0);
196 double fract_mid=0.5;
197 Problem::mesh_pt() =
new 198 RefineableQuarterCircleSectorMesh<ELEMENT>(
199 Wall_pt,xi_lo,fract_mid,xi_hi);
202 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
203 dynamic_cast<RefineableQuarterCircleSectorMesh<ELEMENT>*
>(
204 mesh_pt())->spatial_error_estimator_pt()=error_estimator_pt;
209 unsigned num_bound = mesh_pt()->nboundary();
210 for(
unsigned ibound=0;ibound<num_bound;ibound++)
212 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
213 for (
unsigned inod=0;inod<num_nod;inod++)
216 for (
unsigned i=0;i<2;i++)
218 mesh_pt()->boundary_node_pt(ibound,inod)->pin(i);
224 unsigned n_element = mesh_pt()->nelement();
229 for(
unsigned e=0;e<n_element;e++)
232 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
250 RefineableNavierStokesEquations<2>::
251 pin_redundant_nodal_pressures(mesh_pt()->element_pt());
257 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
266 template<
class ELEMENT>
278 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
280 some_file.open(filename);
281 mesh_pt()->output(some_file,npts);
297 doc_info.set_directory(
"RESLT");
300 unsigned max_adapt=3;
310 NavierStokesEquations<2>::Gamma[0]=1;
311 NavierStokesEquations<2>::Gamma[1]=1;
319 problem.newton_solve(max_adapt);
339 NavierStokesEquations<2>::Gamma[0]=0;
340 NavierStokesEquations<2>::Gamma[1]=0;
348 problem.newton_solve(max_adapt);
QuarterCircleDrivenCavityProblem(NavierStokesEquations< 2 >::NavierStokesBodyForceFctPt body_force_fct_pt)
Constructor.
Vector< double > Gravity(2)
Gravity vector.
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.
void actions_before_newton_solve()
Update the problem specs before solve. (Re-)set velocity boundary conditions just to be on the safe s...
~QuarterCircleDrivenCavityProblem()
Destructor: Empty.
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.
double Re
Reynolds number.
Namespace for physical parameters.
void doc_solution(DocInfo &doc_info)
Doc the solution.
int main()
Driver for QuarterCircleDrivenCavityProblem test problem.
double Re_invFr
Reynolds/Froude number.
void actions_after_newton_solve()
Update the after solve (empty)
void actions_after_adapt()
After adaptation: Unpin pressure and pin redudant pressure dofs.