mpi/solvers/two_d_multi_poisson.cc File Reference

Classes

class  MultiPoissonProblem< ELEMENT >
 

Namespaces

 TanhSolnForMultiPoisson
 Namespace for exact solution for MultiPoisson equation with "sharp step".
 

Macros

#define N_FIELD   5
 

Functions

double TanhSolnForMultiPoisson::scalar_soln (const Vector< double > &x)
 Scalar solution. More...
 
double TanhSolnForMultiPoisson::scalar_source (const Vector< double > &x)
 Scalar source. More...
 
void TanhSolnForMultiPoisson::get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void TanhSolnForMultiPoisson::source_function (const Vector< double > &x, Vector< double > &source)
 Source function required to make the solution above an exact solution. More...
 
int main (int argc, char *argv[])
 Driver code for 2D MultiPoisson problem. More...
 

Macro Definition Documentation

◆ N_FIELD

#define N_FIELD   5

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver code for 2D MultiPoisson problem.

493 {
494 // feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW);
495 
496 
497 #ifdef OOMPH_HAS_MPI
498 
499  // Initialise MPI
500  MPI_Helpers::init(argc,argv);
501 
502 #endif
503 
504 
505  // Store command line arguments
506  CommandLineArgs::setup(argc,argv);
507 
508  // Define possible command line arguments and parse the ones that
509  // were actually specified
510 
512 
514  ("--upper_triangular");
515 
517  ("--two_plus_three");
518 
520  ("--two_plus_three_upper_triangular");
521 
523  ("--two_plus_three_upper_triangular_with_sub");
524 
526  ("--two_plus_three_upper_triangular_with_two_sub");
527 
529  ("--two_plus_three_upper_triangular_with_replace");
530 
532  ("--coarse_two_plus_two_plus_one");
533 
535  ("--one_plus_four_with_two_coarse");
536 
538  ("--use_validation_distribution");
539 
540  // Parse command line
542 
543  // Doc what has actually been specified on the command line
545 
546  // Create the problem with 2D nine-node elements from the
547  // QMultiPoissonElement family.
549 
550  // Create label for output
551  DocInfo doc_info;
552 
553  // Set output directory
554  doc_info.set_directory("RESLT");
555 
556  // Step number
557  doc_info.number()=0;
558 
559  cout << "\n\nSolving for TanhSolnForMultiPoisson::Alpha="
560  << TanhSolnForMultiPoisson::Alpha << std::endl << std::endl;
561 
562 #ifdef OOMPH_HAS_MPI
564  "--use_validation_distribution"))
565  {
566  // Create storage for pre-determined partitioning
567  const unsigned n_element=problem.mesh_pt()->nelement();
568  Vector<unsigned> element_partition(n_element);
569 
570  // Read in partitioning from disk
571  std::ifstream input_file;
572  char filename[100];
573  sprintf(filename,"multi_poisson_partition.dat");
574  input_file.open(filename);
575  std::string input_string;
576  for (unsigned e=0;e<n_element;e++)
577  {
578  getline(input_file,input_string,'\n');
579  element_partition[e]=atoi(input_string.c_str());
580  }
581 
582  // Now perform the distribution and document it
583  bool report_stats=true;
584  problem.distribute(element_partition,report_stats);
585  }
586 
587  // Create new partition.
588  else
589  {
590  // Provide storage for each element's partition number
591  const unsigned n_element=problem.mesh_pt()->nelement();
592  Vector<unsigned> out_element_partition(n_element);
593 
594  // Distribute the problem
595  bool report_stats=true;
596  out_element_partition=problem.distribute(report_stats);
597 
598  // Write partition to disk
599  std::ofstream output_file;
600  char filename[100];
601  sprintf(filename,"out_multi_poisson_partition.dat");
602  output_file.open(filename);
603  for (unsigned e=0;e<n_element;e++)
604  {
605  output_file << out_element_partition[e] << std::endl;
606  }
607  }
608 #endif
609 
610  // Solve the problem
611  problem.newton_solve();
612 
613  //Output the solution
614  problem.doc_solution(doc_info);
615 
616 // Finalise MPI
617 #ifdef OOMPH_HAS_MPI
618 
619  MPI_Helpers::finalize();
620 
621 #endif
622 
623 
624 } //end of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: linear_solvers/two_d_multi_poisson.cc:118
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
string filename
Definition: MergeRestartFiles.py:39
double Alpha
Parameter for steepness of "step".
Definition: linear_solvers/two_d_multi_poisson.cc:56
bool command_line_flag_has_been_set(const std::string &flag)
Definition: oomph_utilities.cc:501
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
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References TanhSolnForMultiPoisson::Alpha, oomph::CommandLineArgs::command_line_flag_has_been_set(), oomph::CommandLineArgs::doc_specified_flags(), e(), MergeRestartFiles::filename, oomph::DocInfo::number(), oomph::CommandLineArgs::parse_and_assign(), problem, oomph::DocInfo::set_directory(), Flag_definition::setup(), oomph::CommandLineArgs::specify_command_line_flag(), and oomph::Global_string_for_annotation::string().