CArl
Code Arlequin / C++ implementation
carl_feti_setup_init_input_parser.cpp
Go to the documentation of this file.
1 /*
2  * carl_feti_setup_init_input_parser.h
3  *
4  * Created on: Feb 14, 2017
5  * Author: Thiago Milanetto Schlittler
6  */
7 
9 
10 namespace carl
11 {
12 
13 void get_input_params(GetPot& field_parser,
14  feti_setup_init_params& input_params) {
15 
16  if (field_parser.search(1, "ClusterSchedulerType")) {
17  std::string cluster_scheduler_type;
18  cluster_scheduler_type = field_parser.next(cluster_scheduler_type);
19  if(cluster_scheduler_type == "LOCAL")
20  {
21  std::cout << " !!! WARNING: " << std::endl;
22  std::cout << " The LOCAL 'scheduler' type is only intended for small and fast test cases" << std::endl;
23  std::cout << " on computers without a job scheduler (PBS, SLURM). You will have to launch" << std::endl;
24  std::cout << " each script MANUALLY!!! Reason: MPI does not support recursive 'mpirun' calls" << std::endl;
26  input_params.script_filename = "";
27  }
28  else if(cluster_scheduler_type == "PBS") {
30  if (field_parser.search(1, "ScriptFile")) {
31  input_params.script_filename = field_parser.next(input_params.script_filename);
32  } else {
33  homemade_error_msg("Missing the script file (needed for the PBS scheduler)!");
34  }
35  }
36  else if(cluster_scheduler_type == "SLURM") {
38  if (field_parser.search(1, "ScriptFile")) {
39  input_params.script_filename = field_parser.next(input_params.script_filename);
40  } else {
41  homemade_error_msg("Missing the script file (needed for the SLURM scheduler)!");
42  }
43  }
44  else
45  homemade_error_msg("Invalid scheduler type!");
46  } else {
47  homemade_error_msg("Missing the scheduler type!");
48  }
49 
50  if (field_parser.search(1, "ExtSolverA")) {
51  input_params.ext_solver_BIG = field_parser.next(
52  input_params.ext_solver_BIG);
53  std::cout << input_params.ext_solver_BIG << std::endl;
54  } else {
55  homemade_error_msg("Missing the external solver A command line!");
56  }
57 
58  if (field_parser.search(1, "ExtSolverB")) {
59  input_params.ext_solver_micro = field_parser.next(
60  input_params.ext_solver_micro);
61  std::cout << input_params.ext_solver_micro << std::endl;
62  } else {
63  homemade_error_msg("Missing the external solver B command line!");
64  }
65 
66  std::string ext_solver_type;
67  if (field_parser.search(1, "ExtSolverAType")) {
68  ext_solver_type = field_parser.next(
69  ext_solver_type);
70  std::cout << ext_solver_type << std::endl;
71  if(ext_solver_type == "LIBMESH_LINEAR")
72  {
74  } else {
75  homemade_error_msg("Invalid external solver A type!");
76  }
77  } else {
78  homemade_error_msg("Missing the external solver A type!");
79  }
80 
81  if (field_parser.search(1, "ExtSolverBType")) {
82  ext_solver_type = field_parser.next(
83  ext_solver_type);
84  std::cout << ext_solver_type << std::endl;
85  if(ext_solver_type == "LIBMESH_LINEAR")
86  {
88  } else {
89  homemade_error_msg("Invalid external solver B type!");
90  }
91  } else {
92  homemade_error_msg("Missing the external solver B type!");
93  }
94 
95  if (field_parser.search(1, "ExtSolverAInput")) {
96  input_params.ext_solver_BIG_input = field_parser.next(
97  input_params.ext_solver_BIG_input);
98  std::cout << input_params.ext_solver_BIG_input << std::endl;
99  } else {
100  homemade_error_msg("Missing the input file for the external solver A!");
101  }
102 
103  if (field_parser.search(1, "ExtSolverBInput")) {
104  input_params.ext_solver_micro_input = field_parser.next(
105  input_params.ext_solver_micro_input);
106  std::cout << input_params.ext_solver_micro_input << std::endl;
107  } else {
108  homemade_error_msg("Missing the input file for the external solver B!");
109  }
110 
111  if (field_parser.search(1, "ScratchFolderPath")) {
112  input_params.scratch_folder_path = field_parser.next(
113  input_params.scratch_folder_path);
114  std::cout << input_params.scratch_folder_path << std::endl;
115  } else {
116  homemade_error_msg("Missing the external scratch folder path!");
117  }
118 
119  if (field_parser.search(1, "CouplingMatricesFolder")) {
120  input_params.coupling_folder_path = field_parser.next(
121  input_params.coupling_folder_path);
122  std::cout << input_params.coupling_folder_path << std::endl;
123  } else {
124  homemade_error_msg("Missing the coupling matrices path!");
125  }
126 
127  if (field_parser.search(1,"UseRigidBodyModesB"))
128  {
129  input_params.bUseRigidBodyModes = true;
130  if (field_parser.search(1, "ExtForceSystemB")) {
131  input_params.force_micro_path = field_parser.next(
132  input_params.force_micro_path);
133  std::cout << input_params.force_micro_path << std::endl;
134  } else {
135  homemade_error_msg("Missing the system B's external force file path!");
136  }
137 
138  if (field_parser.search(1, "RBVectorBase")) {
139  input_params.RB_vectors_base = field_parser.next(
140  input_params.RB_vectors_base);
141  std::cout << input_params.RB_vectors_base << std::endl;
142  } else {
143  homemade_error_msg("Missing the system B's rigid body mode vectors!");
144  }
145 
146  if (field_parser.search(1, "NbOfRBVectors")) {
147  input_params.nb_of_rb_vectors = field_parser.next(
148  input_params.nb_of_rb_vectors);
149  } else {
150  input_params.nb_of_rb_vectors = 6;
151  }
152  }
153  else
154  {
155  input_params.bUseRigidBodyModes = false;
156  }
157 
158  // Set CG coupling solver convergence
159  input_params.CG_coupled_conv_abs = 1e-20;
160  input_params.CG_coupled_conv_rel = 1e-5;
161  input_params.CG_coupled_div = 1e5;
162  input_params.CG_coupled_conv_max = 1e4;
163  input_params.CG_coupled_conv_corr =1e-5;
164 
165  if( field_parser.search(1,"CoupledConvAbs") )
166  {
167  input_params.CG_coupled_conv_abs = field_parser.next(input_params.CG_coupled_conv_abs);
168  }
169  if( field_parser.search(1,"CoupledConvRel") )
170  {
171  input_params.CG_coupled_conv_rel = field_parser.next(input_params.CG_coupled_conv_rel);
172  }
173  if( field_parser.search(1,"CoupledCorrConvRel") )
174  {
175  input_params.CG_coupled_conv_corr = field_parser.next(input_params.CG_coupled_conv_corr);
176  }
177  if( field_parser.search(1,"CoupledDiv") )
178  {
179  input_params.CG_coupled_div = field_parser.next(input_params.CG_coupled_div);
180  }
181  if( field_parser.search(1,"CoupledIterMax") )
182  {
183  input_params.CG_coupled_conv_max = field_parser.next(input_params.CG_coupled_conv_max);
184  }
185 
187  if ( field_parser.search(1, "CGPreconditionerType") )
188  {
189  std::string CG_precond_type_string = field_parser.next(CG_precond_type_string);
190  if(CG_precond_type_string == "NONE")
192  else if(CG_precond_type_string == "Coupling_operator")
194  else if(CG_precond_type_string == "Coupling_operator_jacobi")
196  }
197 
198  if (field_parser.search(1,"OutputFolder")) {
199  input_params.output_folder = field_parser.next(
200  input_params.output_folder);
201  } else {
202  homemade_error_msg("Missing the output filename base!");
203  }
204 };
205 
206 };
bool bUseRigidBodyModes
[RB] Use the rigid body modes for the micro system?
double CG_coupled_div
[CG] Residual divergence.
#define homemade_error_msg(msg)
Definition: common_header.h:73
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 ext_solver_BIG_input
Path to a file containing the input parameters of the external solve for system A.
std::string scratch_folder_path
Path to the folder which will be used to save the temporary files during the solve operation...
std::string script_filename
Path to the file used to generate the scripts.
ExtSolverType ext_solver_BIG_type
Type of solver used for the external system A.
std::string ext_solver_micro_input
Path to a file containing the input parameters of the external solve for system B.
carl::BaseCGPrecondType CG_precond_type
[CG] Type of preconditionner.
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.
double CG_coupled_conv_abs
[CG] Absolute residual convergence.
Structure containing the parameters for the setup initialization of the FETI solver.
int nb_of_rb_vectors
[RB] Number of RB mode vectors.
int CG_coupled_conv_max
[CG] Maximum number of iterations.
std::string ext_solver_micro
Command used for the external solver for system B.
double CG_coupled_conv_rel
[CG] Relative residual convergence.
std::string force_micro_path
[RB] Path to the vector containing the external forces for the system B.
std::string ext_solver_BIG
Command used for the external solver for system A.
double CG_coupled_conv_corr
[CG] Relative rigid body mode convergence.
std::string output_folder
Path to the coupled solution folder.