CArl
Code Arlequin / C++ implementation
CArl_FETI_setup_init.cpp File Reference

Program responsible to initialize the FETI setup and launch the iterations. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program responsible to initialize the FETI setup and launch the iterations.

This program's input file description can be found at the documentation of the function carl::get_input_params(GetPot& field_parser, feti_setup_init_params& input_params).

If the rigid body modes are used (input_params.bUseRigidBodyModes = true), it will use the following files ...

  • ... from the input_params.coupling_folder_path folder:
    • coupling matrices $C_1$ and $C_2$. Files:
      coupling_matrix_macro.petscmat
      coupling_matrix_micro.petscmat
      
  • ... from the micro system folder
    • external force work. File:
      [input_params.force_micro_path]
      
    • rigid body mode vectors. Files:
      [input_params.RB_vectors_base]_rb_vector_[iii]_n_[nb. of vectors].petscvec
      

It will create a scratch folder with the path input_params.scratch_folder_path, and create the following files:

  • Scripts to launch the other solver steps:
    FETI_init_script.sh
    FETI_iter_script.sh
    FETI_sol_script.sh
    
  • Scripts to launch the external solvers:
    ext_solver_A.sh
    ext_solver_B.sh
    ext_solver_u0_A.sh
    ext_solver_u0_B.sh
    
  • Scripts to launch the other CArl_FETI_*** binaries:
    CArl_FETI_setup_finish.sh
    CArl_FETI_iterate.sh
    CArl_FETI_solution.sh
    
  • Input files for the external solvers and other CArl_FETI_*** binaries:
    ext_solver_A.txt
    ext_solver_B.txt
    ext_solver_u0_A.txt
    ext_solver_u0_B.txt
    CArl_FETI_iterate.txt
    CArl_FETI_solution.txt
    CArl_FETI_setup_finish.txt
    
  • Right hand side vectors for the external solvers:
    ext_solver_A_rhs.petscvec
    ext_solver_B_rhs.petscvec
    
  • If the rigid body modes are used ...
    • [RB] initial solution (the Lagrange multipliers)
      FETI_iter__phi__current.petscvec
      
    • [RB] products between $C_2$ and the rigid body modes vectors ([nb. of vectors] is the number of rigid body mode vectors (given by input_params.nb_of_rb_vectors) and [iii] is an integer going from 0 to input_params.nb_of_rb_vectors - 1, following C++ notation)
      rb_coupl_vector_[iii]_n_[nb. of vectors].petscvec
      
    • [RB] matrix $\mbox{inv}(R_I^t * R_I) = \mbox{inv}(R_2^t*C_2^t*C_2*R_2)$, used for the rigid body modes projections
      rb_inv_RITRI.petscmat

Definition in file CArl_FETI_setup_init.cpp.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 76 of file CArl_FETI_setup_init.cpp.

76  {
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();
151  feti_op.export_ext_solver_rhs_Ct_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 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...
std::string exec_command(const std::string &cmd)
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.
int nb_of_rb_vectors
[RB] Number of RB mode vectors.
std::string force_micro_path
[RB] Path to the vector containing the external forces for the system B.