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

Variables

double TanhSolnForPoisson::X_shift =8.0
 Shift of step along x-direction. More...
 
bool TanhSolnForPoisson::TanhSoln =false
 Flag for zero TanhSolution. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Demonstrate how to solve Poisson problem.

313 {
314  // Store command line arguments
315  CommandLineArgs::setup(argc,argv);
316 
317  // Check number of command line arguments: Need exactly four.
318  if (argc!=4)
319  {
320  std::string error_message =
321  "Wrong number of command line arguments.\n";
322  error_message +=
323  "Must specify the following file names \n";
324  error_message +=
325  "filename.node then filename.ele then filename.poly\n";
326 
327  throw OomphLibError(error_message,
330  }
331 
332 
333 
334  // Convert arguments to strings that specify the input file names
335  string node_file_name(argv[1]);
336  string element_file_name(argv[2]);
337  string poly_file_name(argv[3]);
338 
339  // Label for output
340  DocInfo doc_info;
341 
342  // Output directory
343  doc_info.set_directory("RESLT");
344 
345 
346 
347  // Linear Elements
348  //----------------
349  {
350  cout << std::endl << "Linear elements" << std::endl;
351  cout << "===============" << std::endl << std::endl;
352 
353  //Set up the problem
356  node_file_name,
357  element_file_name,
358  poly_file_name);
359 
360  // Use TanhSolution?
362 
363  // Solve once with forcing that makes TanhSolution an exact solution
364  // and once with constant source fct and zero bc
365  unsigned nstep=2;
366  for (unsigned istep=0;istep<nstep;istep++)
367  {
368  // Solve the problem
369  problem.newton_solve();
370 
371  //Output solution
372  problem.doc_solution(doc_info);
373 
374  //Increment counter for solutions
375  doc_info.number()++;
376 
377  // Use TanhSolution?
379  }
380  }
381 
382 
383  // Quadratic Elements
384  //-------------------
385  {
386  cout << std::endl << "Quadratic elements" << std::endl;
387  cout << "===================" << std::endl << std::endl;
388 
389  //Set up the problem
392  node_file_name,
393  element_file_name,
394  poly_file_name);
395 
396  // Use TanhSolution?
398 
399  // Solve once with forcing that makes TanhSolution an exact solution
400  // and once with constant source fct and zero bc
401  unsigned nstep=2;
402  for (unsigned istep=0;istep<nstep;istep++)
403  {
404  // Solve the problem
405  problem.newton_solve();
406 
407  //Output solution
408  problem.doc_solution(doc_info);
409 
410  //Increment counter for solutions
411  doc_info.number()++;
412 
413  // Use TanhSolution?
415  }
416  }
417 
418 
419  // Cubic Elements
420  //---------------
421  {
422  cout << std::endl << "Cubic elements" << std::endl;
423  cout << "==============" << std::endl << std::endl;
424 
425  //Set up the problem
428  node_file_name,
429  element_file_name,
430  poly_file_name);
431 
432  // Use TanhSolution?
434 
435  // Solve once with forcing that makes TanhSolution an exact solution
436  // and once with constant source fct and zero bc
437  unsigned nstep=2;
438  for (unsigned istep=0;istep<nstep;istep++)
439  {
440  // Solve the problem
441  problem.newton_solve();
442 
443  //Output solution
444  problem.doc_solution(doc_info);
445 
446  //Increment counter for solutions
447  doc_info.number()++;
448 
449  // Use TanhSolution?
451  }
452  }
453 
454 
455 
456 
457 }
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
bool TanhSoln
Flag for zero TanhSolution.
Definition: mesh_from_xfig_poisson.cc:61
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(), oomph::Global_string_for_annotation::string(), and TanhSolnForPoisson::TanhSoln.