two_d_poisson_flux_bc2.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/simple_rectangular_quadmesh.h"

Classes

class  TwoMeshFluxPoissonProblem< ELEMENT >
 

Namespaces

 TanhSolnForPoisson
 Namespace for exact solution for Poisson equation with "sharp step".
 

Functions

void TanhSolnForPoisson::get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void TanhSolnForPoisson::source_function (const Vector< double > &x, double &source)
 Source function required to make the solution above an exact solution. More...
 
void TanhSolnForPoisson::prescribed_flux_on_fixed_x_boundary (const Vector< double > &x, double &flux)
 Flux required by the exact solution on a boundary on which x is fixed. More...
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Demonstrate how to solve 2D Poisson problem with flux boundary conditions, using two meshes.

366 {
367 
368  //Set up the problem
369  //------------------
370 
371  //Set up the problem with 2D nine-node elements from the
372  //QPoissonElement family. Pass pointer to source function.
375 
376 
377  // Create label for output
378  //------------------------
379  DocInfo doc_info;
380 
381  // Set output directory
382  doc_info.set_directory("RESLT");
383 
384  // Step number
385  doc_info.number()=0;
386 
387 
388 
389  // Check if we're ready to go:
390  //----------------------------
391  cout << "\n\n\nProblem self-test ";
392  if (problem.self_test()==0)
393  {
394  cout << "passed: Problem can be solved." << std::endl;
395  }
396  else
397  {
398  throw OomphLibError("Self test failed",
401  }
402 
403 
404  // Set the orientation of the "step" to 45 degrees
406 
407  // Initial value for the steepness of the "step"
409 
410  // Do a couple of solutions for different forcing functions
411  //---------------------------------------------------------
412  unsigned nstep=4;
413  for (unsigned istep=0;istep<nstep;istep++)
414  {
415  // Increase the steepness of the step:
417 
418  cout << "\n\nSolving for TanhSolnForPoisson::Alpha="
419  << TanhSolnForPoisson::Alpha << std::endl << std::endl;
420 
421  // Solve the problem
422  problem.newton_solve();
423 
424  //Output solution
425  problem.doc_solution(doc_info);
426 
427  //Increment counter for solutions
428  doc_info.number()++;
429  }
430 
431 } //end of main
Definition: two_d_poisson_flux_bc2.cc:91
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
double TanPhi
Parameter for angle Phi of "step".
Definition: HypreSolver_test.cc:51
void source_function(const Vector< double > &x, double &source)
Source function required to make the solution above an exact solution.
Definition: HypreSolver_test.cc:60
double Alpha
Parameter for steepness of step.
Definition: extrude_with_macro_element_representation.cc:185
#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 TanhSolnForPoisson::Alpha, oomph::DocInfo::number(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, oomph::DocInfo::set_directory(), TanhSolnForPoisson::source_function(), and TanhSolnForPoisson::TanPhi.