one_d_poisson.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.

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

260 {
261 
262  // Set up the problem:
263  // Solve a 1D Poisson problem using a source function that generates
264  // a fish shaped exact solution
265  unsigned n_element=40; //Number of elements
266  OneDPoissonProblem<QPoissonElement<1,4> > //Element type as template parameter
268 
269  // Check whether the problem can be solved
270  cout << "\n\n\nProblem self-test ";
271  if (problem.self_test()==0)
272  {
273  cout << "passed: Problem can be solved." << std::endl;
274  }
275  else
276  {
277  throw OomphLibError("failed!",
279  }
280 
281  // Set the sign of the source function:
282  cout << "\n\n\nSolving with negative sign:\n" << std::endl;
284 
285  // Solve the problem with this Sign
286  problem.newton_solve();
287 
288  //Output solution for this case (label output files with "0")
289  problem.doc_solution(0);
290 
291 
292  // Change the sign of the source function:
293  cout << "\n\n\nSolving with positive sign:\n" << std::endl;
295 
296  // Re-solve the problem with this Sign (boundary conditions get
297  // updated automatically when Problem::actions_before_newton_solve() is
298  // called.
299  problem.newton_solve();
300 
301  //Output solution for this case (label output files with "1")
302  problem.doc_solution(1);
303 
304 } // 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().