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

295 {
296 
297  // Store command line arguments
298  CommandLineArgs::setup(argc,argv);
299 
301  DocInfo doc_info;
302 
303  // Output directory
304  doc_info.set_directory("RESLT");
305 
306  // Step number
307  doc_info.number()=0;
308 
309  //Set step orientation
311 
312 
313  // Number of steps (reduced for validation)
314  unsigned nstep = 7;
315  if (CommandLineArgs::Argc>1)
316  {
317  nstep=3;
318  }
319 
320  // Output for convergence data
321  ofstream convergence_file("RESLT/convergence.dat");
322 
323  convergence_file << "VARIABLES=\"log h\",\"log e\",\"theory\",\"log u\" "
324  << std::endl;
325 
326 
327  cout << "Linear elements " << std::endl;
328  cout << "================" << std::endl << std::endl;
329 
330 
331  //Tecplot output separator for convergence results
332  convergence_file << "ZONE T=\"Linear element\"" << std::endl;
333  for (unsigned h_power=1;h_power<nstep+1;h_power++)
334  {
335  //Set up the problem
338 
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  cout << "Quadratic elements " << std::endl;
353  cout << "==================" << std::endl << std::endl;
354 
355 
356  //Tecplot output separator for convergence results
357  convergence_file << "ZONE T=\"Quadratic element\"" << std::endl;
358  for (unsigned h_power=1;h_power<nstep+1;h_power++)
359  {
360  //Set up the problem
363 
364 
365 // // Create an instance of a lower-order integration scheme
366 // Gauss<2,2>* int_pt=new Gauss<2,2>;
367 
368 // //Find number of elements in mesh
369 // unsigned n_element = problem.mesh_pt()->nelement();
370 
371 // // Loop over the elements to set up element-specific
372 // // things that cannot be handled by constructor
373 // for(unsigned i=0;i<n_element;i++)
374 // {
375 // //Set the a different integration scheme
376 // problem.mesh_pt()->finite_element_pt(i)->set_integration_scheme(int_pt);
377 // }
378 
379  // Solve the problem
380  problem.newton_solve();
381 
382  //Output solution & convergence data
383  problem.doc_solution(doc_info,convergence_file);
384 
385  //Increment counter for solutions
386  doc_info.number()++;
387  }
388 
389 
390 
391  cout << "Cubicc elements " << std::endl;
392  cout << "================" << std::endl << std::endl;
393 
394 
395  //Tecplot output separator for convergence results
396  convergence_file << "ZONE T=\"Cubic element\"" << std::endl;
397  for (unsigned h_power=1;h_power<nstep+1;h_power++)
398  {
399  //Set up the problem
402 
403 
404 // // Create an instance of a lower-order integration scheme
405 // Gauss<2,3>* int_pt=new Gauss<2,3>;
406 
407 // //Find number of elements in mesh
408 // unsigned n_element = problem.mesh_pt()->nelement();
409 
410 // // Loop over the elements to set up element-specific
411 // // things that cannot be handled by constructor
412 // for(unsigned i=0;i<n_element;i++)
413 // {
414 // //Set the a different integration scheme
415 // problem.mesh_pt()->finite_element_pt(i)->set_integration_scheme(int_pt);
416 // }
417 
418  // Solve the problem
419  problem.newton_solve();
420 
421  //Output solution & convergence data
422  problem.doc_solution(doc_info,convergence_file);
423 
424  //Increment counter for solutions
425  doc_info.number()++;
426  }
427 
428  convergence_file.close();
429 
430 }
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().