mpi/distribution/three_d_cantilever/three_d_cantilever.cc File Reference

Classes

class  RefineableElasticQuarterTubeMesh< ELEMENT >
 Simple quarter tube mesh upgraded to become a solid mesh. More...
 
class  ElasticQuarterTubeMesh< ELEMENT >
 Simple quarter tube mesh upgraded to become a solid mesh. More...
 
class  RefineableElasticCubicMesh< ELEMENT >
 Simple cubic mesh upgraded to become a solid mesh. More...
 
class  ElasticCubicMesh< ELEMENT >
 Simple cubic mesh upgraded to become a solid mesh. More...
 
class  CantileverProblem< ELEMENT >
 Problem class for the cantilever "beam" structure. More...
 

Namespaces

 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

736 {
737 #ifdef OOMPH_HAS_MPI
738  MPI_Helpers::init(argc,argv);
739 #endif
740 
741  DocInfo mesh_doc_info;
742  bool report_stats=true;
743  mesh_doc_info.number()=10;
744  mesh_doc_info.set_directory("RESLT_MESH");
745 
746  // Use finite differencing
747  bool use_fd=false;
748 
749  // Number of cases per implementation
750  unsigned ncase=5;
751 
752  // Is the material incomressible
753  bool incompress=true;
754 
755  // Loop over fd and analytical implementation
756  for (unsigned i=0;i<2;i++)
757  {
758 
759  // Generalised Hookean constitutive equations
760  //-------------------------------------------
761  {
765 
766  incompress=false;
767 
768 #ifdef REFINE
769  {
770  //Set up the problem with pure displacement based elements
772  problem(incompress,use_fd);
773 
774 #ifdef OOMPH_HAS_MPI
775  //Distribute it
776  std::ifstream input_file;
777  std::ofstream output_file;
778  char filename[100];
779 
780  // Get partition from file
781  unsigned n_partition=problem.mesh_pt()->nelement();
782  Vector<unsigned> element_partition(n_partition);
783  sprintf(filename,"three_d_cantilever_%i_partition.dat",0+i*ncase);
784  input_file.open(filename);
785  std::string input_string;
786  for (unsigned e=0;e<n_partition;e++)
787  {
788  getline(input_file,input_string,'\n');
789  element_partition[e]=atoi(input_string.c_str());
790  }
791 
792  problem.distribute(element_partition,mesh_doc_info,report_stats);
793 
794  problem.check_halo_schemes(mesh_doc_info);
795  mesh_doc_info.number()++;
796 #endif
797 
798  problem.run_it(0+i*ncase);
799  }
800 #else
801  {
802  //Set up the problem with pure displacement based elements
804  problem(incompress,use_fd);
805 
806 #ifdef OOMPH_HAS_MPI
807  //Distribute it
808  std::ifstream input_file;
809  std::ofstream output_file;
810  char filename[100];
811 
812  // Get partition from file
813  unsigned n_partition=problem.mesh_pt()->nelement();
814  Vector<unsigned> element_partition(n_partition);
815  sprintf(filename,"three_d_cantilever_%i_partition.dat",0+i*ncase);
816  input_file.open(filename);
817  std::string input_string;
818  for (unsigned e=0;e<n_partition;e++)
819  {
820  getline(input_file,input_string,'\n');
821  element_partition[e]=atoi(input_string.c_str());
822  }
823 
824  problem.distribute(element_partition,mesh_doc_info,report_stats);
825 
826  problem.check_halo_schemes(mesh_doc_info);
827  mesh_doc_info.number()++;
828 #endif
829 
830  problem.run_it(0+i*ncase);
831  }
832 #endif
833 
834 
835 #ifdef REFINE
836  {
837  //Set up the problem with continous pressure/displacement
839  problem(incompress,use_fd);
840 
841 #ifdef OOMPH_HAS_MPI
842  //Distribute it
843  std::ifstream input_file;
844  std::ofstream output_file;
845  char filename[100];
846 
847  // Get partition from file
848  unsigned n_partition=problem.mesh_pt()->nelement();
849  Vector<unsigned> element_partition(n_partition);
850  sprintf(filename,"three_d_cantilever_%i_partition.dat",1+i*ncase);
851  input_file.open(filename);
852  std::string input_string;
853  for (unsigned e=0;e<n_partition;e++)
854  {
855  getline(input_file,input_string,'\n');
856  element_partition[e]=atoi(input_string.c_str());
857  }
858 
859  problem.distribute(element_partition,mesh_doc_info,report_stats);
860 
861  problem.check_halo_schemes(mesh_doc_info);
862  mesh_doc_info.number()++;
863 #endif
864 
865  problem.run_it(1+i*ncase);
866  }
867 #else
868  {
869  //Set up the problem with continous pressure/displacement
871  problem(incompress,use_fd);
872 
873 #ifdef OOMPH_HAS_MPI
874  //Distribute it
875  std::ifstream input_file;
876  std::ofstream output_file;
877  char filename[100];
878 
879  // Get partition from file
880  unsigned n_partition=problem.mesh_pt()->nelement();
881  Vector<unsigned> element_partition(n_partition);
882  sprintf(filename,"three_d_cantilever_%i_partition.dat",0+i*ncase);
883  input_file.open(filename);
884  std::string input_string;
885  for (unsigned e=0;e<n_partition;e++)
886  {
887  getline(input_file,input_string,'\n');
888  element_partition[e]=atoi(input_string.c_str());
889  }
890 
891  problem.distribute(element_partition,mesh_doc_info,report_stats);
892 
893  problem.check_halo_schemes(mesh_doc_info);
894  mesh_doc_info.number()++;
895 #endif
896 
897  problem.run_it(1+i*ncase);
898  }
899 #endif
900 
901 
902 
903 #ifdef REFINE
904  {
905  //Set up the problem with discontinous pressure/displacement
907  problem(incompress,use_fd);
908 
909 #ifdef OOMPH_HAS_MPI
910  //Distribute it
911  std::ifstream input_file;
912  std::ofstream output_file;
913  char filename[100];
914 
915  // Get partition from file
916  unsigned n_partition=problem.mesh_pt()->nelement();
917  Vector<unsigned> element_partition(n_partition);
918  sprintf(filename,"three_d_cantilever_%i_partition.dat",1+i*ncase);
919  input_file.open(filename);
920  std::string input_string;
921  for (unsigned e=0;e<n_partition;e++)
922  {
923  getline(input_file,input_string,'\n');
924  element_partition[e]=atoi(input_string.c_str());
925  }
926 
927  problem.distribute(element_partition,mesh_doc_info,report_stats);
928 
929  problem.check_halo_schemes(mesh_doc_info);
930  mesh_doc_info.number()++;
931 #endif
932 
933  problem.run_it(2+i*ncase);
934  }
935 #else
936  {
937  //Set up the problem with discontinous pressure/displacement
939  problem(incompress,use_fd);
940 
941 #ifdef OOMPH_HAS_MPI
942  //Distribute it
943  std::ifstream input_file;
944  std::ofstream output_file;
945  char filename[100];
946 
947  // Get partition from file
948  unsigned n_partition=problem.mesh_pt()->nelement();
949  Vector<unsigned> element_partition(n_partition);
950  sprintf(filename,"three_d_cantilever_%i_partition.dat",0+i*ncase);
951  input_file.open(filename);
952  std::string input_string;
953  for (unsigned e=0;e<n_partition;e++)
954  {
955  getline(input_file,input_string,'\n');
956  element_partition[e]=atoi(input_string.c_str());
957  }
958 
959  problem.distribute(element_partition,mesh_doc_info,report_stats);
960 
961  problem.check_halo_schemes(mesh_doc_info);
962  mesh_doc_info.number()++;
963 #endif
964 
965  problem.run_it(2+i*ncase);
966  }
967 #endif
968 
971  }
972 
973 
974 
975  // Incompressible Mooney Rivlin
976  //-----------------------------
977  {
981 
982  // Define a constitutive law (based on strain energy function)
986 
987  incompress=true;
988 
989 
990 #ifdef REFINE
991  {
992  //Set up the problem with continous pressure/displacement
994  problem(incompress,use_fd);
995 
996 #ifdef OOMPH_HAS_MPI
997  //Distribute it
998  std::ifstream input_file;
999  std::ofstream output_file;
1000  char filename[100];
1001 
1002  // Get partition from file
1003  unsigned n_partition=problem.mesh_pt()->nelement();
1004  Vector<unsigned> element_partition(n_partition);
1005  sprintf(filename,"three_d_cantilever_%i_partition.dat",3+i*ncase);
1006  input_file.open(filename);
1007  std::string input_string;
1008  for (unsigned e=0;e<n_partition;e++)
1009  {
1010  getline(input_file,input_string,'\n');
1011  element_partition[e]=atoi(input_string.c_str());
1012  }
1013 
1014  problem.distribute(element_partition,mesh_doc_info,report_stats);
1015 
1016  problem.check_halo_schemes(mesh_doc_info);
1017  mesh_doc_info.number()++;
1018 #endif
1019 
1020  problem.run_it(3+i*ncase);
1021  }
1022 #else
1023  {
1024  //Set up the problem with continous pressure/displacement
1026  problem(incompress,use_fd);
1027 
1028 #ifdef OOMPH_HAS_MPI
1029  //Distribute it
1030  std::ifstream input_file;
1031  std::ofstream output_file;
1032  char filename[100];
1033 
1034  // Get partition from file
1035  unsigned n_partition=problem.mesh_pt()->nelement();
1036  Vector<unsigned> element_partition(n_partition);
1037  sprintf(filename,"three_d_cantilever_%i_partition.dat",3+i*ncase);
1038  input_file.open(filename);
1039  std::string input_string;
1040  for (unsigned e=0;e<n_partition;e++)
1041  {
1042  getline(input_file,input_string,'\n');
1043  element_partition[e]=atoi(input_string.c_str());
1044  }
1045 
1046  problem.distribute(element_partition,mesh_doc_info,report_stats);
1047 
1048  problem.check_halo_schemes(mesh_doc_info);
1049  mesh_doc_info.number()++;
1050 #endif
1051 
1052  problem.run_it(3+i*ncase);
1053  }
1054 #endif
1055 
1056 
1057 
1058 #ifdef REFINE
1059  {
1060  //Set up the problem with discontinous pressure/displacement
1062  problem(incompress,use_fd);
1063 
1064 #ifdef OOMPH_HAS_MPI
1065  //Distribute it
1066  std::ifstream input_file;
1067  std::ofstream output_file;
1068  char filename[100];
1069 
1070  // Get partition from file
1071  unsigned n_partition=problem.mesh_pt()->nelement();
1072  Vector<unsigned> element_partition(n_partition);
1073  sprintf(filename,"three_d_cantilever_%i_partition.dat",4+i*ncase);
1074  input_file.open(filename);
1075  std::string input_string;
1076  for (unsigned e=0;e<n_partition;e++)
1077  {
1078  getline(input_file,input_string,'\n');
1079  element_partition[e]=atoi(input_string.c_str());
1080  }
1081 
1082  problem.distribute(element_partition,mesh_doc_info,report_stats);
1083 
1084  problem.check_halo_schemes(mesh_doc_info);
1085  mesh_doc_info.number()++;
1086 #endif
1087 
1088  problem.run_it(4+i*ncase);
1089  }
1090 #else
1091  {
1092  //Set up the problem with discontinous pressure/displacement
1094  problem(incompress,use_fd);
1095 
1096 #ifdef OOMPH_HAS_MPI
1097  //Distribute it
1098  std::ifstream input_file;
1099  std::ofstream output_file;
1100  char filename[100];
1101 
1102  // Get partition from file
1103  unsigned n_partition=problem.mesh_pt()->nelement();
1104  Vector<unsigned> element_partition(n_partition);
1105  sprintf(filename,"three_d_cantilever_%i_partition.dat",4+i*ncase);
1106  input_file.open(filename);
1107  std::string input_string;
1108  for (unsigned e=0;e<n_partition;e++)
1109  {
1110  getline(input_file,input_string,'\n');
1111  element_partition[e]=atoi(input_string.c_str());
1112  }
1113 
1114  problem.distribute(element_partition,mesh_doc_info,report_stats);
1115 
1116  problem.check_halo_schemes(mesh_doc_info);
1117  mesh_doc_info.number()++;
1118 #endif
1119 
1120  problem.run_it(4+i*ncase);
1121  }
1122 #endif
1123 
1126 
1129  }
1130 
1131 
1132  use_fd=true;
1133  std::cout << "\n\n\n CR Total fill_in... : bla \n\n\n " << std::endl;
1134 
1135  }
1136 
1137 #ifdef OOMPH_HAS_MPI
1138  MPI_Helpers::finalize();
1139 #endif
1140 
1141 } //end of main
int i
Definition: BiCGSTAB_step_by_step.cpp:9
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: 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: constitutive_laws.h:699
Definition: constitutive_laws.h:801
Definition: constitutive_laws.h:145
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
double Nu
Poisson's ratio.
Definition: TwenteMeshGluing.cpp:71
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Definition: TwenteMeshGluing.cpp:65
double C1
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
Definition: TwenteMeshGluing.cpp:74
StrainEnergyFunction * Strain_energy_function_pt
Pointer to strain energy function.
Definition: TwenteMeshGluing.cpp:62
double C2
"Mooney Rivlin" coefficient for generalised Mooney Rivlin law
Definition: mpi/distribution/airy_cantilever/airy_cantilever2.cc:156
string filename
Definition: MergeRestartFiles.py:39
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References Global_Physical_Variables::C1, Global_Physical_Variables::C2, Global_Physical_Variables::Constitutive_law_pt, Global_Physical_Variables::E, e(), MergeRestartFiles::filename, i, Global_Physical_Variables::Nu, oomph::DocInfo::number(), problem, oomph::DocInfo::set_directory(), Global_Physical_Variables::Strain_energy_function_pt, and oomph::Global_string_for_annotation::string().