CArl
Code Arlequin / C++ implementation
CArl_FETI_setup_init.cpp
Go to the documentation of this file.
1 #include "CArl_FETI_setup_init.h"
2 
76 int main(int argc, char** argv) {
77 
78  // --- Initialize libMesh
79  libMesh::LibMeshInit init(argc, argv);
80 
81  // Do performance log?
82  libMesh::PerfLog perf_log("Main program");
83 
84  // libMesh's C++ / MPI communicator wrapper
85  libMesh::Parallel::Communicator& WorldComm = init.comm();
86 
87  // Number of processors and processor rank.
88  int rank = WorldComm.rank();
89  int nodes = WorldComm.size();
90 
91  // --- Set up inputs
92 
93  // Command line parser
94  GetPot command_line(argc, argv);
95 
96  // File parser
97  GetPot field_parser;
98 
99  // If there is an input file, parse it to get the parameters. Else, parse the command line
100  std::string input_filename;
101  if (command_line.search(2, "--inputfile", "-i")) {
102  input_filename = command_line.next(input_filename);
103  field_parser.parse_input_file(input_filename, "#", "\n", " \t\n");
104  } else {
105  field_parser = command_line;
106  }
107 
108  carl::feti_setup_init_params input_params;
109  get_input_params(field_parser, input_params);
110  carl::Solver_Files_Setup FETI_files_setup(WorldComm,input_params);
111 
112  // --- Crete the files / folders needed
113  // Create the scratch folder
114  FETI_files_setup.set_scratch_folder();
115 
116  // [LIBMESH] Create the external solver input files
117  FETI_files_setup.generate_libmesh_external_solver_inputs();
118 
119  // [LIBMESH] Create the external solver scripts
120  FETI_files_setup.generate_libmesh_external_solver_scripts();
121 
122  // Create FETI input files
123  FETI_files_setup.generate_FETI_inputs();
124 
125  // Create FETI script files
126  FETI_files_setup.generate_FETI_scripts();
127 
128  // Create FETI lauch script files
129  FETI_files_setup.generate_FETI_launch_scripts();
130 
131  // --- Calculate phi(0), if needed
132  if(input_params.bUseRigidBodyModes)
133  {
134  carl::FETI_Operations feti_op(WorldComm,input_params.scratch_folder_path,input_params.coupling_folder_path);
135 
136  // --- Define if the rb modes will be used or not
137  feti_op.using_rb_modes(input_params.bUseRigidBodyModes);
138 
139  // Read the matrices
140  feti_op.set_coupling_matrix_R_micro();
141  feti_op.set_coupling_matrix_R_BIG();
142 
143  // Set the null space
144  feti_op.set_null_space(input_params.RB_vectors_base,input_params.nb_of_rb_vectors);
145 
146  // Calculate the inital solution
147  feti_op.calculate_null_space_phi_0(input_params.force_micro_path);
148 
149  // Export the vectors
150  feti_op.export_phi();
152  }
153 
154  // --- Launch the "init_script.sh" script --- ONLY ON THE FIRST PROC!
155  if(WorldComm.rank() == 0)
156  {
157  std::string init_script_command = ". " + input_params.scratch_folder_path + "/FETI_init_script.sh";
158  if(input_params.scheduler == carl::ClusterSchedulerType::LOCAL)
159  {
160  std::cout << " !!! LOCAL job 'scheduler: Run the following script manually: " << std::endl;
161  std::cout << init_script_command << std::endl << std::endl;
162  } else {
163  carl::exec_command(init_script_command);
164  }
165  }
166 
167  return 0;
168 }
bool bUseRigidBodyModes
[RB] Use the rigid body modes for the micro system?
void set_null_space(const std::string &input_filename_base, int nb_of_vecs)
Set and print the null space vectors and matrices.
void get_input_params(GetPot &field_parser, feti_iterate_params &input_params)
Parser function for the coupled solver test programs.
ClusterSchedulerType scheduler
Cluster scheduler software type. Values: PBS, SLURM (code not implemented for the later yet)...
std::string scratch_folder_path
Path to the folder which will be used to save the temporary files during the solve operation...
void calculate_null_space_phi_0(const std::string &force_path)
Calculate the inital solution, .
std::string exec_command(const std::string &cmd)
void export_ext_solver_rhs_Ct_phi()
Calculate and export the external solver RHS's for the decoupled problem.
void set_coupling_matrix_R_micro()
Read the mediator - micro system coupling matrix.
std::string coupling_folder_path
Path to the folder containing the coupling matrices.
std::string RB_vectors_base
[RB] Common path base for the micro system's rigid body mode vectors.
Class containing the operations needed for the FETI solver.
Structure containing the parameters for the setup initialization of the FETI solver.
void export_phi()
Export the current Lagrange multiplier / solution.
int nb_of_rb_vectors
[RB] Number of RB mode vectors.
int main(int argc, char **argv)
void set_coupling_matrix_R_BIG()
Read the mediator - macro system coupling matrix.
void using_rb_modes(bool bUseRigidBodyModes)
Set up the.
std::string force_micro_path
[RB] Path to the vector containing the external forces for the system B.