33 #include "advection_diffusion.h"
34 #include "navier_stokes.h"
35 #include "multi_physics.h"
38 #include "meshes/rectangular_quadmesh.h"
41 using namespace oomph;
83 template<
class ELEMENT>
106 return dynamic_cast<RectangularQuadMesh<ELEMENT>*
>(
118 RefineableNavierStokesEquations<2>::
119 unpin_all_pressure_dofs(mesh_pt()->element_pt());
123 fix_pressure(0,0,0.0);
128 const double &pvalue)
131 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
132 fix_pressure(pdof,pvalue);
161 template<
class ELEMENT>
181 RefineableRectangularQuadMesh<ELEMENT>* cast_mesh_pt =
182 new RefineableRectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y);
185 Problem::mesh_pt() = cast_mesh_pt;
189 cast_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
192 cast_mesh_pt->max_permitted_error()=0.5e-3;
193 cast_mesh_pt->min_permitted_error()=0.5e-4;
201 unsigned num_bound =
mesh_pt()->nboundary();
202 for(
unsigned ibound=0;ibound<num_bound;ibound++)
209 if((ibound==1) || (ibound==3)) {val_max=1;}
212 unsigned num_nod=
mesh_pt()->nboundary_node(ibound);
213 for (
unsigned inod=0;inod<num_nod;inod++)
216 for(
unsigned j=0;j<val_max;j++)
218 mesh_pt()->boundary_node_pt(ibound,inod)->pin(j);
232 unsigned n_element =
mesh_pt()->nelement();
233 for(
unsigned i=0;i<n_element;i++)
236 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
mesh_pt()->element_pt(i));
258 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
267 template<
class ELEMENT>
271 unsigned num_bound = mesh_pt()->nboundary();
272 for(
unsigned ibound=0;ibound<num_bound;ibound++)
275 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
276 for(
unsigned inod=0;inod<num_nod;inod++)
279 Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
284 if((ibound==1) || (ibound==3)) {vel_max = 1;}
286 for(
unsigned j=0;j<vel_max;j++) {nod_pt->set_value(j,0.0);}
292 nod_pt->set_value(2,-0.5);
297 double x = nod_pt->x(0);
300 double value = sin(2.0*3.141592654*x/3.0);
301 nod_pt->set_value(1,value);
307 if(ibound==0) {nod_pt->set_value(2,0.5);}
318 template<
class ELEMENT>
330 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
332 some_file.open(filename);
333 mesh_pt()->output(some_file,npts);
357 problem.enable_imperfection();
360 problem.newton_solve(2);
363 problem.doc_solution();
370 problem.disable_imperfection();
371 problem.newton_solve(2);
372 problem.doc_solution();
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
void actions_after_newton_solve()
Update the problem after solve (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.
~RefineableConvectionProblem()
Destructor. Empty.
void doc_solution()
Doc the solution.
void actions_before_newton_solve()
Update the problem specs before solve:
void disable_imperfection()
Set the boundary condition on the upper wall to be unperturbed.
RectangularQuadMesh< ELEMENT > * mesh_pt()
Overloaded version of the problem's access function to the mesh. Recasts the pointer to the base Mesh...
void doc_solution()
Doc the solution.
void actions_before_adapt()
Actions before adapt:(empty)
RefineableConvectionProblem()
Constructor.
void actions_after_adapt()
Actions after adaptation, Re-pin a single pressure degree of freedom.
RefineableConvectionProblem()
Constructor.
void enable_imperfection()
Set the boundary condition on the upper wall to be perturbed slightly to force the solution into the ...
DocInfo Doc_info
DocInfo object.
void actions_before_newton_solve()
Update the problem specs before solve:
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Namespace for the physical parameters in the problem.
Vector< double > Direction_of_gravity(2)
Gravity vector.
double Rayleigh
Rayleigh number, set to be greater than the threshold for linear instability.
double Inverse_Prandtl
1/Prandtl number
double Peclet
Peclet number (identically one from our non-dimensionalisation)
int main()
Driver code for 2D Boussinesq convection problem with adaptivity.