36 #include "advection_diffusion.h" 37 #include "navier_stokes.h" 38 #include "multi_physics.h" 42 #include "meshes/rectangular_quadmesh.h" 45 using namespace oomph;
83 template<
class NST_ELEMENT,
class AD_ELEMENT>
96 void actions_before_newton_solve();
106 return dynamic_cast<RefineableRectangularQuadMesh<NST_ELEMENT>*
> 115 return dynamic_cast<RefineableRectangularQuadMesh<AD_ELEMENT>*
> 127 RefineableNavierStokesEquations<2>::
128 unpin_all_pressure_dofs(nst_mesh_pt()->element_pt());
132 fix_pressure(0,0,0.0);
135 Multi_domain_functions::
136 setup_multi_domain_interactions<NST_ELEMENT,AD_ELEMENT>
137 (
this,nst_mesh_pt(),adv_diff_mesh_pt());
144 const double &pvalue)
147 if (nst_mesh_pt()->nelement()>0)
149 dynamic_cast<NST_ELEMENT*
>(nst_mesh_pt()->element_pt(e))->
150 fix_pressure(pdof,pvalue);
189 template<
class NST_ELEMENT,
class AD_ELEMENT>
194 Doc_info.set_directory(
"RESLT");
210 new RefineableRectangularQuadMesh<NST_ELEMENT>(n_x,n_y,l_x,l_y);
212 new RefineableRectangularQuadMesh<AD_ELEMENT>(n_x,n_y,l_x,l_y);
215 Nst_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
216 Adv_diff_mesh_pt->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
219 Nst_mesh_pt->max_permitted_error()=0.5e-3;
220 Nst_mesh_pt->min_permitted_error()=0.5e-4;
221 Adv_diff_mesh_pt->max_permitted_error()=0.5e-3;
222 Adv_diff_mesh_pt->min_permitted_error()=0.5e-4;
230 unsigned num_bound = nst_mesh_pt()->nboundary();
231 for(
unsigned ibound=0;ibound<num_bound;ibound++)
237 unsigned num_nod= nst_mesh_pt()->nboundary_node(ibound);
238 for (
unsigned inod=0;inod<num_nod;inod++)
244 if((ibound==1) || (ibound==3))
250 val_max=nst_mesh_pt()->boundary_node_pt(ibound,inod)->nvalue();
254 for(
unsigned j=0;j<val_max;j++)
256 nst_mesh_pt()->boundary_node_pt(ibound,inod)->pin(j);
263 fix_pressure(0,0,0.0);
266 num_bound = adv_diff_mesh_pt()->nboundary();
267 for(
unsigned ibound=0;ibound<num_bound;ibound++)
273 unsigned num_nod= adv_diff_mesh_pt()->nboundary_node(ibound);
274 for (
unsigned inod=0;inod<num_nod;inod++)
279 if ((ibound==1) || (ibound==3))
285 val_max=adv_diff_mesh_pt()->boundary_node_pt(ibound,inod)->nvalue();
287 for(
unsigned j=0;j<val_max;j++)
289 adv_diff_mesh_pt()->boundary_node_pt(ibound,inod)->pin(j);
300 unsigned n_nst_element = nst_mesh_pt()->nelement();
301 for(
unsigned i=0;i<n_nst_element;i++)
304 NST_ELEMENT *el_pt =
dynamic_cast<NST_ELEMENT*
> 305 (nst_mesh_pt()->element_pt(i));
323 el_pt->ignore_external_geometric_data();
326 unsigned n_ad_element = adv_diff_mesh_pt()->nelement();
327 for(
unsigned i=0;i<n_ad_element;i++)
330 AD_ELEMENT *el_pt =
dynamic_cast<AD_ELEMENT*
> 331 (adv_diff_mesh_pt()->element_pt(i));
343 el_pt->ignore_external_geometric_data();
348 add_sub_mesh(Nst_mesh_pt);
349 add_sub_mesh(Adv_diff_mesh_pt);
353 Multi_domain_functions::
354 setup_multi_domain_interactions<NST_ELEMENT,AD_ELEMENT>
355 (
this,nst_mesh_pt(),adv_diff_mesh_pt());
358 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
367 template<
class NST_ELEMENT,
class AD_ELEMENT>
371 unsigned num_bound = nst_mesh_pt()->nboundary();
372 for(
unsigned ibound=0;ibound<num_bound;ibound++)
375 unsigned num_nod=nst_mesh_pt()->nboundary_node(ibound);
376 for(
unsigned inod=0;inod<num_nod;inod++)
379 Node* nod_pt=nst_mesh_pt()->boundary_node_pt(ibound,inod);
384 if((ibound==1) || (ibound==3)) {vel_max = 1;}
386 for(
unsigned j=0;j<vel_max;j++) {nod_pt->set_value(j,0.0);}
395 double x = nod_pt->x(0);
398 double value = sin(2.0*3.141592654*x/3.0);
399 nod_pt->set_value(1,value);
407 num_bound=adv_diff_mesh_pt()->nboundary();
408 for(
unsigned ibound=0;ibound<num_bound;ibound++)
411 unsigned num_nod=adv_diff_mesh_pt()->nboundary_node(ibound);
412 for(
unsigned inod=0;inod<num_nod;inod++)
415 Node* nod_pt=adv_diff_mesh_pt()->boundary_node_pt(ibound,inod);
419 if(ibound==2) {nod_pt->set_value(0,-0.5);}
423 if(ibound==0) {nod_pt->set_value(0,0.5);}
435 template<
class NST_ELEMENT,
class AD_ELEMENT>
446 sprintf(filename,
"%s/fluid_soln%i.dat",Doc_info.directory().c_str(),
448 some_file.open(filename);
449 nst_mesh_pt()->output(some_file,npts);
453 sprintf(filename,
"%s/temperature_soln%i.dat",Doc_info.directory().c_str(),
455 some_file.open(filename);
456 adv_diff_mesh_pt()->output(some_file,npts);
479 RefineableQCrouzeixRaviartElement<2>,
480 RefineableQAdvectionDiffusionElement<2,3> > ,
482 RefineableQAdvectionDiffusionElement<2,3>,
483 RefineableQCrouzeixRaviartElement<2> >
488 problem.enable_imperfection();
491 problem.newton_solve(2);
494 problem.doc_solution();
501 problem.disable_imperfection();
502 problem.newton_solve(2);
503 problem.doc_solution();
~RefineableConvectionProblem()
Destructor. Empty.
void actions_after_adapt()
Actions after adaptation, reset all sources, then re-pin a single pressure degree of freedom...
bool Imperfect
Is the boundary condition imperfect or not.
double Peclet
Peclet number (identically one from our non-dimensionalisation)
RefineableRectangularQuadMesh< AD_ELEMENT > * Adv_diff_mesh_pt
Advection diffusion mesh.
void actions_after_newton_solve()
Update the problem after solve (empty)
DocInfo Doc_info
DocInfo object.
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.
RefineableRectangularQuadMesh< AD_ELEMENT > * adv_diff_mesh_pt()
Access function to the AD mesh. Casts the pointer to the base Mesh object to the actual mesh type...
void doc_solution()
Doc the solution.
void actions_before_adapt()
Actions before adapt:(empty)
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.
RefineableConvectionProblem()
Constructor.
RefineableRectangularQuadMesh< NST_ELEMENT > * Nst_mesh_pt
Navier Stokes mesh.
void enable_imperfection()
Set the boundary condition on the upper wall to be perturbed slightly to force the solution into the ...
double Inverse_Prandtl
1/Prandtl number
void disable_imperfection()
Set th boundary condition on the upper wall to be unperturbed.
double Rayleigh
Rayleigh number, set to be greater than the threshold for linear instability.
RefineableRectangularQuadMesh< NST_ELEMENT > * nst_mesh_pt()
Access function to the NST mesh. Casts the pointer to the base Mesh object to the actual mesh type...