mpi/distribution/airy_cantilever/airy_cantilever2.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)
 

Variables

double Global_Physical_Variables::C2 =1.3
 "Mooney Rivlin" coefficient for generalised Mooney Rivlin law More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

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

606 {
607 #ifdef OOMPH_HAS_MPI
608  MPI_Helpers::init(argc,argv);
609 #endif
610 
611  DocInfo mesh_doc_info;
612  bool report_stats=true;
613  mesh_doc_info.number()=10;
614  mesh_doc_info.set_directory("RESLT_MESH");
615 
616  bool use_fd=false;
617 
618  // Is the material incomressible
619  bool incompress=false;
620 
621  // Number of cases per implementation
622  unsigned ncase=5;
623 
624 
625  // Loop over fd and analytical implementation
626  for (unsigned i=0;i<2;i++)
627  {
628 
629  // Generalised Hookean constitutive equations
630  //-------------------------------------------
631  {
635 
636  incompress=false;
637 
638 #ifdef REFINE
639  {
640  //Set up the problem with pure displacement based elements
642  problem(incompress,use_fd);
643 
644 #ifdef OOMPH_HAS_MPI
645  //Distribute it
646  std::ifstream input_file;
647  std::ofstream output_file;
648  char filename[100];
649 
650  // Get the partition from file
651  unsigned n_partition=problem.mesh_pt()->nelement();
652  Vector<unsigned> element_partition(n_partition);
653  sprintf(filename,"airy_cantilever_%i_partition.dat",0+i*ncase);
654  input_file.open(filename);
655  std::string input_string;
656  for (unsigned e=0;e<n_partition;e++)
657  {
658  getline(input_file,input_string,'\n');
659  element_partition[e]=atoi(input_string.c_str());
660  }
661 
662  problem.distribute(element_partition,mesh_doc_info,report_stats);
663 
664  problem.check_halo_schemes(mesh_doc_info);
665  mesh_doc_info.number()++;
666 #endif
667 
668  //Run it
669  problem.run_it(0+i*ncase);
670  }
671 #else
672  {
673  //Set up the problem with pure displacement based elements
675  problem(incompress,use_fd);
676 
677 #ifdef OOMPH_HAS_MPI
678  //Distribute it
679  std::ifstream input_file;
680  std::ofstream output_file;
681  char filename[100];
682 
683  // Get partition from file
684  unsigned n_partition=problem.mesh_pt()->nelement();
685  Vector<unsigned> element_partition(n_partition);
686  sprintf(filename,"airy_cantilever_%i_partition.dat",0+i*ncase);
687  input_file.open(filename);
688  std::string input_string;
689  for (unsigned e=0;e<n_partition;e++)
690  {
691  getline(input_file,input_string,'\n');
692  element_partition[e]=atoi(input_string.c_str());
693  }
694 
695  problem.distribute(element_partition,mesh_doc_info,report_stats);
696 
697  problem.check_halo_schemes(mesh_doc_info);
698  mesh_doc_info.number()++;
699 #endif
700 
701  //Run it
702  problem.run_it(0+i*ncase);
703  }
704 #endif
705 
706 
707 #ifdef REFINE
708  {
709  //Set up the problem with continous pressure/displacement
712  problem(incompress,use_fd);
713 
714 #ifdef OOMPH_HAS_MPI
715  //Distribute it
716  std::ifstream input_file;
717  std::ofstream output_file;
718  char filename[100];
719 
720  // Get partition from file
721  unsigned n_partition=problem.mesh_pt()->nelement();
722  Vector<unsigned> element_partition(n_partition);
723  sprintf(filename,"airy_cantilever_%i_partition.dat",1+i*ncase);
724  input_file.open(filename);
725  std::string input_string;
726  for (unsigned e=0;e<n_partition;e++)
727  {
728  getline(input_file,input_string,'\n');
729  element_partition[e]=atoi(input_string.c_str());
730  }
731 
732  problem.distribute(element_partition,mesh_doc_info,report_stats);
733 
734  problem.check_halo_schemes(mesh_doc_info);
735  mesh_doc_info.number()++;
736 #endif
737 
738  problem.run_it(1+i*ncase);
739  }
740 #else
741  {
742  //Set up the problem with continous pressure/displacement
745  problem(incompress,use_fd);
746 
747 #ifdef OOMPH_HAS_MPI
748  //Distribute it
749  std::ifstream input_file;
750  std::ofstream output_file;
751  char filename[100];
752 
753  // Get partition from file
754  unsigned n_partition=problem.mesh_pt()->nelement();
755  Vector<unsigned> element_partition(n_partition);
756  sprintf(filename,"airy_cantilever_%i_partition.dat",1+i*ncase);
757  input_file.open(filename);
758  std::string input_string;
759  for (unsigned e=0;e<n_partition;e++)
760  {
761  getline(input_file,input_string,'\n');
762  element_partition[e]=atoi(input_string.c_str());
763  }
764 
765  problem.distribute(element_partition,mesh_doc_info,report_stats);
766 
767  problem.check_halo_schemes(mesh_doc_info);
768  mesh_doc_info.number()++;
769 #endif
770 
771  problem.run_it(1+i*ncase);
772  }
773 #endif
774 
775 
776 #ifdef REFINE
777  {
778  //Set up the problem with discontinous pressure/displacement
780  RefineableQPVDElementWithPressure<2> > > problem(incompress,use_fd);
781 
782 #ifdef OOMPH_HAS_MPI
783  //Distribute it
784  std::ifstream input_file;
785  std::ofstream output_file;
786  char filename[100];
787 
788  // Get partition from file
789  unsigned n_partition=problem.mesh_pt()->nelement();
790  Vector<unsigned> element_partition(n_partition);
791  sprintf(filename,"airy_cantilever_%i_partition.dat",2+i*ncase);
792  input_file.open(filename);
793  std::string input_string;
794  for (unsigned e=0;e<n_partition;e++)
795  {
796  getline(input_file,input_string,'\n');
797  element_partition[e]=atoi(input_string.c_str());
798  }
799 
800  problem.distribute(element_partition,mesh_doc_info,report_stats);
801 
802  problem.check_halo_schemes(mesh_doc_info);
803  mesh_doc_info.number()++;
804 #endif
805 
806  problem.run_it(2+i*ncase);
807  }
808 #else
809  {
810  //Set up the problem with discontinous pressure/displacement
812  QPVDElementWithPressure<2> > > problem(incompress,use_fd);
813 
814 #ifdef OOMPH_HAS_MPI
815  //Distribute it
816  std::ifstream input_file;
817  std::ofstream output_file;
818  char filename[100];
819 
820  // Get partition from file
821  unsigned n_partition=problem.mesh_pt()->nelement();
822  Vector<unsigned> element_partition(n_partition);
823  sprintf(filename,"airy_cantilever_%i_partition.dat",2+i*ncase);
824  input_file.open(filename);
825  std::string input_string;
826  for (unsigned e=0;e<n_partition;e++)
827  {
828  getline(input_file,input_string,'\n');
829  element_partition[e]=atoi(input_string.c_str());
830  }
831 
832  problem.distribute(element_partition,mesh_doc_info,report_stats);
833 
834  problem.check_halo_schemes(mesh_doc_info);
835  mesh_doc_info.number()++;
836 #endif
837 
838  problem.run_it(2+i*ncase);
839  }
840 #endif
841 
844  }
845 
846 
847 
848  // Incompressible Mooney Rivlin
849  //-----------------------------
850  {
854 
855  // Define a constitutive law (based on strain energy function)
859 
860  incompress=true;
861 
862 
863 #ifdef REFINE
864  {
865  //Set up the problem with continous pressure/displacement
868  problem(incompress,use_fd);
869 
870 #ifdef OOMPH_HAS_MPI
871  //Distribute it
872  std::ifstream input_file;
873  std::ofstream output_file;
874  char filename[100];
875 
876  // Get partition from file
877  unsigned n_partition=problem.mesh_pt()->nelement();
878  Vector<unsigned> element_partition(n_partition);
879  sprintf(filename,"airy_cantilever_%i_partition.dat",3+i*ncase);
880  input_file.open(filename);
881  std::string input_string;
882  for (unsigned e=0;e<n_partition;e++)
883  {
884  getline(input_file,input_string,'\n');
885  element_partition[e]=atoi(input_string.c_str());
886  }
887 
888  problem.distribute(element_partition,mesh_doc_info,report_stats);
889 
890  problem.check_halo_schemes(mesh_doc_info);
891  mesh_doc_info.number()++;
892 #endif
893 
894  problem.run_it(3+i*ncase);
895  }
896 #else
897  {
898  //Set up the problem with continous pressure/displacement
901  problem(incompress,use_fd);
902 
903 #ifdef OOMPH_HAS_MPI
904  //Distribute it
905  std::ifstream input_file;
906  std::ofstream output_file;
907  char filename[100];
908 
909  // Get partition from file
910  unsigned n_partition=problem.mesh_pt()->nelement();
911  Vector<unsigned> element_partition(n_partition);
912  sprintf(filename,"airy_cantilever_%i_partition.dat",3+i*ncase);
913  input_file.open(filename);
914  std::string input_string;
915  for (unsigned e=0;e<n_partition;e++)
916  {
917  getline(input_file,input_string,'\n');
918  element_partition[e]=atoi(input_string.c_str());
919  }
920 
921  problem.distribute(element_partition,mesh_doc_info,report_stats);
922 
923  problem.check_halo_schemes(mesh_doc_info);
924  mesh_doc_info.number()++;
925 #endif
926 
927  problem.run_it(3+i*ncase);
928  }
929 #endif
930 
931 
932 
933 #ifdef REFINE
934  {
935  //Set up the problem with discontinous pressure/displacement
938  problem(incompress,use_fd);
939 
940 #ifdef OOMPH_HAS_MPI
941  //Distribute it
942  std::ifstream input_file;
943  std::ofstream output_file;
944  char filename[100];
945 
946  // Get partition from file
947  unsigned n_partition=problem.mesh_pt()->nelement();
948  Vector<unsigned> element_partition(n_partition);
949  sprintf(filename,"airy_cantilever_%i_partition.dat",4+i*ncase);
950  input_file.open(filename);
951  std::string input_string;
952  for (unsigned e=0;e<n_partition;e++)
953  {
954  getline(input_file,input_string,'\n');
955  element_partition[e]=atoi(input_string.c_str());
956  }
957 
958  problem.distribute(element_partition,mesh_doc_info,report_stats);
959 
960  problem.check_halo_schemes(mesh_doc_info);
961  mesh_doc_info.number()++;
962 #endif
963 
964  problem.run_it(4+i*ncase);
965  }
966 #else
967  {
968  //Set up the problem with discontinous pressure/displacement
971  problem(incompress,use_fd);
972 
973 #ifdef OOMPH_HAS_MPI
974  //Distribute it
975  std::ifstream input_file;
976  std::ofstream output_file;
977  char filename[100];
978 
979  // Get partition from file
980  unsigned n_partition=problem.mesh_pt()->nelement();
981  Vector<unsigned> element_partition(n_partition);
982  sprintf(filename,"airy_cantilever_%i_partition.dat",4+i*ncase);
983  input_file.open(filename);
984  std::string input_string;
985  for (unsigned e=0;e<n_partition;e++)
986  {
987  getline(input_file,input_string,'\n');
988  element_partition[e]=atoi(input_string.c_str());
989  }
990 
991  problem.distribute(element_partition,mesh_doc_info,report_stats);
992 
993  problem.check_halo_schemes(mesh_doc_info);
994  mesh_doc_info.number()++;
995 #endif
996 
997  problem.run_it(4+i*ncase);
998  }
999 #endif
1000 
1003 
1006  }
1007 
1008 
1009  use_fd=true;
1010  std::cout << "\n\n\n CR Total fill_in... : bla \n\n\n " << std::endl;
1011 
1012  }
1013 
1014 #ifdef OOMPH_HAS_MPI
1015  MPI_Helpers::finalize();
1016 #endif
1017 
1018 } //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
Wrapper class for solid element to modify the output.
Definition: mpi/distribution/airy_cantilever/airy_cantilever2.cc:53
Definition: solid_elements.h:1523
Definition: solid_elements.h:1332
Definition: refineable_solid_elements.h:826
Definition: refineable_solid_elements.h:436
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().