steady_axisym_advection_diffusion.cc File Reference

Classes

class  TwoMeshFluxSteadyAxisymAdvectionDiffusionProblem< ELEMENT >
 

Namespaces

 TanhSolnForSteadyAxisymAdvectionDiffusion
 

Functions

Exact solution as a Vector void TanhSolnForSteadyAxisymAdvectionDiffusion::get_exact_u (const Vector< double > &x, Vector< double > &u)
 
Exact solution as a scalar void TanhSolnForSteadyAxisymAdvectionDiffusion::get_exact_u (const Vector< double > &x, double &u)
 
Source function required to make the solution above an exact solution void TanhSolnForSteadyAxisymAdvectionDiffusion::source_function (const Vector< double > &x_vect, double &source)
 
Beta required by the exact solution on a boundary on which r is fixed void TanhSolnForSteadyAxisymAdvectionDiffusion::prescribed_beta_on_fixed_r_boundary (const Vector< double > &x_vect, double &beta)
 
Alfa required by the exact solution on a boundary on which r is fixed void TanhSolnForSteadyAxisymAdvectionDiffusion::prescribed_alpha_on_fixed_r_boundary (const Vector< double > &x_vect, double &alpha)
 
Wind void TanhSolnForSteadyAxisymAdvectionDiffusion::wind_function (const Vector< double > &x, Vector< double > &wind)
 
Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt Wind_fct_pt (wind_fct_pt)
 
 for (unsigned ibound=0;ibound< num_bound-1;ibound++)
 
Driver code for SteadyAxisymAdvectionDiffusion problem int main ()
 

Variables

double TanhSolnForSteadyAxisymAdvectionDiffusion::Peclet = 0.0
 Peclet number. More...
 
double TanhSolnForSteadyAxisymAdvectionDiffusion::TanPhi = 0.5
 Parameter for angle of step. More...
 
double TanhSolnForSteadyAxisymAdvectionDiffusion::Omega = 0.5
 Parameter for switch z-dependence. More...
 
double TanhSolnForSteadyAxisymAdvectionDiffusion::Epsilon = 0.1
 Amplitude of boundary deflection (Epsilon<R!!!) More...
 
double TanhSolnForSteadyAxisymAdvectionDiffusion::K_Alpha = 1.0
 Relation between alfa and beta (. More...
 
SteadyAxisymAdvectionDiffusion problem on rectangular domain
 
Constructor for SteadyAxisymAdvectionDiffusion problem
 
Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt wind_fct_pt
 
Update the problem specs before solve
 

Function Documentation

◆ for()

for ( )
357  {
358  // Only update the Dirichlet conditions!
359  if (ibound==0 || ibound==2)
360  {
361  // How many nodes are there on this boundary?
362  unsigned num_nod = Bulk_mesh_pt->nboundary_node(ibound);
363 
364  // Loop over the nodes on boundary
365  for (unsigned inod=0;inod<num_nod;inod++)
366  {
367  // Get pointer to node
368  Node* nod_pt = Bulk_mesh_pt->boundary_node_pt(ibound,inod);
369 
370  // Extract nodal coordinates from node:
371  Vector<double> x(2);
372  x[0] = nod_pt->x(0);
373  x[1] = nod_pt->x(1);
374 
375  // Compute the value of the exact solution at the nodal point
376  Vector<double> u(1);
378 
379  // Assign the value to the one (and only) nodal value at this node
380  nod_pt->set_value(0,u[0]);
381 
382  }
383  }
384  }
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
Exact solution as a Vector void get_exact_u(const Vector< double > &x, Vector< double > &u)
Definition: steady_axisym_advection_diffusion.cc:66
list x
Definition: plotDoE.py:28

References TanhSolnForSteadyAxisymAdvectionDiffusion::get_exact_u(), oomph::Data::set_value(), plotDoE::x, and oomph::Node::x().

◆ main()

Driver code for SteadyAxisymAdvectionDiffusion problem int main ( )
501 {
502 
503  //Set up the problem
504  //------------------
505 
506  // Create the problem with 2D nine-node elements from the
507  // QSteadyAxisymAdvectionDiffusionElement family. Pass pointer to
508  // source and wind function.
509 
513 
514  // Create label for output
515  //------------------------
516  DocInfo doc_info;
517 
518  // Set output directory
519  doc_info.set_directory("RESLT");
520 
521  // Step number
522  doc_info.number() = 0;
523 
524  // Check if we're ready to go:
525  //----------------------------
526  cout << "\n\n\nProblem self-test ";
527  if (problem.self_test()==0)
528  {
529  cout << "passed: Problem can be solved." << std::endl;
530  }
531  else
532  {
533  throw OomphLibError("Self test failed",
536  }
537 
538  // Solve the problem
539  problem.newton_solve();
540 
541  //Output the solution
542  problem.doc_solution(doc_info);
543 
544 } // end of main
Definition: steady_axisym_advection_diffusion.cc:157
Definition: oomph_utilities.h:499
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
Definition: oomph_definitions.h:222
Source function required to make the solution above an exact solution void source_function(const Vector< double > &x_vect, double &source)
Definition: steady_axisym_advection_diffusion.cc:83
Wind void wind_function(const Vector< double > &x, Vector< double > &wind)
Definition: steady_axisym_advection_diffusion.cc:133
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::DocInfo::number(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, oomph::DocInfo::set_directory(), TanhSolnForSteadyAxisymAdvectionDiffusion::source_function(), and TanhSolnForSteadyAxisymAdvectionDiffusion::wind_function().

◆ Wind_fct_pt()

Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt Wind_fct_pt ( wind_fct_pt  )
216 {
217 
218  // Setup "bulk" mesh
219 
220  // # of elements in r-direction
221  unsigned n_r = 20;
222 
223  // # of elements in z-direction
224  unsigned n_z = 20;
225 
226  // Domain length in r-direction
227  double l_r = 1.0;
228 
229  // Domain length in z-direction
230  double l_z = 2.0*MathematicalConstants::Pi;
231 
232  // Build and assign "bulk" mesh
233 
234  Bulk_mesh_pt = new RectangularQuadMesh<ELEMENT>(n_r,n_z,l_r,l_z);
235 
236  // MODIFY THE MESH
237  // ---------------
238 
239  // Determine number of nodes in mesh
240  const unsigned n_node = Bulk_mesh_pt->nnode();
241 
242  // Loop over nodes
243  for(unsigned i=0;i<n_node;i++)
244  {
245 
246  // Determine z and r coordinate of node
247  double z_value = Bulk_mesh_pt->node_pt(i)->x(1);
248  double r_value = Bulk_mesh_pt->node_pt(i)->x(0);
249 
250  // Set mesh using the external surface
252 
253  Bulk_mesh_pt->node_pt(i)->x(0) = r_value - (r_value/l_r)*epsilon*sin(z_value);
254 
255  } // End of loop over nodes
256 
257  // Update nodes in bulk mesh
258  Bulk_mesh_pt->node_update();
259 
260  // Create "surface mesh" that will contain only the prescribed-flux
261  // elements. The constructor just creates the mesh without
262  // giving it any elements, nodes, etc.
263  Surface_mesh_pt = new Mesh;
264 
265  // Create prescribed-flux elements from all elements that are
266  // adjacent to boundary 1, but add them to a separate mesh.
267  // Note that this is exactly the same function as used in the
268  // single mesh version of the problem, we merely pass different Mesh pointers.
269  create_flux_elements(1,Bulk_mesh_pt,Surface_mesh_pt);
270 
271  // Add the two sub meshes to the problem
272  add_sub_mesh(Bulk_mesh_pt);
273  add_sub_mesh(Surface_mesh_pt);
274 
275  // Combine all submeshes into a single Mesh
276  build_global_mesh();
277 
278  // BOUNDARY CONDITIONS
279  // -------------------
280 
281  // Set the boundary conditions for this problem: All nodes are
282  // free by default -- only need to pin the ones that have Dirichlet
283  // conditions here
284  unsigned num_bound = Bulk_mesh_pt->nboundary();
285 
286  //Leave nodes on boundary 3 (symmetry axis) free
287  for(unsigned ibound=0;ibound<num_bound-1;ibound++)
288  {
289  //Leave nodes on boundary 1 free
290  if (ibound==0 || ibound==2)
291  {
292  unsigned num_nod= mesh_pt()->nboundary_node(ibound);
293  for (unsigned inod=0;inod<num_nod;inod++)
294  {
295  Bulk_mesh_pt->boundary_node_pt(ibound,inod)->pin(0);
296  }
297  }
298  } // end loop over boundaries
299 
300  // Complete the build of all elements so they are fully functional
301 
302  // Loop over the elements to set up element-specific
303  // things that cannot be handled by the (argument-free!) ELEMENT
304  // constructor: Pass pointer to source function
305  unsigned n_element = Bulk_mesh_pt->nelement();
306  for(unsigned i=0;i<n_element;i++)
307  {
308  // Upcast from GeneralsedElement to the present element
309  ELEMENT *el_pt = dynamic_cast<ELEMENT*>(Bulk_mesh_pt->element_pt(i));
310 
311  //Set the source function pointer
312  el_pt->source_fct_pt() = Source_fct_pt;
313 
314  //Set the wind function pointer
315  el_pt->wind_fct_pt() = Wind_fct_pt;
316 
317  // Set the Peclet number pointer
319  }
320 
321  // Loop over the flux elements to pass pointer to prescribed flux function
322  n_element = Surface_mesh_pt->nelement();
323  for(unsigned e=0;e<n_element;e++)
324  {
325  // Upcast from GeneralisedElement to AdvectionDiffusion flux element
328  Surface_mesh_pt->element_pt(e));
329 
330  // Set the pointer to the prescribed beta function
331  el_pt->beta_fct_pt() =
333  // Set the pointer to the prescribed alpha function
334  el_pt->alpha_fct_pt() =
336  }
337 
338  // Setup equation numbering scheme
339  cout <<"Number of equations: " << assign_eqn_numbers() << std::endl;
340 
341 } // end of constructor
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: mesh.h:67
Definition: rectangular_quadmesh.template.h:59
Definition: steady_axisym_advection_diffusion_elements.h:609
SteadyAxisymAdvectionDiffusionPrescribedAlphaFctPt & alpha_fct_pt()
Access function for the prescribed-alpha function pointer.
Definition: steady_axisym_advection_diffusion_elements.h:652
SteadyAxisymAdvectionDiffusionPrescribedBetaFctPt & beta_fct_pt()
Broken assignment operator.
Definition: steady_axisym_advection_diffusion_elements.h:646
double Pi
Definition: two_d_biharmonic.cc:235
double Peclet
Peclet number.
Definition: steady_axisym_advection_diffusion.cc:51
Beta required by the exact solution on a boundary on which r is fixed void prescribed_beta_on_fixed_r_boundary(const Vector< double > &x_vect, double &beta)
Definition: steady_axisym_advection_diffusion.cc:99
double Epsilon
Amplitude of boundary deflection (Epsilon<R!!!)
Definition: steady_axisym_advection_diffusion.cc:60
Alfa required by the exact solution on a boundary on which r is fixed void prescribed_alpha_on_fixed_r_boundary(const Vector< double > &x_vect, double &alpha)
Definition: steady_axisym_advection_diffusion.cc:117
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
GeneralisedAxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
Definition: gen_axisym_advection_diffusion_elements.h:624
GeneralisedAxisymAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
Definition: gen_axisym_advection_diffusion_elements.h:229
Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt Wind_fct_pt(wind_fct_pt)
Definition: steady_axisym_advection_diffusion.cc:215
Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt wind_fct_pt
Definition: steady_axisym_advection_diffusion.cc:215

References oomph::SteadyAxisymAdvectionDiffusionFluxElement< ELEMENT >::alpha_fct_pt(), oomph::SteadyAxisymAdvectionDiffusionFluxElement< ELEMENT >::beta_fct_pt(), e(), oomph::SarahBL::epsilon, TanhSolnForSteadyAxisymAdvectionDiffusion::Epsilon, i, TanhSolnForSteadyAxisymAdvectionDiffusion::Peclet, BiharmonicTestFunctions2::Pi, TanhSolnForSteadyAxisymAdvectionDiffusion::prescribed_alpha_on_fixed_r_boundary(), TanhSolnForSteadyAxisymAdvectionDiffusion::prescribed_beta_on_fixed_r_boundary(), sin(), and oomph::Source_fct_pt.

Variable Documentation

◆ domain

◆ problem

◆ solve

◆ wind_fct_pt

Constructor for SteadyAxisymAdvectionDiffusion SteadyAxisymAdvectionDiffusionEquations::SteadyAxisymAdvectionDiffusionWindFctPt wind_fct_pt