two_d_adv_diff_adapt2.cc File Reference

Classes

class  RefineableAdvectionDiffusionProblem< ELEMENT >
 

Namespaces

 TanhSolnForAdvectionDiffusion
 

Functions

void TanhSolnForAdvectionDiffusion::tanh_profile (const Vector< double > &x, Vector< double > &u)
 Tanh profile for assignment of boundary conditons as a Vector. More...
 
void TanhSolnForAdvectionDiffusion::tanh_profile (const Vector< double > &x, double &u)
 Tanh profile for assignment of boundary conditons as a Vector. More...
 
void TanhSolnForAdvectionDiffusion::source_function (const Vector< double > &x_vect, double &source)
 Source function required to make the solution above an exact solution. More...
 
void TanhSolnForAdvectionDiffusion::wind_function (const Vector< double > &x, Vector< double > &wind)
 Wind. More...
 
int main ()
 Driver code for 2D AdvectionDiffusion problem. More...
 

Function Documentation

◆ main()

int main ( )

Driver code for 2D AdvectionDiffusion problem.

278 {
279 
280  //Set up the problem
281  //------------------
282 
283  // Create the problem with 2D nine-node refineable elements from the
284  // RefineableQuadAdvectionDiffusionElement family. Pass pointer to
285  // source and wind function.
289 
290  // Create label for output
291  //------------------------
292  DocInfo doc_info;
293 
294  // Set output directory
295  doc_info.set_directory("RESLT");
296 
297  // Step number
298  doc_info.number()=0;
299 
300  // Check if we're ready to go:
301  //----------------------------
302  cout << "\n\n\nProblem self-test ";
303  if (problem.self_test()==0)
304  {
305  cout << "passed: Problem can be solved." << std::endl;
306  }
307  else
308  {
309  throw OomphLibError("Self test failed",
312  }
313 
314  // Set the orientation of the "step" to 45 degrees
316 
317  // Choose a large value for the steepness of the "step"
319 
320  // Doc (default) refinement targets
321  //----------------------------------
322  problem.mesh_pt()->doc_adaptivity_targets(cout);
323 
324 
325 
326  // Solve/doc the problem on the initial, very coarse mesh
327  //-------------------------------------------------------
328 
329  // Solve the problem
330  problem.newton_solve();
331 
332  //Output solution
333  problem.doc_solution(doc_info);
334 
335  //Increment counter for solutions
336  doc_info.number()++; // end of Solve/doc very coarse mesh
337 
338  // Now do (up to) four rounds of fully automatic adapation in response to
339  //-----------------------------------------------------------------------
340  // error estimate
341  //---------------
342  unsigned max_solve=4;
343  for (unsigned isolve=0;isolve<max_solve;isolve++)
344  {
345  // Adapt problem/mesh
346  problem.adapt();
347 
348  // Re-solve the problem if the adaptation has changed anything
349  if ((problem.mesh_pt()->nrefined() !=0)||
350  (problem.mesh_pt()->nunrefined()!=0))
351  {
352  problem.newton_solve();
353  }
354  else
355  {
356  cout << "Mesh wasn't adapted --> we'll stop here" << std::endl;
357  break;
358  }
359 
360  //Output solution
361  problem.doc_solution(doc_info);
362 
363  //Increment counter for solutions
364  doc_info.number()++;
365  } // end (up to) four rounds of fully automatic adapation
366 
367 
368 } //end of main
Definition: two_d_adv_diff_adapt.cc:103
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
Definition: refineable_advection_diffusion_elements.h:355
double TanPhi
Parameter for angle of step.
Definition: two_d_adv_diff_adapt.cc:56
double Alpha
Parameter for steepness of step.
Definition: two_d_adv_diff_adapt.cc:53
void source_function(const Vector< double > &x_vect, double &source)
Source function required to make the solution above an exact solution.
Definition: two_d_adv_diff_adapt.cc:71
void wind_function(const Vector< double > &x, Vector< double > &wind)
Wind.
Definition: two_d_adv_diff_adapt.cc:84
#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 TanhSolnForAdvectionDiffusion::Alpha, oomph::DocInfo::number(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, oomph::DocInfo::set_directory(), TanhSolnForAdvectionDiffusion::source_function(), TanhSolnForAdvectionDiffusion::TanPhi, and TanhSolnForAdvectionDiffusion::wind_function().