locate_zeta_tester_3d.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/eighth_sphere_mesh.h"
#include "locate_zeta_tester.h"

Classes

class  EighthSpherePoissonProblem< ELEMENT >
 Poisson problem in refineable eighth of a sphere mesh. 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[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Driver for 3D Poisson problem in eighth of a sphere. Solution has a sharp step. If there are any command line arguments, we regard this as a validation run and perform only a single adaptation.

323 {
324 
325  FiniteElement::Tolerance_for_singular_jacobian = 0.0;
326 
327  // Store command line arguments
328  CommandLineArgs::setup(argc,argv);
329 
330 
331  // Number of biased refinements for locate zeta test
332  unsigned nrefine_for_locate_zeta_test=10;
333  CommandLineArgs::specify_command_line_flag("--nrefine_for_locate_zeta_test",
334  &nrefine_for_locate_zeta_test);
335 
336  // Parse command line
338 
339  // Doc what has actually been specified on the command line
341 
342  // Set up the problem with 27-node brick elements, pass pointer to
343  // source function
346 
347  // Setup labels for output
348  DocInfo doc_info;
349 
350  // Output directory
351  doc_info.set_directory("RESLT");
352 
353  // Step number
354  doc_info.number()=0;
355 
356  // Check if we're ready to go
357  cout << "Self test: " << problem.self_test() << std::endl;
358 
359  // Solve the problem
360  problem.newton_solve();
361 
362  //Output solution
363  problem.doc_solution(doc_info);
364 
365  //Increment counter for solutions
366  doc_info.number()++;
367 
368  // Up to four adaptations
369  unsigned max_solve=1; // hierher 4;
370  for (unsigned isolve=0;isolve<max_solve;isolve++)
371  {
372  // Adapt problem/mesh
373  problem.adapt();
374 
375  // Re-solve the problem if the adaptation has changed anything
376  if ((problem.mesh_pt()->nrefined() !=0)||
377  (problem.mesh_pt()->nunrefined()!=0))
378  {
379  problem.newton_solve();
380  }
381  else
382  {
383  cout << "Mesh wasn't adapted --> we'll stop here" << std::endl;
384  break;
385  }
386 
387  //Output solution
388  problem.doc_solution(doc_info);
389 
390  //Increment counter for solutions
391  doc_info.number()++;
392  }
393 
394 
395 
396  // Setup fake error estimator: Boundaries of refiment region
397  Vector<double> lower_left(3);
398  Vector<double> upper_right(3);
399 
400  double box_size=0.7;
401  lower_left[0]=2.0;
402  lower_left[1]=2.0;
403  lower_left[2]=0.1;
404  upper_right[0]=lower_left[0]+box_size;
405  upper_right[1]=lower_left[1]+box_size;
406  upper_right[2]=lower_left[2]+box_size;
407  unsigned central_node_number=13;
408 
409  // Stop unrefinement and allow for infinite refinement
410  problem.mesh_pt()->min_permitted_error()=-1.0;
411  problem.mesh_pt()->max_refinement_level()=UINT_MAX;
412 
413  // Adapt lots of times
414  for (unsigned i=0;i<nrefine_for_locate_zeta_test;i++)
415  {
416  // Clean up
417  delete problem.mesh_pt()->spatial_error_estimator_pt();
418 
419  // Make a new error estimator
420  problem.mesh_pt()->spatial_error_estimator_pt()=
421  new DummyErrorEstimator(problem.mesh_pt(),lower_left,upper_right,
422  central_node_number);
423 
424  // Adapt
425  problem.adapt();
426 
427  // Shrink box
428  double shrink_factor=0.6;
429  lower_left[0]+=0.5*box_size*(1.0-shrink_factor);
430  lower_left[1]+=0.5*box_size*(1.0-shrink_factor);
431  lower_left[2]+=0.5*box_size*(1.0-shrink_factor);
432 
433  box_size*=shrink_factor;
434  upper_right[0]=lower_left[0]+box_size;
435  upper_right[1]=lower_left[1]+box_size;
436  upper_right[2]=lower_left[2]+box_size;
437  }
438 
439  //Output the solution
440  problem.doc_solution(doc_info);
441 
442 
443  // Check it out!
444  check_locate_zeta(problem.mesh_pt());
445 
446 } // end of main
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Poisson problem in refineable eighth of a sphere mesh.
Definition: eighth_sphere_poisson.cc:132
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: error_estimator.h:435
void check_locate_zeta(Mesh *mesh_pt)
Definition: locate_zeta_tester.h:28
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
void specify_command_line_flag(const std::string &command_line_flag, const std::string &doc)
Specify possible argument-free command line flag.
Definition: oomph_utilities.cc:451
void parse_and_assign(int argc, char *argv[], const bool &throw_on_unrecognised_args)
Definition: oomph_utilities.cc:760
void doc_specified_flags()
Document specified command line flags.
Definition: oomph_utilities.cc:610
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References check_locate_zeta(), oomph::CommandLineArgs::doc_specified_flags(), TanhSolnForPoisson::get_source(), i, oomph::DocInfo::number(), oomph::CommandLineArgs::parse_and_assign(), problem, oomph::DocInfo::set_directory(), Flag_definition::setup(), and oomph::CommandLineArgs::specify_command_line_flag().