8 #ifndef FETI_OPERATIONS_H_
9 #define FETI_OPERATIONS_H_
41 libMesh::Parallel::Communicator&
m_comm;
216 FETI_Operations(libMesh::Parallel::Communicator& comm,
const std::string& scratch_folder_path ,
const std::string& coupling_folder_path) :
218 m_bScratchFolderSet {
true },
219 m_bCouplingFolderSet {
true },
220 m_scratch_folder_path { scratch_folder_path },
221 m_coupling_folder_path { coupling_folder_path },
226 m_C_R_micro_M_local { -1},
227 m_C_R_micro_N_local { -1},
230 m_C_R_BIG_M_local { -1},
231 m_C_R_BIG_N_local { -1},
233 m_C_RR_M_local { -1},
234 m_bC_R_micro_MatrixSet {
false },
235 m_bC_R_BIG_MatrixSet {
false },
236 m_bC_RR_MatrixSet {
false },
237 m_bCouplingMatricesSet {
false },
238 m_bmicro_sizes_set {
false },
239 m_bBIG_sizes_set {
false },
240 m_bR_sizes_set {
false },
243 m_bCreatedPrecondSolver {
false },
244 m_bCreatedPrecondJacobiVec {
false },
245 m_null_nb_vecs { -1 },
246 m_null_vecs_N { -1 },
247 m_null_vecs_N_local { -1 },
248 m_bUsingNullVecs {
false },
249 m_bNullVecsSet {
false },
250 m_bNullVecsDimensionsSet {
false },
251 m_binvRITRIMatSet {
false },
254 m_current_rho { -1 },
255 m_current_RB_mode_corr { -1 },
256 m_previous_rho { -1 },
257 m_previous_RB_mode_corr { -1 },
258 m_bSet_u_0 {
false },
259 m_bSet_ext_solver_sol {
false },
260 m_bSet_current_residual {
false },
261 m_bSet_current_z {
false },
262 m_bSet_current_p {
false },
263 m_bSet_current_phi {
false },
264 m_bSet_current_RB_correction {
false },
265 m_bSet_previous_residual {
false },
266 m_bSet_previous_phi {
false },
267 m_bSet_previous_p_ptr {
false },
268 m_bSet_previous_q_ptr {
false },
269 m_bReadPreviousScalar {
false },
270 m_bCalculatedScalar {
false },
271 m_abs_residual_conv { -1 },
272 m_rel_residual_conv { -1 },
273 m_rb_modes_conv { -1 },
274 m_rel_residual_div { -1 },
275 m_max_iter_div { -1 },
276 m_bConvResidualAbs {
false },
277 m_bConvResidualRel {
false },
278 m_bConvRBCorrRel {
false },
279 m_bDivResidualRel {
false },
280 m_bDivResidualNeg {
false },
281 m_bDivIter {
false },
284 m_bCoupled_sols_set {
false}
289 FETI_Operations(libMesh::Parallel::Communicator& comm,
const std::string& scratch_folder_path) :
291 m_bScratchFolderSet {
true },
292 m_bCouplingFolderSet {
false },
293 m_scratch_folder_path { scratch_folder_path },
294 m_coupling_folder_path {
"" },
299 m_C_R_micro_M_local { -1},
300 m_C_R_micro_N_local { -1},
303 m_C_R_BIG_M_local { -1},
304 m_C_R_BIG_N_local { -1},
306 m_C_RR_M_local { -1},
307 m_bC_R_micro_MatrixSet {
false },
308 m_bC_R_BIG_MatrixSet {
false },
309 m_bC_RR_MatrixSet {
false },
310 m_bCouplingMatricesSet {
false },
311 m_bmicro_sizes_set {
false },
312 m_bBIG_sizes_set {
false },
313 m_bR_sizes_set {
false },
316 m_bCreatedPrecondSolver {
false },
317 m_bCreatedPrecondJacobiVec {
false },
318 m_null_nb_vecs { -1 },
319 m_null_vecs_N { -1 },
320 m_null_vecs_N_local { -1 },
321 m_bUsingNullVecs {
false },
322 m_bNullVecsSet {
false },
323 m_bNullVecsDimensionsSet {
false },
324 m_binvRITRIMatSet {
false },
327 m_current_rho { -1 },
328 m_current_RB_mode_corr { -1 },
329 m_previous_rho { -1 },
330 m_previous_RB_mode_corr { -1 },
331 m_bSet_u_0 {
false },
332 m_bSet_ext_solver_sol {
false },
333 m_bSet_current_residual {
false },
334 m_bSet_current_z {
false },
335 m_bSet_current_p {
false },
336 m_bSet_current_phi {
false },
337 m_bSet_current_RB_correction {
false },
338 m_bSet_previous_residual {
false },
339 m_bSet_previous_phi {
false },
340 m_bSet_previous_p_ptr {
false },
341 m_bSet_previous_q_ptr {
false },
342 m_bReadPreviousScalar {
false },
343 m_bCalculatedScalar {
false },
344 m_abs_residual_conv { -1 },
345 m_rel_residual_conv { -1 },
346 m_rb_modes_conv { -1 },
347 m_rel_residual_div { -1 },
348 m_max_iter_div { -1 },
349 m_bConvResidualAbs {
false },
350 m_bConvResidualRel {
false },
351 m_bConvRBCorrRel {
false },
352 m_bDivResidualRel {
false },
353 m_bDivResidualNeg {
false },
354 m_bDivIter {
false },
357 m_bCoupled_sols_set {
false}
390 void set_null_space(
const std::string& input_filename_base,
int nb_of_vecs);
461 IterationStatus check_convergence(
double rel_residual_conv,
double abs_residual_conv,
int max_iter_div,
double rel_residual_div,
double rb_modes_conv = -1);
double m_abs_residual_conv
Absolute residual convergence.
void export_inital_vecs()
Export the initial iteration vectors, r(0) and p(0)
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
double m_rho_0
Double containing the initial rho(0)
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
PetscInt m_null_vecs_N_local
void set_null_space(const std::string &input_filename_base, int nb_of_vecs)
Set and print the null space vectors and matrices.
bool m_bSet_u_0
Have the u_0 vectors been set?
PetscInt m_C_R_micro_M_local
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
IterationStatus m_FETI_solver_status
Current FETI / CG solver status.
bool m_bConvResidualRel
The residual converged? (relative to initial value)
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
PetscInt m_C_R_BIG_N_local
Vec m_previous_phi
Previous Lagrange multipliers / solution, phi(kkk)
std::string m_coupling_folder_path
Coupling matrices path.
FETI_Operations()
Default constructor.
void read_scalar_data()
Read the scalar data, rho(0 ... kkk), | RB_corr(0 ... kkk) | and p(0 ... kkk - 1).q(0 ... kkk - 1)
Mat m_C_RR
Mediator - mediator system coupling matrix.
double m_previous_RB_mode_corr
Double containing the previous RB_mode_corr(kkk)
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
void export_ext_solver_rhs(Vec vec_in)
Calculate and export the external solver RHS's.
KSP m_coupling_precond_solver
Preconditioner system solver.
void read_previous_phi()
Read the previous Lagrage multiplier / solution.
void read_all_previous_q()
Read all the previous q vectors.
void calculate_q()
Calculate the current q(kkk) vector.
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
~FETI_Operations()
Destructor, deallocates the PETSc.
void calculate_null_space_phi_0(const std::string &force_path)
Calculate the inital solution, .
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
Vec m_ext_solver_sol_micro
Micro model external solver solution.
void export_rb_correction_vector()
Export the rigid body modes correction.
void export_ext_solver_rhs_Ct_phi()
Calculate and export the external solver RHS's for the decoupled problem.
bool m_bDivIter
The number of iterations diverged?
void set_coupling_matrix_R_micro()
Read the mediator - micro system coupling matrix.
void export_r()
Export the current r(kkk+1) residual vector.
Vec m_u_0_BIG
Solution of the decoupled macro model.
std::string m_scratch_folder_path
Scratch folder path.
void calculate_z()
Calculate the current z(kkk+1) vector.
void export_q()
Export the current q(kkk) vector.
FETI_Operations(libMesh::Parallel::Communicator &comm, const std::string &scratch_folder_path, const std::string &coupling_folder_path)
Constructor with scratch folder path, coupling matrices base filename, and libMesh communicator...
Vec m_coupled_sol_micro
Coupled system solution for the micro model.
void calculate_phi()
Calculate the current phi(kkk+1) solution vector.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
void calculate_scalar_data()
Calculate the scalar quantities.
void read_previous_r()
Read the previous residual.
void read_rb_corr()
Read the rigid body modes correction vector.
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
int m_max_iter_div
Number of iterations divergence.
void export_p()
Export the current p(kkk+1) vector.
void calculate_initial_p()
Calculate the initial p(0) vector.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Class containing the operations needed for the FETI solver.
void read_jacobi_precond_vector()
Read the Jacobi coupling matrix preconditioner vector.
PetscInt m_C_R_BIG_M_local
void read_null_space_vecs(const std::string &RB_vectors_base, int nb_of_rb_vectors)
Read the null space vectors.
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
Vec m_u_0_micro
Solution of the decoupled micro model.
void set_coupling_matrix_RR()
Read the mediator - mediator system coupling matrix.
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
void read_vector_data()
Read the vector data - essentially calls the "read_previous" and "read_all_previous" methods...
void calculate_coupled_solution()
Calculate the final coupled solution.
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
void clear_PETSc()
PETSc Vec and Mat deallocation, called by the destructor.
bool m_bScratchFolderSet
Have the scratch folder been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
void calculate_rb_correction()
Calculate the rigid body modes corrections.
void export_initial_scalar_data()
Export the initial iteration scalar data, rho(0) and | RB_corr(0) |
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
void export_phi()
Export the current Lagrange multiplier / solution.
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
void increase_iter_counter()
Increase the iteration counter.
double m_current_RB_mode_corr
Double containing the current RB_mode_corr(kkk+1)
double m_rb_modes_conv
Relative RB correction convergence (relative to previous value)
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
double m_previous_rho
Double containing the previous rho(kkk)
bool m_bDiv
Did the solver diverge?
PetscInt m_C_R_micro_N_local
void calculate_r()
Calculate the current r(kkk+1) residual vector.
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
void read_all_previous_p()
Read all the previous p vectors.
IterationStatus check_convergence(double rel_residual_conv, double abs_residual_conv, int max_iter_div, double rel_residual_div, double rb_modes_conv=-1)
Check the convergence.
void calculate_p()
Calculate the current p(kkk+1) vector.
void set_jacobi_precond_vector()
Set up the Jacobi coupling matrix preconditioner vector.
void apply_inverse_coupling_precond(Vec vec_in, Vec vec_out)
Apply the full inversed coupling matrix preconditioner.
Vec m_coupled_sol_BIG
Coupled system solution for the macro model.
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
void set_coupling_matrix_R_BIG()
Read the mediator - macro system coupling matrix.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
Vec m_coupling_jacobi_precond_vec
Preconditioner Jacobi vector.
bool m_bReadPreviousScalar
Read the previous iterations scalar data?
bool m_bConvRBCorrRel
The RB correction converged? (relative to previous value)
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCouplingFolderSet
Have the Coupling matrices folder been set?
void read_null_space_inv_RITRI_mat()
Read the matrix.
void read_coupling_matrices()
Read all the coupling matrices.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
void using_rb_modes(bool bUseRigidBodyModes)
Set up the.
bool m_bConvResidualAbs
The residual converged? (absolute)
bool m_bCreatedPrecondJacobiVec
Have the preconditioner system solver been set?
bool m_bCouplingMatricesSet
All coupling matrices has been set?
double m_rel_residual_div
Relative residual divergence (relative to initial value)
void export_coupled_solution(std::string output_base)
void read_decoupled_solutions()
Read the decoupled solutions, .
bool m_bSet_ext_solver_sol
Have the external solvers solutions been set vectors been set?
bool m_bC_R_micro_MatrixSet
Mediator - micro coupling matrix has been set?
bool m_bmicro_sizes_set
Have the micro dimensions been set yet?
bool m_bSet_current_p
Have the current p(kkk+1) vector been set?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
void read_ext_solver_output()
Read the latest external solver output.
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
bool m_bSet_previous_phi
Have the previous Lagrange multipliers / solution phi(kkk) been set?
void print_previous_iters_conv(int nb_of_iters=5)
void apply_RB_projection(Vec vec_in, Vec vec_out)
Apply the rigid body modes projection operation.
void export_scalar_data()
Export the iteration scalar data, rho(kkk+1), | RB_corr(kkk+1) | and p(kkk).q(kkk) ...
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
Vec m_previous_residual
Previous residual vector, r(kkk)
void apply_jacobi_coupling_precond(Vec vec_in, Vec vec_out)
Apply the Jacobi coupling matrix preconditioner vector.
void export_ext_solver_rhs_Ct_p()
Calculate and export the external solver RHS's for the next iteration.
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
void apply_precond(Vec vec_in, Vec vec_out)
Common interface to the preconditionners.
Vec m_current_p
Current p(kkk+1) (p(0) for the initialization)
void calculate_initial_r()
Calculate the inital residual vector, r(0)
void export_ext_solver_rhs_initial()
Calculate and export the external solver RHS's for the first iteration.
Vec m_null_vecs[maxVecLimit]
Null space vectors.
void set_preconditioner(BaseCGPrecondType CG_precond_type, bool bInitialSet=true)
double m_current_rho
Double containing the current rho(kkk+1)
void set_inverse_precond_solver()
Set up the full inversed coupling matrix preconditioner.
FETI_Operations(libMesh::Parallel::Communicator &comm, const std::string &scratch_folder_path)
Constructor with scratch folder path and libMesh communicator.
bool m_bUsingNullVecs
Do we need to use the null space vectors?
bool m_bNullVecsSet
Have the null space vectors been set?