jacks_own_code.cc File Reference
#include "generic.h"
#include "jack_cool.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.

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

268 {
269 
270  // Set up the problem:
271  // Solve a 1D Poisson problem using a source function that generates
272  // a fish shaped exact solution
273  unsigned n_element=40; //Number of elements
274  OneDPoissonProblem<QPoissonElement<1,4> > //Element type as template parameter
276 
277  // Check whether the problem can be solved
278  cout << "\n\n\nProblem self-test ";
279  if (problem.self_test()==0)
280  {
281  cout << "passed: Problem can be solved." << std::endl;
282  }
283  else
284  {
285  throw OomphLibError("failed!",
288  }
289 
290  // Set the sign of the source function:
291  cout << "\n\n\nSolving with negative sign:\n" << std::endl;
293 
294  // Solve the problem with this Sign
295  problem.newton_solve();
296 
297  //Output solution for this case (label output files with "0")
298  problem.doc_solution(0);
299 
300 
301  // Change the sign of the source function:
302  cout << "\n\n\nSolving with positive sign:\n" << std::endl;
304 
305  // Re-solve the problem with this Sign (boundary conditions get
306  // updated automatically when Problem::actions_before_newton_solve() is
307  // called.
308  problem.newton_solve();
309 
310  //Output solution for this case (label output files with "1")
311  problem.doc_solution(1);
312 
313 
314  // And now on to the exciting bit: We're building Jack's very own
315  // hello world object!
316  JacksHelloWorld hello_world;
317 
318  // Say something, using an inlined member function defined in the header file
319  hello_world.say_it_inline();
320 
321  // Say something, using a precompiled member function defined in the *.cc file
322  hello_world.say_it_external();
323 
324  cout << std::endl << std::endl;
325 
326 } // end of main
1D Poisson problem in unit interval.
Definition: linear_solvers/direct_solver_test.cc:81
Hello world class – uses object from generic library.
Definition: hello_world.h:45
void say_it_inline()
Say it inline.
Definition: hello_world.h:58
void say_it_external()
Say it externally.
Definition: hello_world.cc:33
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, oomph::JacksHelloWorld::say_it_external(), oomph::JacksHelloWorld::say_it_inline(), FishSolnOneDPoisson::Sign, and FishSolnOneDPoisson::source_function().