joes_poisson_code.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/one_d_mesh.h"

Classes

class  OneDPoissonProblem< ELEMENT >
 1D Poisson problem in unit interval. More...
 

Namespaces

 FishSolnOneDPoisson
 Namespace for fish-shaped solution of 1D Poisson equation.
 

Functions

void FishSolnOneDPoisson::get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact, fish-shaped solution as a 1D vector. More...
 
void FishSolnOneDPoisson::source_function (const Vector< double > &x, double &source)
 Source function required to make the fish shape an exact solution. More...
 
int main ()
 Driver for 1D Poisson problem. More...
 

Function Documentation

◆ main()

int main ( )

Driver for 1D Poisson problem.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

263 {
264 
265  // Set up the problem:
266  // Solve a 1D Poisson problem using a source function that generates
267  // a fish shaped exact solution
268  unsigned n_element=40; //Number of elements
269  OneDPoissonProblem<QPoissonElement<1,4> > //Element type as template parameter
271 
272  // Check whether the problem can be solved
273  cout << "\n\n\nProblem self-test ";
274  if (problem.self_test()==0)
275  {
276  cout << "passed: Problem can be solved." << std::endl;
277  }
278  else
279  {
280  throw OomphLibError("failed!",
283  }
284 
285  // Set the sign of the source function:
286  cout << "\n\n\nSolving with negative sign:\n" << std::endl;
288 
289  // Solve the problem with this Sign
290  problem.newton_solve();
291 
292  //Output solution for this case (label output files with "0")
293  problem.doc_solution(0);
294 
295 
296  // Change the sign of the source function:
297  cout << "\n\n\nSolving with positive sign:\n" << std::endl;
299 
300  // Re-solve the problem with this Sign (boundary conditions get
301  // updated automatically when Problem::actions_before_newton_solve() is
302  // called.
303  problem.newton_solve();
304 
305  //Output solution for this case (label output files with "1")
306  problem.doc_solution(1);
307 
308 } // end of main
1D Poisson problem in unit interval.
Definition: linear_solvers/direct_solver_test.cc:81
Definition: oomph_definitions.h:222
int Sign
Definition: linear_solvers/direct_solver_test.cc:52
void source_function(const Vector< double > &x, double &source)
Source function required to make the fish shape an exact solution.
Definition: linear_solvers/direct_solver_test.cc:63
#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_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, FishSolnOneDPoisson::Sign, and FishSolnOneDPoisson::source_function().