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

Classes

class  FluxPoissonProblem< 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

340 {
341 
342  //Set up the problem
343  //------------------
344 
345  //Set up the problem with 2D nine-node elements from the
346  //QPoissonElement family. Pass pointer to source function.
349 
350 
351  // Create label for output
352  //------------------------
353  DocInfo doc_info;
354 
355  // Set output directory
356  doc_info.set_directory("RESLT");
357 
358  // Step number
359  doc_info.number()=0;
360 
361 
362 
363  // Check that we're ready to go:
364  //----------------------------
365  cout << "\n\n\nProblem self-test ";
366  if (problem.self_test()==0)
367  {
368  cout << "passed: Problem can be solved." << std::endl;
369  }
370  else
371  {
372  throw OomphLibError("Self test failed",
375  }
376 
377 
378  // Set the orientation of the "step" to 45 degrees
380 
381  // Initial value for the steepness of the "step"
383 
384  // Do a couple of solutions for different forcing functions
385  //---------------------------------------------------------
386  unsigned nstep=4;
387  for (unsigned istep=0;istep<nstep;istep++)
388  {
389  // Increase the steepness of the step:
391 
392  cout << "\n\nSolving for TanhSolnForPoisson::Alpha="
393  << TanhSolnForPoisson::Alpha << std::endl << std::endl;
394 
395  // Solve the problem
396  problem.newton_solve();
397 
398  //Output solution
399  problem.doc_solution(doc_info);
400 
401  //Increment counter for solutions
402  doc_info.number()++;
403  }
404 
405 } //end of main
Definition: two_d_poisson_flux_bc.cc:94
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.