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;
74 template<
class ELEMENT>
99 set_boundary_conditions(time_pt()->time());
104 const double &pvalue)
107 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
108 fix_pressure(pdof,pvalue);
115 void set_boundary_conditions(
const double &time);
122 return dynamic_cast<RectangularQuadMesh<ELEMENT>*
>(
136 template<
class ELEMENT>
140 add_time_stepper_pt(
new BDF<2>);
143 Doc_info.set_directory(
"RESLT");
159 new RectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y,time_stepper_pt());
166 unsigned num_bound = mesh_pt()->nboundary();
167 for(
unsigned ibound=0;ibound<num_bound;ibound++)
174 if((ibound==1) || (ibound==3)) {val_max=1;}
177 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
178 for (
unsigned inod=0;inod<num_nod;inod++)
181 for(
unsigned j=0;j<val_max;j++)
183 mesh_pt()->boundary_node_pt(ibound,inod)->pin(j);
190 fix_pressure(0,0,0.0);
197 unsigned n_element = mesh_pt()->nelement();
198 for(
unsigned i=0;i<n_element;i++)
201 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
222 el_pt->disable_ALE();
226 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
236 template<
class ELEMENT>
241 unsigned num_bound = mesh_pt()->nboundary();
242 for(
unsigned ibound=0;ibound<num_bound;ibound++)
245 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
246 for(
unsigned inod=0;inod<num_nod;inod++)
249 Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
255 if((ibound==1) || (ibound==3)) {vel_max = 1;}
258 for(
unsigned j=0;j<vel_max;j++) {nod_pt->set_value(j,0.0);}
264 nod_pt->set_value(2,-0.5);
267 double epsilon = 0.01;
270 double x = nod_pt->x(0);
274 double value = sin(2.0*MathematicalConstants::Pi*x/3.0)*
275 epsilon*time*exp(-time);
276 nod_pt->set_value(1,value);
281 if(ibound==0) {nod_pt->set_value(2,0.5);}
289 template<
class ELEMENT>
301 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
303 some_file.open(filename);
304 mesh_pt()->output(some_file,npts);
314 int main(
int argc,
char **argv)
328 problem.steady_newton_solve();
337 problem.assign_initial_values_impulsive(dt);
340 unsigned n_steps = 200;
344 if(argc > 1) {n_steps = 5;}
347 for(
unsigned i=0;i<n_steps;++i)
349 problem.unsteady_newton_solve(dt);
int main(int argc, char **argv)
Driver code for 2D Boussinesq convection problem.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
ConvectionProblem()
Constructor.
void actions_before_newton_solve()
Update the problem specs before solve (empty)
void actions_before_implicit_timestep()
Actions before the timestep (update the the time-dependent boundary conditions)
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 set_boundary_conditions(const double &time)
Set the boundary conditions.
void actions_after_newton_solve()
Update the problem after solve (empty)
~ConvectionProblem()
Destructor. Empty.
void doc_solution()
Doc the solution.
void actions_before_adapt()
Actions before adapt:(empty)
RectangularQuadMesh< ELEMENT > * mesh_pt()
Overloaded version of the problem's access function to the mesh. Recasts the pointer to the base Mesh...
DocInfo Doc_info
DocInfo object.
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)