37 #include "advection_diffusion.h" 38 #include "navier_stokes.h" 39 #include "multi_physics.h" 42 #include "meshes/rectangular_quadmesh.h" 45 using namespace oomph;
78 template<
class ELEMENT>
103 set_boundary_conditions(time_pt()->time());
108 const double &pvalue)
111 dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
112 fix_pressure(pdof,pvalue);
119 void set_boundary_conditions(
const double &time);
126 return dynamic_cast<RectangularQuadMesh<ELEMENT>*
>(
140 template<
class ELEMENT>
144 add_time_stepper_pt(
new BDF<2>);
147 Doc_info.set_directory(
"RESLT");
163 new RectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y,time_stepper_pt());
170 unsigned num_bound = mesh_pt()->nboundary();
171 for(
unsigned ibound=0;ibound<num_bound;ibound++)
178 if((ibound==1) || (ibound==3)) {val_max=1;}
181 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
182 for (
unsigned inod=0;inod<num_nod;inod++)
185 for(
unsigned j=0;j<val_max;j++)
187 mesh_pt()->boundary_node_pt(ibound,inod)->pin(j);
194 fix_pressure(0,0,0.0);
201 unsigned n_element = mesh_pt()->nelement();
202 for(
unsigned i=0;i<n_element;i++)
205 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
226 el_pt->disable_ALE();
230 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
240 template<
class ELEMENT>
245 unsigned num_bound = mesh_pt()->nboundary();
246 for(
unsigned ibound=0;ibound<num_bound;ibound++)
249 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
250 for(
unsigned inod=0;inod<num_nod;inod++)
253 Node* nod_pt=mesh_pt()->boundary_node_pt(ibound,inod);
259 if((ibound==1) || (ibound==3)) {vel_max = 1;}
262 for(
unsigned j=0;j<vel_max;j++) {nod_pt->set_value(j,0.0);}
268 nod_pt->set_value(2,-0.5);
271 double epsilon = 0.01;
274 double x = nod_pt->x(0);
278 double value = sin(2.0*MathematicalConstants::Pi*x/3.0)*
279 epsilon*time*exp(-time);
280 nod_pt->set_value(1,value);
285 if(ibound==0) {nod_pt->set_value(2,0.5);}
293 template<
class ELEMENT>
305 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
307 some_file.open(filename);
308 mesh_pt()->output(some_file,npts);
318 int main(
int argc,
char **argv)
332 problem.steady_newton_solve();
341 problem.assign_initial_values_impulsive(dt);
344 unsigned n_steps = 200;
348 if(argc > 1) {n_steps = 5;}
351 for(
unsigned i=0;i<n_steps;++i)
353 problem.unsteady_newton_solve(dt);
void doc_solution()
Doc the solution.
double Peclet
Peclet number (identically one from our non-dimensionalisation)
void actions_before_newton_solve()
Update the problem specs before solve (empty)
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...
ConvectionProblem()
Constructor.
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.
~ConvectionProblem()
Destructor. Empty.
Namespace for the physical parameters in the problem.
DocInfo Doc_info
DocInfo object.
int main(int argc, char **argv)
Driver code for 2D Boussinesq convection problem.
Vector< double > Direction_of_gravity(2)
Gravity vector.
void actions_after_newton_solve()
Update the problem after solve (empty)
double Inverse_Prandtl
1/Prandtl number
void actions_before_implicit_timestep()
Actions before the timestep (update the the time-dependent boundary conditions)
double Rayleigh
Rayleigh number, set to be greater than the threshold for linear instability.
void set_boundary_conditions(const double &time)
Set the boundary conditions.