one_d_spectral.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...
 
template<unsigned SPECTRAL_ORDER>
void construct_and_solve_problem (const unsigned &i)
 
int main ()
 Driver for 1D Poisson problem. More...
 

Function Documentation

◆ construct_and_solve_problem()

template<unsigned SPECTRAL_ORDER>
void construct_and_solve_problem ( const unsigned i)
250 {
251  // Set up the problem:
252  // Solve a 1D Poisson problem using a source function that generates
253  // a fish shaped exact solution
254  unsigned n_element=10; //Number of elements
255 
256  OneDPoissonProblem<QSpectralPoissonElement<1,SPECTRAL_ORDER> > //Element type as template parameter
258 
259  // Check whether the problem can be solved
260  cout << "\n\n\nProblem self-test ";
261  if (problem.self_test()==0)
262  {
263  cout << "passed: Problem can be solved." << std::endl;
264  }
265  else
266  {
267  throw OomphLibError("Self test failed",
270  }
271 
272  // Set the sign of the source function:
273  cout << "\n\n\nSolving with Spectral Order :\n" << SPECTRAL_ORDER << std::endl;
275 
276  // Solve the problem with this Sign
277  problem.newton_solve();
278 
279  //Output solution for this case (label output files with "i")
280  problem.doc_solution(i);
281 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
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 i, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, FishSolnOneDPoisson::Sign, and FishSolnOneDPoisson::source_function().

◆ main()

int main ( )

Driver for 1D Poisson problem.

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

292 {
293  construct_and_solve_problem<2>(0);
294  construct_and_solve_problem<3>(1);
295  construct_and_solve_problem<4>(2);
296  construct_and_solve_problem<5>(3);
297  construct_and_solve_problem<6>(4);
298  construct_and_solve_problem<7>(5);
299  construct_and_solve_problem<8>(6);
300 } // end of main