mesh_from_triangle_poisson.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/triangle_mesh.h"

Classes

class  PoissonProblem< ELEMENT >
 Micky mouse Poisson problem. More...
 

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::get_exact_u (const Vector< double > &x, double &u)
 Exact solution as a scalar. More...
 
void TanhSolnForPoisson::get_source (const Vector< double > &x, double &source)
 Source function to make it an exact solution. More...
 
int main (int argc, char *argv[])
 Demonstrate how to solve Poisson problem. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Demonstrate how to solve Poisson problem.

369 {
370  // Store command line arguments
371  CommandLineArgs::setup(argc,argv);
372 
373  // Check number of command line arguments: Need exactly two.
374  if (argc!=4)
375  {
376  std::string error_message =
377  "Wrong number of command line arguments.\n";
378  error_message +=
379  "Must specify the following file names \n";
380  error_message +=
381  "filename.node then filename.ele then filename.poly\n";
382 
383  throw OomphLibError(error_message,
386  }
387 
388 #ifdef ADAPT
389  const unsigned max_adapt = 3;
390 #endif
391 
392  // Convert arguments to strings that specify the input file names
393  string node_file_name(argv[1]);
394  string element_file_name(argv[2]);
395  string poly_file_name(argv[3]);
396 
397  // Label for output
398  DocInfo doc_info;
399 
400  // Output directory
401  doc_info.set_directory("RESLT");
402 
403 #ifndef ADAPT
404  // Do the problem with cubic elements
405  //-----------------------------------
406  {
407  cout << std::endl << "Cubic elements" << std::endl;
408  cout << "==============" << std::endl << std::endl;
409 
410  //Set up the problem
412  problem(&TanhSolnForPoisson::get_source,node_file_name,
413  element_file_name,
414  poly_file_name);
415 
416  // Solve the problem
417  problem.newton_solve();
418 
419  //Output solution
420  problem.doc_solution(doc_info);
421 
422  //Increment counter for solutions
423  doc_info.number()++;
424  }
425 #endif
426 
427 
428  // Do the problem with quadratic elements
429  //---------------------------------------
430  {
431  cout << std::endl << "Quadratic elements" << std::endl;
432  cout << "===================" << std::endl << std::endl;
433 
434 #ifdef ADAPT
435  //Set up the problem
437  problem(&TanhSolnForPoisson::get_source,node_file_name,
438  element_file_name,
439  poly_file_name);
440 #else
441  //Set up the problem
443  problem(&TanhSolnForPoisson::get_source,node_file_name,
444  element_file_name,
445  poly_file_name);
446 #endif
447 
448 #ifdef ADAPT
449  // Solve the problem with adaptation
450  problem.newton_solve(max_adapt);
451 #else
452  // Solve the problem
453  problem.newton_solve();
454 #endif
455 
456  //Output solution
457  problem.doc_solution(doc_info);
458 
459  //Increment counter for solutions
460  doc_info.number()++;
461  }
462 
463 
464 
465  // Do the problem with linear elements
466  //------------------------------------
467  {
468  cout << std::endl << "Linear elements" << std::endl;
469  cout << "===============" << std::endl << std::endl;
470 
471 #ifdef ADAPT
472  //Set up the problem
474  problem(&TanhSolnForPoisson::get_source,node_file_name,
475  element_file_name,
476  poly_file_name);
477 #else
478  //Set up the problem
480  problem(&TanhSolnForPoisson::get_source,node_file_name,
481  element_file_name,
482  poly_file_name);
483 #endif
484 
485 #ifdef ADAPT
486  // Solve the problem with adaptation
487  problem.newton_solve(max_adapt);
488 #else
489  // Solve the problem
490  problem.newton_solve();
491 #endif
492 
493  //Output solution
494  problem.doc_solution(doc_info);
495 
496  //Increment counter for solutions
497  doc_info.number()++;
498  }
499 
500 }
Micky mouse Poisson problem.
Definition: HypreSolver_test.cc:81
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
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
void get_source(const Vector< double > &x, double &source)
Source function to make it an exact solution.
Definition: extrude_with_macro_element_representation.cc:224
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
#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::get_source(), oomph::DocInfo::number(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, oomph::DocInfo::set_directory(), Flag_definition::setup(), and oomph::Global_string_for_annotation::string().