ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
int init ( int  argc,
char *  argv[] 
)

get the handle for the initialize function and call it

Definition at line 54 of file SolverModuleDriverParallel.C.

References SolverModuleDriver::changeLoads, SolverModuleDriver::color, SolverModuleDriver::Comm, SolverModuleDriver::Conn, SolverModuleDriver::Coord, SolverModuleDriver::isFSI, SolverModuleDriver::myPaneId, SolverModuleDriver::myRank, SolverModuleDriver::nConn, SolverModuleDriver::nElem, SolverModuleDriver::nElemNodes, SolverModuleDriver::nNodes, SolverModuleDriver::outfile, SolverModuleDriver::runs, SolverModuleDriver::ss, SolverModuleDriver::tNext, and SolverModuleDriver::usage().

Referenced by COM::parallelProgram().

54  {
55  std::cout << "SoverModuleDriver: running initializer ... " << std::endl;
56  // processing command-line flags
57  std::string arg;
58  double tmpTime;
59  if(argc > 1){
60  for(int i=1; i < argc; i++){
61  ss.clear();
62  ss.str("");
63  ss << argv[i];
64  if(ss.str() == "-com-mpi")
65  continue;
66  if(ss.str() == "-fsi"){
67  isFSI = true;
68  continue;
69  }
70  if(ss.str() == "-loads"){
71  changeLoads = true;
72  continue;
73  }
74  for(int j=0; j<ss.str().size(); j++){
75  if(!isdigit(ss.str()[j]) && ss.str()[j] != 'e'
76  && ss.str()[j] != 'E' && ss.str()[j] != '-'
77  && ss.str()[j] != '.')
78  usage(argv[0]);
79  }
80  ss >> tmpTime;
81  tNext.push_back(tmpTime);
82  }
83  }
84  else
85  usage(argv[0]);
86 
87  for(int i=1; i < tNext.size(); i++){
88  if(tNext[i] <= tNext[i-1]){
89  usage(argv[0]);
90  exit(1);
91  }
92  }
93 
94  // loading ElmerParallel module
95  COM_LOAD_MODULE_STATIC_DYNAMIC(ElmerCSCParallel, "ELMModule");
96 
97  // loading SimOut on all processes
98  COM_LOAD_MODULE_STATIC_DYNAMIC( SimOUT, "OUT");
99 
100  // check the communicator that the window was loaded on
101  MPI_Comm comm_check;
102  outfile << "Checking ELMModule" << std::endl;
103  outfile << "comm_check = " << comm_check << std::endl;
104  COM_get_communicator("ELMModule", &comm_check);
105  if(comm_check == Comm)
106  outfile << "comm_check == Comm!" << std::endl;
107  else if(comm_check == MPI_COMM_WORLD)
108  outfile << "comm_check == MPI_COMM_WORLD!" << std::endl;
109  else if(comm_check == MPI_COMM_SELF)
110  outfile << "comm_check == MPI_COMM_SELF!" << std::endl;
111  else
112  outfile << "comm_check == None!" << std::endl;
113 
114  // calling module initializer
115  if(color == 0){
117  int init_handle = COM_get_function_handle("ELMModule.Initialize");
118  bool init_func = (init_handle > 0);
119  int verb=1;
120  runs = 0;
121  if(init_func)
122  COM_call_function(init_handle, &runs, &verb);
123  }
124 
125  // FSI problems will register mesh data, accessing them
126  if(isFSI){
127  char getDataItemLoc;
128  COM_Type getDataItemType;
129  std::string getDataItemUnits;
130  // getting node coordinates
131  COM_get_array("ELMModule.nc", myPaneId, &Coord);
132  // check for expected number of nodes
133  COM_get_size("ELMModule.nc", myPaneId, &nNodes);
134  // get connectivity tables for paneIds
135  // :q4: is quad element
136  std::string stringNames;
137  COM_get_connectivities("ELMModule", myPaneId, &nConn, stringNames);
138  std::istringstream ConnISS(stringNames);
139  std::vector<std::string> connNames;
140  for (int i=0; i<nConn; ++i) {
141  std::string name;
142  ConnISS >> name;
143  connNames.push_back(name);
144  std::cout << "Rank #" << myRank
145  << ", ELMModuleDriver:main: Connectivity Table # " << i+1 << ": " << name << std::endl;
146  }
147  // number of nodes per element
148  std::string fullConnName("ELMModule."+connNames[0]);
149  COM_get_dataitem(fullConnName, &getDataItemLoc, &getDataItemType,
150  &nElemNodes, &getDataItemUnits);
151  std::cout << "Rank #" << myRank
152  << ", ELMModuleDriver:main: getDataItemLoc " << getDataItemLoc << std::endl;
153  std::cout << "Rank #" << myRank
154  << ", ELMModuleDriver:main: getDataItemType " << getDataItemType << std::endl;
155  std::cout << "Rank #" << myRank
156  << ", ELMModuleDriver:main: nElemNodes " << nElemNodes << std::endl;
157  std::cout << "Rank #" << myRank
158  << ", ELMModuleDriver:main: getDataItemUnits " << getDataItemUnits << std::endl;
159  // get connectivities
160  COM_get_array(fullConnName.c_str(), myPaneId, &Conn);
161  COM_get_size(fullConnName, myPaneId, &nElem);
162  }
163 
164  return 0;
165  }

Here is the call graph for this function:

Here is the caller graph for this function: