t_convergence_2d.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/simple_rectangular_tri_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.

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

Label for output

296 {
297 
298  // Store command line arguments
299  CommandLineArgs::setup(argc,argv);
300 
302  DocInfo doc_info;
303 
304  // Output directory
305  doc_info.set_directory("RESLT");
306 
307  // Step number
308  doc_info.number()=0;
309 
310  //Set step orientation
312 
313 
314  // Number of steps (reduced for validation)
315  unsigned nstep = 7;
316  if (CommandLineArgs::Argc>1)
317  {
318  nstep=3;
319  }
320 
321  // Output for convergence data
322  ofstream convergence_file("RESLT/convergence.dat");
323 
324  convergence_file << "VARIABLES=\"log h\",\"log e\",\"theory\",\"log u\" "
325  << std::endl;
326 
327 
328  cout << "Linear elements " << std::endl;
329  cout << "================" << std::endl << std::endl;
330 
331 
332  //Tecplot output separator for convergence results
333  convergence_file << "ZONE T=\"Linear element\"" << std::endl;
334  for (unsigned h_power=1;h_power<nstep+1;h_power++)
335  {
336  //Set up the problem
339 
340  // Solve the problem
341  problem.newton_solve();
342 
343  //Output solution & convergence data
344  problem.doc_solution(doc_info,convergence_file);
345 
346  //Increment counter for solutions
347  doc_info.number()++;
348  }
349 
350 
351 
352 
353  cout << "Quadratic elements " << std::endl;
354  cout << "==================" << std::endl << std::endl;
355 
356 
357  //Tecplot output separator for convergence results
358  convergence_file << "ZONE T=\"Quadratic element\"" << std::endl;
359  for (unsigned h_power=1;h_power<nstep+1;h_power++)
360  {
361  //Set up the problem
364 
365  // Solve the problem
366  problem.newton_solve();
367 
368  //Output solution & convergence data
369  problem.doc_solution(doc_info,convergence_file);
370 
371  //Increment counter for solutions
372  doc_info.number()++;
373  }
374 
375 
376  cout << "Cubicc elements " << std::endl;
377  cout << "================" << std::endl << std::endl;
378 
379  //Tecplot output separator for convergence results
380  convergence_file << "ZONE T=\"Cubic element\"" << std::endl;
381  for (unsigned h_power=1;h_power<nstep+1;h_power++)
382  {
383  //Set up the problem
386 
387  // Solve the problem
388  problem.newton_solve();
389 
390  //Output solution & convergence data
391  problem.doc_solution(doc_info,convergence_file);
392 
393  //Increment counter for solutions
394  doc_info.number()++;
395  }
396 
397  convergence_file.close();
398 
399 }
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
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
double Beta
Parameter for angle of step.
Definition: mesh_from_geompack_poisson.cc:55
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
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, TanhSolnForPoisson::Beta, TanhSolnForPoisson::get_source(), oomph::DocInfo::number(), problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().