mpi/solvers/airy_cantilever.cc File Reference
#include "generic.h"
#include "solid.h"
#include "constitutive.h"
#include "meshes/rectangular_quadmesh.h"

Classes

class  oomph::MySolidElement< ELEMENT >
 Wrapper class for solid element to modify the output. More...
 
class  oomph::FaceGeometry< MySolidElement< ELEMENT > >
 FaceGeometry of wrapped element is the same as the underlying element. More...
 
class  CantileverProblem< ELEMENT >
 Problem class for the cantilever "beam" structure. More...
 

Namespaces

 oomph
 DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
 
 Global_Physical_Variables
 Global variables.
 

Functions

void Global_Physical_Variables::constant_pressure (const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
 Constant pressure load. More...
 
void Global_Physical_Variables::gravity (const double &time, const Vector< double > &xi, Vector< double > &b)
 Non-dimensional gravity as body force. More...
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver for cantilever beam loaded by surface traction and/or gravity

613 {
614 #ifdef OOMPH_HAS_MPI
615  MPI_Helpers::init(argc,argv);
616 #endif
617 
618  // switch off oomph_info output for all processors but rank 0
619  if (MPI_Helpers::communicator_pt()->my_rank()!=0)
620  {
622  OomphLibWarning::set_stream_pt(&oomph_nullstream);
623  OomphLibError::set_stream_pt(&oomph_nullstream);
624  }
625 
626  // Store command line arguments
627  CommandLineArgs::setup(argc,argv);
628 
629  // check that there is one command line argument
630  if (CommandLineArgs::Argc!=2)
631  {
632  oomph_info << "This driver required ONE command line argument" << std::endl;
633  abort();
634  }
635 
636  // get the preconditioning method
637  int prec = atoi(CommandLineArgs::Argv[1]);
638  switch (prec)
639  {
640  case 0:
641  oomph_info << "Using BlockDiagonalPreconditioner" << std::endl;
642  break;
643  case 1:
644  oomph_info << "Using BlockDiagonalPreconditioner with two level "
645  << "parallelisation" << std::endl;
646  break;
647  case 2:
648  oomph_info << "Using BlockTriangularPreconditioner (upper triangular)"
649  << std::endl;
650  break;
651  case 3:
652  oomph_info << "Using BlockTriangularPreconditioner (lower triangular)"
653  << std::endl;
654  break;
655  default:
656  oomph_info
657  << "Command line argument must be 0, 1, or 2\n"
658  << "0: BlockDiagonalPreconditioner\n"
659  << "1: BlockDiagonalPreconditioner w/ two level parallelisation\n"
660  << "2: BlockTriangularPreconditioner (upper triangular)\n"
661  << "3: BlockTriangularPreconditioner (lower triangular)\n";
662  abort();
663  break;
664  }
665 
666  // Set output directory
667  DocInfo doc_info;
668  doc_info.set_directory("RESLT");
669  doc_info.number() = prec;
670 
671  // Create generalised Hookean constitutive equations
675 
676  //Set up the problem
678 
679  // Initial values for parameter values
682 
683  // use trilinos gmres if available
684 #ifdef OOMPH_HAS_TRILINOS
686  solver_pt->solver_type() = TrilinosAztecOOSolver::GMRES;
687 #else
689 #endif
690  problem.linear_solver_pt() = solver_pt;
691  solver_pt->tolerance() = 10e-5;
692  solver_pt->enable_doc_convergence_history();
693 
694  // Pointer to general purpose block preconditioner base class
696 
697  // Choose the preconditioner type
698  switch (prec)
699  {
700  case 0:
701 
702  // Standard Block Diagonal
704  break;
705  case 1:
706 
707  // Two Level Block Diagonal
710  (prec_pt)->enable_two_level_parallelisation();
711  break;
712  case 2:
713 
714  // Block Upper Triangular
717  (prec_pt)->upper_triangular();
718  break;
719  case 3:
720 
721  // Block Lower Triangular
724  (prec_pt)->lower_triangular();
725  break;
726  }
727 
728 #ifdef OOMPH_HAS_HYPRE
729  // Specify Hypre as the subsidiary block preconditioner
731  (Hypre_Subsidiary_Preconditioner_Helper::get_hypre_preconditioner);
732 #endif
733 
734 
735  // The preconditioner only requires the bulk mesh since its
736  // elements are capable of classifying all degrees of freedom
737 
738  // prec_pt is a GeneralPurposeBlockPreconditioner, so we call the function
739  // add_mesh(...).
740  prec_pt->add_mesh(problem.solid_mesh_pt());
741 
742  // pass the preconditioner to the solver
743  solver_pt->preconditioner_pt() = prec_pt;
744 
745  // solve the problem
746  problem.newton_solve();
747 
748  // Doc solution
749  problem.doc_solution(doc_info);
750 
751 #ifdef OOMPH_HAS_MPI
752  MPI_Helpers::finalize();
753 #endif
754 } //end of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Problem class for the cantilever "beam" structure.
Definition: mpi/distribution/airy_cantilever/airy_cantilever2.cc:213
Definition: general_purpose_block_preconditioners.h:321
Definition: general_purpose_block_preconditioners.h:459
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
The GMRES method.
Definition: iterative_linear_solver.h:1227
Definition: general_purpose_block_preconditioners.h:77
void add_mesh(const Mesh *mesh_pt, const bool &allow_multiple_element_type_in_mesh=false)
Definition: general_purpose_block_preconditioners.h:191
void set_subsidiary_preconditioner_function(SubsidiaryPreconditionerFctPt sub_prec_fn)
access function to set the subsidiary preconditioner function.
Definition: general_purpose_block_preconditioners.h:136
Definition: constitutive_laws.h:699
void enable_doc_convergence_history()
Enable documentation of the convergence history.
Definition: iterative_linear_solver.h:122
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
Definition: iterative_linear_solver.h:95
double & tolerance()
Access to convergence tolerance.
Definition: iterative_linear_solver.h:107
std::ostream *& stream_pt()
Access function for the stream pointer.
Definition: oomph_definitions.h:464
Definition: trilinos_solver.h:267
unsigned & solver_type()
Access function to Solver_type.
Definition: trilinos_solver.h:442
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
double Nu
Poisson's ratio.
Definition: TwenteMeshGluing.cpp:71
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Definition: TwenteMeshGluing.cpp:65
double Gravity
Non-dim gravity.
Definition: meshing/quad_from_triangle_mesh/unstructured_two_d_solid.cc:214
char ** Argv
Arguments themselves.
Definition: oomph_utilities.cc:410
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
Nullstream oomph_nullstream
Single (global) instantiation of the Nullstream.
Definition: oomph_definitions.cc:313
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::GeneralPurposeBlockPreconditioner< MATRIX >::add_mesh(), oomph::CommandLineArgs::Argc, oomph::CommandLineArgs::Argv, Global_Physical_Variables::Constitutive_law_pt, Global_Physical_Variables::E, e(), oomph::IterativeLinearSolver::enable_doc_convergence_history(), Global_Physical_Variables::Gravity, Global_Physical_Variables::Nu, oomph::DocInfo::number(), oomph::oomph_info, oomph::oomph_nullstream, Global_Physical_Variables::P, oomph::IterativeLinearSolver::preconditioner_pt(), problem, oomph::DocInfo::set_directory(), oomph::GeneralPurposeBlockPreconditioner< MATRIX >::set_subsidiary_preconditioner_function(), Flag_definition::setup(), oomph::TrilinosAztecOOSolver::solver_type(), oomph::OomphInfo::stream_pt(), and oomph::TrilinosAztecOOSolver::tolerance().