Trilinos based (stochastic) FEM solvers
main.cpp
Go to the documentation of this file.
1 #include "Epetra_ConfigDefs.h"
2 #ifdef HAVE_MPI
3 #include "mpi.h"
4 #include "Epetra_MpiComm.h"
5 #else
6 #include "Epetra_SerialComm.h"
7 #endif
8 
9 #include "rubberblock.hpp"
10 #include "newtonRaphson.hpp"
11 
12 int main(int argc, char *argv[]){
13 
14  std::string xmlInFileName = "";
15 
16  Teuchos::CommandLineProcessor clp(false);
17  clp.setOption("xml-in-file",&xmlInFileName,"The XML file to read into a parameter list");
18  clp.setDocString("TO DO.");
19 
20  Teuchos::CommandLineProcessor::EParseCommandLineReturn
21  parse_return = clp.parse(argc,argv);
22  if( parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
23  std::cout << "\nEnd Result: TEST FAILED" << std::endl;
24  return parse_return;
25  }
26 
27 #ifdef HAVE_MPI
28 MPI_Init(&argc, &argv);
29  Epetra_MpiComm Comm(MPI_COMM_WORLD);
30 #else
31  Epetra_SerialComm Comm;
32 #endif
33 
34  Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::rcp(new Teuchos::ParameterList);
35  if(xmlInFileName.length()) {
36  Teuchos::updateParametersFromXmlFile(xmlInFileName, inoutArg(*paramList));
37  }
38 
39  if (Comm.MyPID()==0){
40  paramList->print(std::cout,2,true,true);
41  }
42 
43  Epetra_SerialDenseVector parameters(7);
44  Teuchos::RCP<rubberblock> interface = Teuchos::rcp(new rubberblock(Comm,*paramList));
45 
46  parameters(0) = Teuchos::getParameter<double>(paramList->sublist("rubberblock"),"lambda");
47  parameters(1) = Teuchos::getParameter<double>(paramList->sublist("rubberblock"),"mu");
48  interface->set_parameters(parameters);
49  Teuchos::RCP<newtonRaphson> Newton = Teuchos::rcp(new newtonRaphson(*interface,*paramList));
50 
51  double xi = 0.0;
52  double g = -interface->topcoord*0.3;
53  std::string pathsig22 = "sig22.mtx";
54  std::string pathe22 = "e22.mtx";
55  std::string pathsolut = "u.mtx";
56 
57  Newton->Initialization();
58  Newton->setParameters(*paramList);
59  Newton->bc_disp = g;
60  int error = Newton->Solve_with_Aztec(true);
61  //Newton->print_newton_solution(pathsolut);
62  //interface->compute_cauchy(*Newton->x,xi,xi,xi,pathsig22);
63  //interface->compute_green_lagrange(*Newton->x,xi,xi,xi,pathe22);
64 
65 #ifdef HAVE_MPI
66  MPI_Finalize();
67 #endif
68 return 0;
69 
70 }
int main(int argc, char *argv[])
Definition: main.cpp:23