CArl
Code Arlequin / C++ implementation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
carl::FETI_Operations Class Reference

Class containing the operations needed for the FETI solver. More...

#include <FETI_operations.h>

Public Member Functions

 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. More...
 
 FETI_Operations (libMesh::Parallel::Communicator &comm, const std::string &scratch_folder_path)
 Constructor with scratch folder path and libMesh communicator. More...
 
 ~FETI_Operations ()
 Destructor, deallocates the PETSc. More...
 
void set_coupling_matrix_R_micro ()
 Read the mediator - micro system coupling matrix. More...
 
void set_coupling_matrix_R_BIG ()
 Read the mediator - macro system coupling matrix. More...
 
void set_coupling_matrix_RR ()
 Read the mediator - mediator system coupling matrix. More...
 
void read_coupling_matrices ()
 Read all the coupling matrices. More...
 
void set_preconditioner (BaseCGPrecondType CG_precond_type, bool bInitialSet=true)
 
void using_rb_modes (bool bUseRigidBodyModes)
 Set up the. More...
 
void set_null_space (const std::string &input_filename_base, int nb_of_vecs)
 Set and print the null space vectors and matrices. More...
 
void read_null_space_vecs (const std::string &RB_vectors_base, int nb_of_rb_vectors)
 Read the null space vectors. More...
 
void read_null_space_inv_RITRI_mat ()
 Read the $ inv({R^I}^t \cdot R^I)$ matrix. More...
 
void calculate_null_space_phi_0 (const std::string &force_path)
 Calculate the inital solution, $\phi_0$. More...
 
void read_decoupled_solutions ()
 Read the decoupled solutions, $ u_0,i$. More...
 
void read_ext_solver_output ()
 Read the latest external solver output. More...
 
void read_rb_corr ()
 Read the rigid body modes correction vector. More...
 
void read_previous_phi ()
 Read the previous Lagrage multiplier / solution. More...
 
void read_previous_r ()
 Read the previous residual. More...
 
void read_all_previous_p ()
 Read all the previous p vectors. More...
 
void read_all_previous_q ()
 Read all the previous q vectors. More...
 
void read_scalar_data ()
 Read the scalar data, rho(0 ... kkk), | RB_corr(0 ... kkk) | and p(0 ... kkk - 1).q(0 ... kkk - 1) More...
 
void read_vector_data ()
 Read the vector data - essentially calls the "read_previous" and "read_all_previous" methods. More...
 
void calculate_initial_p ()
 Calculate the initial p(0) vector. More...
 
void calculate_initial_r ()
 Calculate the inital residual vector, r(0) More...
 
void calculate_p ()
 Calculate the current p(kkk+1) vector. More...
 
void calculate_q ()
 Calculate the current q(kkk) vector. More...
 
void calculate_r ()
 Calculate the current r(kkk+1) residual vector. More...
 
void calculate_z ()
 Calculate the current z(kkk+1) vector. More...
 
void calculate_phi ()
 Calculate the current phi(kkk+1) solution vector. More...
 
void calculate_rb_correction ()
 Calculate the rigid body modes corrections. More...
 
void calculate_scalar_data ()
 Calculate the scalar quantities. More...
 
void calculate_coupled_solution ()
 Calculate the final coupled solution. More...
 
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. More...
 
void increase_iter_counter ()
 Increase the iteration counter. More...
 
void export_ext_solver_rhs_Ct_p ()
 Calculate and export the external solver RHS's for the next iteration. More...
 
void export_ext_solver_rhs_initial ()
 Calculate and export the external solver RHS's for the first iteration. More...
 
void export_ext_solver_rhs_Ct_phi ()
 Calculate and export the external solver RHS's for the decoupled problem. More...
 
void export_rb_correction_vector ()
 Export the rigid body modes correction. More...
 
void export_p ()
 Export the current p(kkk+1) vector. More...
 
void export_q ()
 Export the current q(kkk) vector. More...
 
void export_r ()
 Export the current r(kkk+1) residual vector. More...
 
void export_phi ()
 Export the current Lagrange multiplier / solution. More...
 
void export_inital_vecs ()
 Export the initial iteration vectors, r(0) and p(0) More...
 
void export_initial_scalar_data ()
 Export the initial iteration scalar data, rho(0) and | RB_corr(0) | More...
 
void export_scalar_data ()
 Export the iteration scalar data, rho(kkk+1), | RB_corr(kkk+1) | and p(kkk).q(kkk) More...
 
void export_iter_vecs ()
 
void export_coupled_solution (std::string output_base)
 
void print_previous_iters_conv (int nb_of_iters=5)
 

Protected Types

enum  { maxVecLimit = 6 }
 

Protected Member Functions

void set_inverse_precond_solver ()
 Set up the full inversed coupling matrix preconditioner. More...
 
void set_jacobi_precond_vector ()
 Set up the Jacobi coupling matrix preconditioner vector. More...
 
void read_jacobi_precond_vector ()
 Read the Jacobi coupling matrix preconditioner vector. More...
 
void apply_inverse_coupling_precond (Vec vec_in, Vec vec_out)
 Apply the full inversed coupling matrix preconditioner. More...
 
void apply_jacobi_coupling_precond (Vec vec_in, Vec vec_out)
 Apply the Jacobi coupling matrix preconditioner vector. More...
 
void apply_precond (Vec vec_in, Vec vec_out)
 Common interface to the preconditionners. More...
 
void apply_RB_projection (Vec vec_in, Vec vec_out)
 Apply the rigid body modes projection operation. More...
 
void export_ext_solver_rhs (Vec vec_in)
 Calculate and export the external solver RHS's. More...
 
void clear_PETSc ()
 PETSc Vec and Mat deallocation, called by the destructor. More...
 
 FETI_Operations ()
 Default constructor. More...
 

Protected Attributes

libMesh::Parallel::Communicator & m_comm
 Communicator. More...
 
bool m_bScratchFolderSet
 Have the scratch folder been set? More...
 
bool m_bCouplingFolderSet
 Have the Coupling matrices folder been set? More...
 
std::string m_scratch_folder_path
 Scratch folder path. More...
 
std::string m_coupling_folder_path
 Coupling matrices path. More...
 
IterationStatus m_FETI_solver_status
 Current FETI / CG solver status. More...
 
int m_kkk
 Current iteration index. More...
 
Mat m_C_R_micro
 Mediator - micro system coupling matrix. More...
 
Mat m_C_R_BIG
 Mediator - macro system coupling matrix. More...
 
Mat m_C_RR
 Mediator - mediator system coupling matrix. More...
 
PetscInt m_C_R_micro_M
 
PetscInt m_C_R_micro_N
 
PetscInt m_C_R_micro_M_local
 
PetscInt m_C_R_micro_N_local
 
PetscInt m_C_R_BIG_M
 
PetscInt m_C_R_BIG_N
 
PetscInt m_C_R_BIG_M_local
 
PetscInt m_C_R_BIG_N_local
 
PetscInt m_C_RR_M
 
PetscInt m_C_RR_M_local
 
KSP m_coupling_precond_solver
 Preconditioner system solver. More...
 
Vec m_coupling_jacobi_precond_vec
 Preconditioner Jacobi vector. More...
 
bool m_bC_R_micro_MatrixSet
 Mediator - micro coupling matrix has been set? More...
 
bool m_bC_R_BIG_MatrixSet
 Mediator - macro coupling matrix has been set? More...
 
bool m_bC_RR_MatrixSet
 Mediator - mediator coupling matrix has been set? More...
 
bool m_bCouplingMatricesSet
 All coupling matrices has been set? More...
 
bool m_bmicro_sizes_set
 Have the micro dimensions been set yet? More...
 
bool m_bBIG_sizes_set
 Have the macro dimensions been set yet? More...
 
bool m_bR_sizes_set
 Have the mediator dimensions been set yet? More...
 
BaseCGPrecondType m_precond_type
 Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER. More...
 
RBModesSystem m_RB_modes_system
 Which model is associated to the RB modes? Default: RBModesSystem::MICRO. More...
 
bool m_bCreatedPrecondSolver
 Have the preconditioner system solver been set? More...
 
bool m_bCreatedPrecondJacobiVec
 Have the preconditioner system solver been set? More...
 
PetscInt m_null_nb_vecs
 Number of null space vectors. More...
 
Vec m_null_vecs [maxVecLimit]
 Null space vectors. More...
 
Vec m_null_coupled_vecs [maxVecLimit]
 Null space vectors times the coupling matrix. More...
 
PetscInt m_null_vecs_N
 
PetscInt m_null_vecs_N_local
 
Mat m_RITRI_mat
 Matrix ${R^I}^t \cdot R^I = R^t C^t \cdot C R $. More...
 
Mat m_inv_RITRI_mat
 Matrix $ inv({R^I}^t \cdot R^I)$, used in some projectors. More...
 
bool m_bUsingNullVecs
 Do we need to use the null space vectors? More...
 
bool m_bNullVecsSet
 Have the null space vectors been set? More...
 
bool m_bNullVecsDimensionsSet
 Have the null space vectors' dimensions been set? More...
 
bool m_binvRITRIMatSet
 Have the inv(RI^T * RI) matrix been set? More...
 
Vec m_u_0_micro
 Solution of the decoupled micro model. More...
 
Vec m_u_0_BIG
 Solution of the decoupled macro model. More...
 
Vec m_ext_solver_sol_micro
 Micro model external solver solution. More...
 
Vec m_ext_solver_sol_BIG
 Macro model external solver solution. More...
 
Vec m_current_residual
 Current residual vector, r(kkk+1) (r(0) for the initialization) More...
 
Vec m_current_z
 Current z(kkk+1) (z(0) for the initialization) More...
 
Vec m_current_p
 Current p(kkk+1) (p(0) for the initialization) More...
 
Vec m_current_phi
 Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) More...
 
Vec m_current_rb_correction
 Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) More...
 
Vec m_previous_residual
 Previous residual vector, r(kkk) More...
 
Vec m_previous_phi
 Previous Lagrange multipliers / solution, phi(kkk) More...
 
Vec * m_previous_p_ptr
 Pointer to the previous p vectors, p(0 ... kkk) More...
 
Vec * m_previous_q_ptr
 Pointer to the previous q vectors, q(0 ... kkk) More...
 
double m_gamma
 Double containing the value of rho(kkk) / p(kkk) . q(kkk) More...
 
double m_rho_0
 Double containing the initial rho(0) More...
 
double m_current_rho
 Double containing the current rho(kkk+1) More...
 
double m_current_RB_mode_corr
 Double containing the current RB_mode_corr(kkk+1) More...
 
double m_previous_rho
 Double containing the previous rho(kkk) More...
 
double m_previous_RB_mode_corr
 Double containing the previous RB_mode_corr(kkk) More...
 
bool m_bSet_u_0
 Have the u_0 vectors been set? More...
 
bool m_bSet_ext_solver_sol
 Have the external solvers solutions been set vectors been set? More...
 
bool m_bSet_current_residual
 Have the current r(kkk+1) vector been set? More...
 
bool m_bSet_current_z
 Have the current z(kkk+1) vector been set? More...
 
bool m_bSet_current_p
 Have the current p(kkk+1) vector been set? More...
 
bool m_bSet_current_phi
 Have the current Lagrange multipliers / solution phi(kkk+1) been set? More...
 
bool m_bSet_current_RB_correction
 Have the RB modes correction RB_corr(kkk+1) vector been set? More...
 
bool m_bSet_previous_residual
 Have the previous r(kkk) vector been set? More...
 
bool m_bSet_previous_phi
 Have the previous Lagrange multipliers / solution phi(kkk) been set? More...
 
bool m_bSet_previous_p_ptr
 Have the previous p vectors, p(0 ... kkk), been set? More...
 
bool m_bSet_previous_q_ptr
 Have the previous q vectors, q(0 ... kkk), been set? More...
 
std::vector< double > m_p_dot_q
 Vector containing the p.q scalar products. More...
 
bool m_bReadPreviousScalar
 Read the previous iterations scalar data? More...
 
bool m_bCalculatedScalar
 Calculated the current iterations scalar data? More...
 
double m_abs_residual_conv
 Absolute residual convergence. More...
 
double m_rel_residual_conv
 Relative residual convergence (relative to initial value) More...
 
double m_rb_modes_conv
 Relative RB correction convergence (relative to previous value) More...
 
double m_rel_residual_div
 Relative residual divergence (relative to initial value) More...
 
int m_max_iter_div
 Number of iterations divergence. More...
 
bool m_bConvResidualAbs
 The residual converged? (absolute) More...
 
bool m_bConvResidualRel
 The residual converged? (relative to initial value) More...
 
bool m_bConvRBCorrRel
 The RB correction converged? (relative to previous value) More...
 
bool m_bDivResidualRel
 The residual diverged? (relative to initial value) More...
 
bool m_bDivResidualNeg
 The residual is negative? (more usefull for debugging, really) More...
 
bool m_bDivIter
 The number of iterations diverged? More...
 
bool m_bConv
 Did the solver converge? More...
 
bool m_bDiv
 Did the solver diverge? More...
 
Vec m_coupled_sol_micro
 Coupled system solution for the micro model. More...
 
Vec m_coupled_sol_BIG
 Coupled system solution for the macro model. More...
 
bool m_bCoupled_sols_set
 Have the coupled solutions been set yet? More...
 

Detailed Description

Class containing the operations needed for the FETI solver.

This class is used by the several CArl_FETI programs to do operations of the FETI solver, including matrix and vector I/O and iteration operations. Due to the need to read vectors and matrices and the usage of several PETSc operations for which the libMesh interface was not implemented, direct PETSc Vec's and Mat's are used instead of their libMesh interfaces. libMesh's parallel communicators are still used, though.

To avoid any confusion involving the iteration index m_kkk, it is only changed when reading the previous iterations's scalar data, and is kept constant during an iteration - following the of Alg. 1 in the article.

This class methods' implementations are separated into three different files:

Definition at line 36 of file FETI_operations.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
maxVecLimit 

Definition at line 98 of file FETI_operations.h.

Constructor & Destructor Documentation

carl::FETI_Operations::FETI_Operations ( )
protected

Default constructor.

carl::FETI_Operations::FETI_Operations ( libMesh::Parallel::Communicator &  comm,
const std::string &  scratch_folder_path,
const std::string &  coupling_folder_path 
)
inline

Constructor with scratch folder path, coupling matrices base filename, and libMesh communicator.

Definition at line 216 of file FETI_operations.h.

216  :
217  m_comm { comm },
218  m_bScratchFolderSet { true },
219  m_bCouplingFolderSet { true },
220  m_scratch_folder_path { scratch_folder_path },
221  m_coupling_folder_path { coupling_folder_path },
223  m_kkk { 0 },
224  m_C_R_micro_M { -1},
225  m_C_R_micro_N { -1},
226  m_C_R_micro_M_local { -1},
227  m_C_R_micro_N_local { -1},
228  m_C_R_BIG_M { -1},
229  m_C_R_BIG_N { -1},
230  m_C_R_BIG_M_local { -1},
231  m_C_R_BIG_N_local { -1},
232  m_C_RR_M { -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 },
252  m_gamma { -1 },
253  m_rho_0 { -1 },
254  m_current_rho { -1 },
255  m_current_RB_mode_corr { -1 },
256  m_previous_rho { -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 },
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 },
282  m_bConv { false },
283  m_bDiv { false },
284  m_bCoupled_sols_set {false}
285  {
286  };
double m_abs_residual_conv
Absolute residual convergence.
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?
bool m_bSet_u_0
Have the u_0 vectors been set?
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?
std::string m_coupling_folder_path
Coupling matrices path.
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?
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
bool m_bDivIter
The number of iterations diverged?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
int m_max_iter_div
Number of iterations divergence.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
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)
double m_previous_rho
Double containing the previous rho(kkk)
bool m_bDiv
Did the solver diverge?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
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?
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)
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?
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?
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
double m_current_rho
Double containing the current rho(kkk+1)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
bool m_bNullVecsSet
Have the null space vectors been set?
carl::FETI_Operations::FETI_Operations ( libMesh::Parallel::Communicator &  comm,
const std::string &  scratch_folder_path 
)
inline

Constructor with scratch folder path and libMesh communicator.

Definition at line 289 of file FETI_operations.h.

289  :
290  m_comm { comm },
291  m_bScratchFolderSet { true },
292  m_bCouplingFolderSet { false },
293  m_scratch_folder_path { scratch_folder_path },
294  m_coupling_folder_path { "" },
296  m_kkk { 0 },
297  m_C_R_micro_M { -1},
298  m_C_R_micro_N { -1},
299  m_C_R_micro_M_local { -1},
300  m_C_R_micro_N_local { -1},
301  m_C_R_BIG_M { -1},
302  m_C_R_BIG_N { -1},
303  m_C_R_BIG_M_local { -1},
304  m_C_R_BIG_N_local { -1},
305  m_C_RR_M { -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 },
325  m_gamma { -1 },
326  m_rho_0 { -1 },
327  m_current_rho { -1 },
328  m_current_RB_mode_corr { -1 },
329  m_previous_rho { -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 },
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 },
355  m_bConv { false },
356  m_bDiv { false },
357  m_bCoupled_sols_set {false}
358  {
359  };
double m_abs_residual_conv
Absolute residual convergence.
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?
bool m_bSet_u_0
Have the u_0 vectors been set?
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?
std::string m_coupling_folder_path
Coupling matrices path.
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?
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
bool m_bDivIter
The number of iterations diverged?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
int m_max_iter_div
Number of iterations divergence.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
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)
double m_previous_rho
Double containing the previous rho(kkk)
bool m_bDiv
Did the solver diverge?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
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?
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)
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?
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?
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
double m_current_rho
Double containing the current rho(kkk+1)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
bool m_bNullVecsSet
Have the null space vectors been set?
carl::FETI_Operations::~FETI_Operations ( )
inline

Destructor, deallocates the PETSc.

Definition at line 362 of file FETI_operations.h.

363  {
364  this->clear_PETSc();
365  };
void clear_PETSc()
PETSc Vec and Mat deallocation, called by the destructor.

Member Function Documentation

void carl::FETI_Operations::apply_inverse_coupling_precond ( Vec  vec_in,
Vec  vec_out 
)
protected

Apply the full inversed coupling matrix preconditioner.

Definition at line 57 of file FETI_operations_setup.cpp.

58 {
59  homemade_assert_msg(m_bCreatedPrecondSolver,"Preconditioner system not set yet!");
60  KSPSolve(m_coupling_precond_solver, vec_in, vec_out);
61 }
KSP m_coupling_precond_solver
Preconditioner system solver.
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::apply_jacobi_coupling_precond ( Vec  vec_in,
Vec  vec_out 
)
protected

Apply the Jacobi coupling matrix preconditioner vector.

Definition at line 63 of file FETI_operations_setup.cpp.

64 {
65  homemade_assert_msg(m_bCreatedPrecondJacobiVec,"Preconditioner vector not set yet!");
66  VecPointwiseMult(vec_out, m_coupling_jacobi_precond_vec, vec_in);
67 }
Vec m_coupling_jacobi_precond_vec
Preconditioner Jacobi vector.
bool m_bCreatedPrecondJacobiVec
Have the preconditioner system solver been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::apply_precond ( Vec  vec_in,
Vec  vec_out 
)
protected

Common interface to the preconditionners.

Definition at line 69 of file FETI_operations_setup.cpp.

70 {
71  switch (m_precond_type)
72  {
74  // Shouldn't call this function in this case
75  homemade_error_msg("No preconditioner to be applied!");
76  break;
77 
79  this->apply_inverse_coupling_precond(vec_in, vec_out);
80  break;
81 
83  this->apply_jacobi_coupling_precond(vec_in, vec_out);
84  break;
85  default :
86  // Undefined preconditioner
87  homemade_error_msg("Undefined preconditioner");
88  }
89 }
#define homemade_error_msg(msg)
Definition: common_header.h:73
void apply_inverse_coupling_precond(Vec vec_in, Vec vec_out)
Apply the full inversed coupling matrix preconditioner.
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
void apply_jacobi_coupling_precond(Vec vec_in, Vec vec_out)
Apply the Jacobi coupling matrix preconditioner vector.
void carl::FETI_Operations::apply_RB_projection ( Vec  vec_in,
Vec  vec_out 
)
protected

Apply the rigid body modes projection operation.

Definition at line 91 of file FETI_operations_setup.cpp.

92 {
93  homemade_assert_msg(m_bNullVecsSet,"Null space vectors not set yet!");
94  homemade_assert_msg(m_binvRITRIMatSet,"Null space matrices not set yet!");
95 
96  // vec_out = [ I - RC * (inv_RITRI_mat) * RC^t ] * vec_in
97 
98  // Declaration of Vecs with size 'm_null_nb_vecs'
99  Vec dummy_seq_vec;
100  Vec dummy_seq_vec_bis;
101  VecCreateSeq(PETSC_COMM_SELF,m_null_nb_vecs,&dummy_seq_vec);
102  VecZeroEntries(dummy_seq_vec);
103  VecDuplicate(dummy_seq_vec,&dummy_seq_vec_bis);
104 
105  // dummy_seq_vec = RC^t * vec_in
106  // -> All the communications are done here!
107  PetscScalar *dummy_seq_array;
108  VecGetArray(dummy_seq_vec,&dummy_seq_array);
109  VecMDot(vec_in,m_null_nb_vecs,m_null_coupled_vecs,dummy_seq_array);
110  VecRestoreArray(dummy_seq_vec,&dummy_seq_array);
111 
112  // dummy_seq_vec_bis = - inv_RITRI_mat * dummy_seq_vec
113  // -> Calculate dummy_seq_vec_bis on the first proc, and then broadcast the value
114 
115  /*
116  * Originally, this operation was done locally, but due to a syncing issue,
117  * we have to do it this way to avoid a "Value must the same in all processors" error
118  * when calling VecMAXPY below.
119  */
120  PETSC_MatMultScale_Bcast(m_inv_RITRI_mat,dummy_seq_vec,dummy_seq_vec_bis,-1);
121 
122  m_comm.barrier();
123 
124  // vec_out = vec_in + sum ( dummy_seq_vec_bis[i] * vec_RC[i])
125  // -> This should have no communications at all!
126  VecCopy(vec_in,vec_out);
127 
128  VecGetArray(dummy_seq_vec_bis,&dummy_seq_array);
129  VecMAXPY(vec_out,m_null_nb_vecs,dummy_seq_array,m_null_coupled_vecs);
130  VecRestoreArray(dummy_seq_vec_bis,&dummy_seq_array);
131 
132  // Cleanup
133  VecDestroy(&dummy_seq_vec);
134  VecDestroy(&dummy_seq_vec_bis);
135 }
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
void PETSC_MatMultScale_Bcast(Mat mat_seq, Vec vec_seq_in, Vec vec_seq_out, double a_const)
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::calculate_coupled_solution ( )

Calculate the final coupled solution.

Definition at line 363 of file FETI_operations_operations.cpp.

364 {
365  homemade_assert_msg(m_bSet_ext_solver_sol,"Ext. solver solutions not set yet!");
366  homemade_assert_msg(m_bSet_u_0,"Decoupled solution not set yet!");
367  homemade_assert_msg(m_bSet_current_RB_correction && m_bUsingNullVecs,"RB modes correction not set yet!");
368 
369  // Set the solution vectors
370  VecDuplicate(m_u_0_micro,&m_coupled_sol_micro);
371  VecDuplicate(m_u_0_BIG,&m_coupled_sol_BIG);
372 
373  // u_1 = - x_1(FINAL) + u_0,1
375 
376  // u_2 = x_2(FINAL) + u_0,2
378 
379  // Add rigid body modes correction, if needed
380  if(m_bUsingNullVecs)
381  {
382  switch (m_RB_modes_system)
383  {
384  case RBModesSystem::MACRO :
386  break;
387 
388  case RBModesSystem::MICRO :
390  break;
391  }
392  }
393 
394  // Set flags
395  m_bCoupled_sols_set = true;
396 }
bool m_bSet_u_0
Have the u_0 vectors been set?
Vec m_ext_solver_sol_micro
Micro model external solver solution.
Vec m_u_0_BIG
Solution of the decoupled macro model.
Vec m_coupled_sol_micro
Coupled system solution for the micro model.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_u_0_micro
Solution of the decoupled micro model.
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
Vec m_coupled_sol_BIG
Coupled system solution for the macro model.
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
bool m_bSet_ext_solver_sol
Have the external solvers solutions been set vectors been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::calculate_initial_p ( )

Calculate the initial p(0) vector.

Definition at line 78 of file FETI_operations_operations.cpp.

79 {
80  // `p(0)` is identical to `z(0)`, so just calculate the latter
81  this->calculate_z();
82 }
void calculate_z()
Calculate the current z(kkk+1) vector.
void carl::FETI_Operations::calculate_initial_r ( )

Calculate the inital residual vector, r(0)

Definition at line 84 of file FETI_operations_operations.cpp.

85 {
86  /*
87  * If m_bUsingNullVecs == true :
88  * r(0) = ( C_1 * u_1,0 - C_2 * u_2,0 ) - C_1 * x_1(0) - C_2 * x_2(0)
89  *
90  * eles
91  * r(0) = ( C_1 * u_1,0 - C_2 * u_2,0 )
92  */
93 
94  // Common asserts
95  homemade_assert_msg(m_bC_R_micro_MatrixSet,"Micro coupling matrix not set yet!");
96  homemade_assert_msg(m_bC_R_BIG_MatrixSet,"Macro coupling matrix not set yet!");
97  homemade_assert_msg(m_bC_R_micro_MatrixSet,"Micro system dimensions not set yet!");
98  homemade_assert_msg(m_bC_R_BIG_MatrixSet,"Macro system dimensions not set yet!");
99  homemade_assert_msg(m_bSet_u_0,"Decoupled solution not set yet!");
100 
101  // Assert for only m_bUsingNullVecs == true
102  homemade_assert_msg(m_bSet_ext_solver_sol && m_bUsingNullVecs,"Ext. solver solutions not set yet!");
103 
104  // Create the vector
105  VecCreate(m_comm.get(),&m_current_residual);
107  VecSetFromOptions(m_current_residual);
108 
109  // - C_2 * u_0,2
111  VecScale(m_current_residual,-1);
112 
113  // C_1 * u_0,1
114  // --> r(0) = ( C_1 * u_0,1 - C_2 * u_0,2 )
116 
117  if(m_bUsingNullVecs)
118  {
119  Vec dummy_vec;
120  VecDuplicate(m_current_residual,&dummy_vec);
121 
122  // C_1 * x_1(0)
123  MatMult(m_C_R_BIG,m_ext_solver_sol_BIG,dummy_vec);
124 
125  // C_2 * x_2(0)
126  MatMultAdd(m_C_R_micro,m_ext_solver_sol_micro,dummy_vec,dummy_vec);
127 
128  // --> r(0) = ( C_1 * u_1,0 - C_2 * u_2,0 ) - C_1 * x_1(0) - C_2 * x_2(0)
129  VecAXPY(m_current_residual,-1,dummy_vec);
130  VecDestroy(&dummy_vec);
131  }
132 
133  // Set flag
135 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
bool m_bSet_u_0
Have the u_0 vectors been set?
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
Vec m_ext_solver_sol_micro
Micro model external solver solution.
Vec m_u_0_BIG
Solution of the decoupled macro model.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
Vec m_u_0_micro
Solution of the decoupled micro model.
Mat m_C_R_micro
Mediator - micro system coupling matrix.
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
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?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::calculate_null_space_phi_0 ( const std::string &  force_path)

Calculate the inital solution, $\phi_0$.

Definition at line 6 of file FETI_operations_operations.cpp.

7 {
8  // phi0 = - RC * (inv_RITRI_mat) * R^t* Force
9  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
10  homemade_assert_msg(m_bNullVecsSet,"Null space vectors not set yet!");
11  homemade_assert_msg(m_binvRITRIMatSet,"Null space matrices not set yet!");
12  homemade_assert_msg(m_bC_R_micro_MatrixSet,"Micro coupling matrix not set yet!");
13  homemade_assert_msg(m_bC_R_BIG_MatrixSet,"Macro coupling matrix not set yet!");
14 
15  // --- Declare / create the vectors
16  // phi(0)
17  VecCreate(m_comm.get(),&m_current_phi);
19  VecSetFromOptions(m_current_phi);
20 
21  // Force vector
22  Vec vec_force_PETSc;
23  VecCreate(m_comm.get(),&vec_force_PETSc);
24  read_PETSC_vector(vec_force_PETSc,force_path,m_comm.get());
25 
26  // Create the local auxiliary vectors
27  Vec aux_null_vec_input;
28  Vec aux_null_vec_output;
29 
30  VecCreateSeq(PETSC_COMM_SELF,m_null_nb_vecs,&aux_null_vec_input);
31  VecCreateSeq(PETSC_COMM_SELF,m_null_nb_vecs,&aux_null_vec_output);
32 
33  VecZeroEntries(aux_null_vec_input);
34  VecZeroEntries(aux_null_vec_output);
35 
36  // aux_vec_input = R^t * vec_force
37  // -> All the communications are done here!
38  // Cannot use VecMDot because "m_null_vecs" is a constant pointer ...
39  PetscScalar *dummy_array_input;
40  VecGetArray(aux_null_vec_input,&dummy_array_input);
41  for(int iii = 0; iii < m_null_nb_vecs; ++iii)
42  {
43  VecDot(vec_force_PETSc,m_null_vecs[iii],&dummy_array_input[iii]);
44  }
45  VecRestoreArray(aux_null_vec_input,&dummy_array_input);
46 
47  // aux_vec_output = inv_RITRI_mat * aux_vec_input
48  // -> Calculate aux_vec_output on the first proc, and then broadcast the value
49  /*
50  * Originally, this operation was done locally, but due to a syncing issue,
51  * we have to do it this way to avoid a "Value must the same in all processors" error
52  * when calling VecMAXPY below.
53  */
54  PETSC_MatMultScale_Bcast(m_inv_RITRI_mat,aux_null_vec_input,aux_null_vec_output,1);
55 
56  m_comm.barrier();
57 
58  // -> This should have no communications at all!
59  VecZeroEntries(m_current_phi);
60 
61  PetscScalar *dummy_array_output;
62  VecGetArray(aux_null_vec_output,&dummy_array_output);
63  VecMAXPY(m_current_phi,m_null_nb_vecs,dummy_array_output,m_null_coupled_vecs);
64  VecRestoreArray(aux_null_vec_output,&dummy_array_output);
65 
66  VecScale(m_current_phi,-1);
67 
68  // Cleanup
69  VecDestroy(&vec_force_PETSc);
70  VecDestroy(&aux_null_vec_input);
71  VecDestroy(&aux_null_vec_output);
72 
73  // Set flags
74  m_bSet_current_phi = true;
75 }
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
bool m_bScratchFolderSet
Have the scratch folder been set?
void PETSC_MatMultScale_Bcast(Mat mat_seq, Vec vec_seq_in, Vec vec_seq_out, double a_const)
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bC_R_micro_MatrixSet
Mediator - micro coupling matrix has been set?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
Vec m_null_vecs[maxVecLimit]
Null space vectors.
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::calculate_p ( )

Calculate the current p(kkk+1) vector.

Definition at line 137 of file FETI_operations_operations.cpp.

138 {
139  homemade_assert_msg(m_bSet_current_z,"Current 'z' not calculated yet!");
140  homemade_assert_msg(m_bSet_previous_p_ptr,"'p' vectors not set yet!");
141  homemade_assert_msg(m_bSet_previous_q_ptr,"'q' vectors not set yet!");
142 
143  // p(kkk+1) = z(kkk+1) + \sum ( beta(iii) * p(iii) ), iii = 0 ... kkk
144  // beta(iii) = - z(kkk+1).q(iii) / p(iii).q(iii)
145  // For simplicity, the signal was included in 'beta' - WATCH OUT FOR THE SIGNAL!
146  std::vector<PetscScalar> beta(m_kkk+1,0);
147  VecMDot(m_current_z,m_kkk+1,m_previous_q_ptr,beta.data());
148  for(int iii = 0; iii < m_kkk+1; ++iii)
149  {
150  beta[iii] = - beta[iii] / m_p_dot_q[iii];
151  }
152 
153  // p(kkk+1) = z(kkk+1)
154  VecDuplicate(m_current_z,&m_current_p);
155  VecCopy(m_current_z,m_current_p);
156 
157  // p(kkk+1) = z(kkk+1) + \sum ( beta(iii) * p(iii) )
158  VecMAXPY(m_current_p,m_kkk+1,beta.data(),m_previous_p_ptr);
159 
160  m_bSet_current_p = true;
161 }
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
bool m_bSet_current_p
Have the current p(kkk+1) vector been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
Vec m_current_p
Current p(kkk+1) (p(0) for the initialization)
void carl::FETI_Operations::calculate_phi ( )

Calculate the current phi(kkk+1) solution vector.

Definition at line 266 of file FETI_operations_operations.cpp.

267 {
268  homemade_assert_msg(m_bSet_previous_p_ptr,"'p' vectors not set yet!");
269  homemade_assert_msg(m_bSet_previous_q_ptr,"'q' vectors not set yet!");
270  homemade_assert_msg(m_bSet_previous_phi,"Previous 'phi' not set yet!");
271 
272  // Calculate 'phi(kkk + 1) = phi(kkk) + gamma * p(kkk)'
273 
274  // gamma = rho(kkk) / ( p(kkk).q(kkk) )
275  VecDot(m_previous_p_ptr[m_kkk],m_previous_q_ptr[m_kkk],&m_p_dot_q[m_kkk]);
277 
278  // phi(kkk + 1) = phi(kkk) + gamma * p(kkk)
279  VecDuplicate(m_previous_phi,&m_current_phi);
281 
282  m_bSet_current_phi = true;
283 }
Vec m_previous_phi
Previous Lagrange multipliers / solution, phi(kkk)
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
double m_previous_rho
Double containing the previous rho(kkk)
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bSet_previous_phi
Have the previous Lagrange multipliers / solution phi(kkk) been set?
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
void carl::FETI_Operations::calculate_q ( )

Calculate the current q(kkk) vector.

Definition at line 163 of file FETI_operations_operations.cpp.

164 {
165  homemade_assert_msg(m_bC_R_micro_MatrixSet,"Micro coupling matrix not set yet!");
166  homemade_assert_msg(m_bC_R_BIG_MatrixSet,"Macro coupling matrix not set yet!");
167  homemade_assert_msg(m_bSet_ext_solver_sol,"Ext. solver solutions not set yet!");
168  homemade_assert_msg(m_bSet_previous_q_ptr,"'q' vectors not set yet!");
169 
170  // q(kkk) = C_1 * x_1(kkk) + C_2 * x_2(kkk)
173 }
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
Vec m_ext_solver_sol_micro
Micro model external solver solution.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
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?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
void carl::FETI_Operations::calculate_r ( )

Calculate the current r(kkk+1) residual vector.

Definition at line 175 of file FETI_operations_operations.cpp.

176 {
177  homemade_assert_msg(m_bSet_previous_q_ptr,"'q' vectors not set yet!");
178  homemade_assert_msg(m_bSet_previous_residual,"Previous 'r' not set yet!");
179  homemade_assert_msg(m_bSet_current_phi,"Current 'phi' not set yet!");
180  // Last assert is needed to guarantee that 'm_p_dot_q(kkk)' has been calculated
181 
182  // Calculate 'r(kkk + 1) = r(kkk) - gamma * q(kkk)'
183 
184  double dummy_double = - m_gamma;
187 
189 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_previous_residual
Previous residual vector, r(kkk)
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
void carl::FETI_Operations::calculate_rb_correction ( )

Calculate the rigid body modes corrections.

Definition at line 285 of file FETI_operations_operations.cpp.

286 {
287  homemade_assert_msg(m_bNullVecsSet,"Null space vectors not set yet!");
288  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
289 
290  // Declare and create vectors
291  Vec dummy_seq_vec;
292  Vec dummy_seq_vec_bis;
293  VecCreateSeq(PETSC_COMM_SELF,m_null_nb_vecs,&dummy_seq_vec);
294  VecZeroEntries(dummy_seq_vec);
295  VecDuplicate(dummy_seq_vec,&dummy_seq_vec_bis);
296 
297  VecDuplicate(m_null_vecs[0],&m_current_rb_correction);
298  VecZeroEntries(m_current_rb_correction);
299 
300  // m_current_rb_correction = R * (inv_RITRI_mat) * RC^t * m_current_residual
301 
302  // dummy_seq_vec = RC^t * m_current_residual
303  // -> All the communications are done here!
304  PetscScalar *dummy_seq_array;
305  VecGetArray(dummy_seq_vec,&dummy_seq_array);
306  VecMDot(m_current_residual,m_null_nb_vecs,m_null_coupled_vecs,dummy_seq_array);
307 
308  VecRestoreArray(dummy_seq_vec,&dummy_seq_array);
309 
310  // dummy_seq_vec_bis = inv_RITRI_mat * dummy_seq_vec
311  /*
312  * Originally, this operation was done locally, but due to a syncing issue,
313  * we have to do it this way to avoid a "Value must the same in all processors" error
314  * when calling VecMAXPY below.
315  */
316  PETSC_MatMultScale_Bcast(m_inv_RITRI_mat,dummy_seq_vec,dummy_seq_vec_bis,1);
317 
318  m_comm.barrier();
319 
320  // m_current_rb_correction = sum ( dummy_seq_vec_bis[i] * m_null_vecs[i])
321  // -> This should have no communications at all!
322  VecGetArray(dummy_seq_vec_bis,&dummy_seq_array);
323  VecMAXPY(m_current_rb_correction,m_null_nb_vecs,dummy_seq_array,m_null_vecs);
324  VecRestoreArray(dummy_seq_vec_bis,&dummy_seq_array);
325 
326  // Cleanup
327  VecDestroy(&dummy_seq_vec);
328  VecDestroy(&dummy_seq_vec_bis);
329 
330  // Set flag
332 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
PetscInt m_null_nb_vecs
Number of null space vectors.
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
void PETSC_MatMultScale_Bcast(Mat mat_seq, Vec vec_seq_in, Vec vec_seq_out, double a_const)
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
Vec m_null_vecs[maxVecLimit]
Null space vectors.
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::calculate_scalar_data ( )

Calculate the scalar quantities.

Definition at line 334 of file FETI_operations_operations.cpp.

335 {
336  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
337  homemade_assert_msg(m_bSet_current_z,"Current 'z' not calculated yet!");
338  if(m_bUsingNullVecs)
339  homemade_assert_msg(m_bSet_current_RB_correction && m_bUsingNullVecs,"Current RB modes correction not calculated yet!");
340 
341  // --- Calculate the values
342  // rho(kkk+1)
344  {
346  } else {
348  }
349 
350  // RB_corr(kkk+1)
351  if(m_bUsingNullVecs)
352  {
354  }
355 
356  // gamma(kkk)
357  VecDot(m_previous_p_ptr[m_kkk],m_previous_q_ptr[m_kkk],&m_p_dot_q[m_kkk]);
358 
359  // Set flags
360  m_bCalculatedScalar = true;
361 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
double m_current_RB_mode_corr
Double containing the current RB_mode_corr(kkk+1)
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
int m_kkk
Current iteration index.
double m_current_rho
Double containing the current rho(kkk+1)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::calculate_z ( )

Calculate the current z(kkk+1) vector.

Definition at line 191 of file FETI_operations_operations.cpp.

192 {
193  /*
194  * Four possibilities:
195  * - m_bUsingNullVecs == false
196  * m_precond_type == BaseCGPrecondType::NO_PRECONDITIONER
197  * -> m_current_z = m_current_residual
198  *
199  * - m_bUsingNullVecs == false
200  * m_precond_type != BaseCGPrecondType::NO_PRECONDITIONER
201  * -> m_current_z = M_PC^-1 * m_current_residual
202  *
203  * - m_bUsingNullVecs == true
204  * m_precond_type == BaseCGPrecondType::NO_PRECONDITIONER
205  * -> m_current_z = M_proj * m_current_residual
206  *
207  * - m_bUsingNullVecs == true
208  * m_precond_type != BaseCGPrecondType::NO_PRECONDITIONER
209  * -> m_current_z = M_proj * M_PC^-1 * M_proj * m_current_residual
210  */
211 
213  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
214 
215  if(m_bUsingNullVecs)
216  {
217  // Use projections!
219  {
220  // -> m_current_z = M_proj * M_PC^-1 * M_proj * m_current_residual
221  VecDuplicate(m_current_residual,&m_current_z);
222 
223  Vec dummy_vec, dummy_vec_bis;
224  VecDuplicate(m_current_residual,&dummy_vec);
225  VecDuplicate(m_current_residual,&dummy_vec_bis);
226 
227  // dummy_vec = M_proj * m_current_residual
228  this->apply_RB_projection(m_current_residual,dummy_vec);
229 
230  // dummy_vec_bis = M_PC^-1 * dummy_vec
231  this->apply_precond(dummy_vec,dummy_vec_bis);
232 
233  // m_current_z = M_proj * dummy_vec_bis
234  this->apply_RB_projection(dummy_vec_bis,m_current_z);
235 
236  VecDestroy(&dummy_vec);
237  VecDestroy(&dummy_vec_bis);
238 
239  // Set flag
240  m_bSet_current_z = true;
241  }
242  else
243  {
244  // -> m_current_z = M_proj * m_current_residual
245  VecDuplicate(m_current_residual,&m_current_z);
246 
248  m_bSet_current_z = true;
249  }
250  }
251  else
252  {
253  // Do not use projections!
255  {
256  // -> m_current_z = M_PC^-1 * m_current_residual
257  VecDuplicate(m_current_residual,&m_current_z);
258 
260  m_bSet_current_z = true;
261  }
262  // else, m_current_z = m_current_residual -> DO NOTHING!
263  }
264 }
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?
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
void apply_RB_projection(Vec vec_in, Vec vec_out)
Apply the rigid body modes projection operation.
void apply_precond(Vec vec_in, Vec vec_out)
Common interface to the preconditionners.
bool m_bUsingNullVecs
Do we need to use the null space vectors?
IterationStatus carl::FETI_Operations::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.

Definition at line 398 of file FETI_operations_operations.cpp.

399 {
400  homemade_assert_msg(m_bCalculatedScalar,"Scalar quantities not calculated yet!");
401 
402  m_abs_residual_conv = abs_residual_conv;
403  m_rel_residual_conv = rel_residual_conv;
404  m_rb_modes_conv = rb_modes_conv;
405  m_rel_residual_div = rel_residual_div;
406  m_max_iter_div = max_iter_div;
407 
408  // Check the iteration divergence
409  if(m_kkk == m_max_iter_div) // Iteration divergence
410  {
411  m_bDivIter = true;
412  }
413 
414  // Check the residual convergence / divergence
415  if(m_current_rho > 0)
416  {
417  // Check the residual convergence
418  if(m_current_rho < m_abs_residual_conv) // Absolute convergence
419  {
420  m_bConvResidualAbs = true;
421  }
422 
423  if(m_current_rho < m_rel_residual_conv * m_rho_0) // Relative convergence
424  {
425  m_bConvResidualRel = true;
426  }
427 
428  // Check the residual divergence
429  if(m_current_rho > m_rel_residual_div * m_rho_0) // Relative divergence
430  {
431  m_bDivResidualRel = true;
432  }
433  } else {
434  // There's something wrong ...
435  m_bDivResidualNeg = true;
436  }
437 
438  // Check the rigid body modes correction convergence
439  if(m_bUsingNullVecs)
440  {
442  {
443  m_bConvRBCorrRel = true;
444  }
445  } else {
446  // Short-circuit this boolean
447  m_bConvRBCorrRel = true;
448  }
449 
450  // Possible cases:
451  // - Any diverged flag is true: diverged!
452  // - Both the RB modes correction AND one of the residual convergence flags are true: converged!
453  // - All flags false: continue iterating!
454 
457 
459  if(m_bDiv) {
460  output_status = IterationStatus::DIVERGED;
461  } else if(m_bConv) {
462  output_status = IterationStatus::CONVERGED;
463  } else {
464  output_status = IterationStatus::ITERATING;
465  }
466 
467  return output_status;
468 }
double m_abs_residual_conv
Absolute residual convergence.
double m_rho_0
Double containing the initial rho(0)
bool m_bConvResidualRel
The residual converged? (relative to initial value)
double m_previous_RB_mode_corr
Double containing the previous RB_mode_corr(kkk)
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
bool m_bDivIter
The number of iterations diverged?
int m_max_iter_div
Number of iterations divergence.
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
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)
bool m_bDiv
Did the solver diverge?
bool m_bConvRBCorrRel
The RB correction converged? (relative to previous value)
IterationStatus
Definition: common_enums.h:41
bool m_bConvResidualAbs
The residual converged? (absolute)
double m_rel_residual_div
Relative residual divergence (relative to initial value)
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
int m_kkk
Current iteration index.
double m_current_rho
Double containing the current rho(kkk+1)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::clear_PETSc ( )
protected

PETSc Vec and Mat deallocation, called by the destructor.

Definition at line 167 of file FETI_operations_setup.cpp.

168 {
170  MatDestroy(&m_C_R_BIG);
172  MatDestroy(&m_C_R_micro);
174  MatDestroy(&m_C_RR);
175  if(m_bNullVecsSet)
176  {
177  for(int iii = 0; iii < m_null_nb_vecs; ++iii)
178  VecDestroy(&m_null_vecs[iii]);
179  }
181  {
182  MatDestroy(&m_inv_RITRI_mat);
183  }
184  if(m_bSet_u_0)
185  {
186  VecDestroy(&m_u_0_BIG);
187  VecDestroy(&m_u_0_micro);
188  }
190  {
191  VecDestroy(&m_ext_solver_sol_BIG);
192  VecDestroy(&m_ext_solver_sol_micro);
193  }
195  {
196  VecDestroy(&m_current_phi);
197  }
199  {
200  VecDestroy(&m_current_residual);
201  }
203  {
204  KSPDestroy(&m_coupling_precond_solver);
205  }
207  {
208  VecDestroy(&m_coupling_jacobi_precond_vec);
209  }
211  {
212  VecDestroy(&m_current_rb_correction);
213  }
215  {
216  VecDestroy(&m_previous_residual);
217  }
219  {
220  VecDestroy(&m_previous_phi);
221  }
223  {
224  VecDestroyVecs(m_kkk+1,&m_previous_p_ptr);
225  delete[] m_previous_p_ptr;
226  }
228  {
229  VecDestroyVecs(m_kkk+1,&m_previous_q_ptr);
230  delete[] m_previous_q_ptr;
231  }
233  {
234  VecDestroy(&m_coupled_sol_micro);
235  VecDestroy(&m_coupled_sol_BIG);
236  }
237 }
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?
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_bSet_u_0
Have the u_0 vectors been set?
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
Vec m_previous_phi
Previous Lagrange multipliers / solution, phi(kkk)
Mat m_C_RR
Mediator - mediator system coupling matrix.
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
KSP m_coupling_precond_solver
Preconditioner system solver.
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
Vec m_ext_solver_sol_micro
Micro model external solver solution.
Vec m_u_0_BIG
Solution of the decoupled macro model.
Vec m_coupled_sol_micro
Coupled system solution for the micro model.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_u_0_micro
Solution of the decoupled micro model.
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
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?
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
Vec m_coupled_sol_BIG
Coupled system solution for the macro model.
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.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
bool m_bCreatedPrecondJacobiVec
Have the preconditioner system solver been set?
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?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
bool m_bSet_previous_phi
Have the previous Lagrange multipliers / solution phi(kkk) been set?
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
Vec m_previous_residual
Previous residual vector, r(kkk)
int m_kkk
Current iteration index.
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
Vec m_null_vecs[maxVecLimit]
Null space vectors.
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::export_coupled_solution ( std::string  output_base)

Definition at line 764 of file FETI_operations_IO.cpp.

765 {
766  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
767  homemade_assert_msg(m_bCoupled_sols_set,"Coupled solutions not calculated yet!");
768 
769  write_PETSC_vector(m_coupled_sol_BIG,output_base + "/coupled_sol_A.petscvec",m_comm.rank(),m_comm.get());
770  write_PETSC_vector(m_coupled_sol_micro,output_base + "/coupled_sol_B.petscvec",m_comm.rank(),m_comm.get());
771 
772 // Print MatLab debugging output? Variable defined at "carl_headers.h"
773 #ifdef PRINT_MATLAB_DEBUG
774  write_PETSC_vector_MATLAB(m_coupled_sol_BIG,output_base + "/coupled_sol_A.m",m_comm.get());
775  write_PETSC_vector_MATLAB(m_coupled_sol_micro,output_base + "/coupled_sol_B.m",m_comm.get());
776 #endif
777 }
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
Vec m_coupled_sol_micro
Coupled system solution for the micro model.
bool m_bScratchFolderSet
Have the scratch folder been set?
Vec m_coupled_sol_BIG
Coupled system solution for the macro model.
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_ext_solver_rhs ( Vec  vec_in)
protected

Calculate and export the external solver RHS's.

Definition at line 137 of file FETI_operations_setup.cpp.

138 {
139  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
140 
141  Vec vec_C_micro_t_p_kkk_PETSc;
142  VecCreate(m_comm.get(),&vec_C_micro_t_p_kkk_PETSc);
143  VecSetSizes(vec_C_micro_t_p_kkk_PETSc,m_C_R_micro_N_local,m_C_R_micro_N);
144  VecSetFromOptions(vec_C_micro_t_p_kkk_PETSc);
145 
146  Vec vec_C_BIG_t_p_kkk_PETSc;
147  VecCreate(m_comm.get(),&vec_C_BIG_t_p_kkk_PETSc);
148  VecSetSizes(vec_C_BIG_t_p_kkk_PETSc,m_C_R_BIG_N_local,m_C_R_BIG_N);
149  VecSetFromOptions(vec_C_BIG_t_p_kkk_PETSc);
150 
151  MatMultTranspose(m_C_R_micro,vec_in,vec_C_micro_t_p_kkk_PETSc);
152  MatMultTranspose(m_C_R_BIG,vec_in,vec_C_BIG_t_p_kkk_PETSc);
153 
154  write_PETSC_vector(vec_C_BIG_t_p_kkk_PETSc,m_scratch_folder_path + "/ext_solver_A_rhs.petscvec",m_comm.rank(),m_comm.get());
155  write_PETSC_vector(vec_C_micro_t_p_kkk_PETSc,m_scratch_folder_path + "/ext_solver_B_rhs.petscvec",m_comm.rank(),m_comm.get());
156 
157 // Print MatLab debugging output? Variable defined at "carl_headers.h"
158 #ifdef PRINT_MATLAB_DEBUG
159  write_PETSC_vector_MATLAB(vec_C_micro_t_p_kkk_PETSc,m_scratch_folder_path + "/ext_solver_B_rhs.m",m_comm.get());
160  write_PETSC_vector_MATLAB(vec_C_BIG_t_p_kkk_PETSc,m_scratch_folder_path + "/ext_solver_A_rhs.m",m_comm.get());
161 #endif
162 
163  VecDestroy(&vec_C_micro_t_p_kkk_PETSc);
164  VecDestroy(&vec_C_BIG_t_p_kkk_PETSc);
165 }
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_ext_solver_rhs_Ct_p ( )

Calculate and export the external solver RHS's for the next iteration.

Definition at line 510 of file FETI_operations_IO.cpp.

511 {
512  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
513 
514  homemade_assert_msg(m_bSet_current_p,"Current 'p' not calculated yet!");
516 }
void export_ext_solver_rhs(Vec vec_in)
Calculate and export the external solver RHS's.
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_current_p
Have the current p(kkk+1) vector been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_current_p
Current p(kkk+1) (p(0) for the initialization)
void carl::FETI_Operations::export_ext_solver_rhs_Ct_phi ( )

Calculate and export the external solver RHS's for the decoupled problem.

Definition at line 526 of file FETI_operations_IO.cpp.

527 {
528  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
529  homemade_assert_msg(m_bSet_current_phi,"Current 'phi' not calculated yet!");
530 
532 }
void export_ext_solver_rhs(Vec vec_in)
Calculate and export the external solver RHS's.
bool m_bScratchFolderSet
Have the scratch folder been set?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
void carl::FETI_Operations::export_ext_solver_rhs_initial ( )

Calculate and export the external solver RHS's for the first iteration.

Definition at line 518 of file FETI_operations_IO.cpp.

519 {
520  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
521 
522  homemade_assert_msg(m_bSet_current_z,"Current 'p' not calculated yet!");
524 }
void export_ext_solver_rhs(Vec vec_in)
Calculate and export the external solver RHS's.
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_current_z
Have the current z(kkk+1) vector been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::export_inital_vecs ( )

Export the initial iteration vectors, r(0) and p(0)

Definition at line 600 of file FETI_operations_IO.cpp.

601 {
602  // Export r(0) and p(0) ( p(0) is identical to z(0))
603  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
604  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
605 
606  // In all cases, print r(0)
607  write_PETSC_vector(m_current_residual,m_scratch_folder_path + "/FETI_iter__r__current.petscvec",m_comm.rank(),m_comm.get());
608 
609 // Print MatLab debugging output? Variable defined at "carl_headers.h"
610 #ifdef PRINT_MATLAB_DEBUG
611  write_PETSC_vector_MATLAB(m_current_residual,m_scratch_folder_path + "/FETI_iter__r__current.m",m_comm.get());
612 #endif
613 
614  // p(0) is only identical to r(0) if neither a preconditioner or the RB modes are used
616  {
617  write_PETSC_vector(m_current_z,m_scratch_folder_path + "/FETI_iter__p__0.petscvec",m_comm.rank(),m_comm.get());
618 
619 // Print MatLab debugging output? Variable defined at "carl_headers.h"
620 #ifdef PRINT_MATLAB_DEBUG
622 #endif
623  }
624 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::export_initial_scalar_data ( )

Export the initial iteration scalar data, rho(0) and | RB_corr(0) |

Definition at line 626 of file FETI_operations_IO.cpp.

627 {
628  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
629 
630 
631  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
632  PetscScalar residual = 0;
633  PetscScalar RB_correct = 0;
634 
635  if(m_bUsingNullVecs)
636  {
637  homemade_assert_msg(m_bSet_current_RB_correction,"Current RB modes correction not calculated yet!");
638  }
639 
640  // --- Calculate the values
641  // rho(0)
643  {
644  VecDot(m_current_residual,m_current_z,&residual);
645  } else {
646  VecDot(m_current_residual,m_current_residual,&residual);
647  }
648 
649  // RB_corr(0)
650  if(m_bUsingNullVecs)
651  {
652  VecNorm(m_current_rb_correction,NORM_2,&RB_correct);
653  }
654 
655  // ONLY write in proc 0!
656  if(m_comm.rank() == 0)
657  {
658  std::ofstream scalar_data;
659 
660  // Export the scalar data
661  scalar_data.open(m_scratch_folder_path + "/FETI_iter_scalar_data.dat");
662  scalar_data.precision(15);
663  scalar_data << m_kkk << " " << residual << " " << residual;
664 
665  if(m_bUsingNullVecs)
666  {
667  scalar_data << " " << RB_correct;
668  }
669 
670  scalar_data << std::endl;
671 
672  scalar_data.close();
673 
674  // Export the convergence data
675  scalar_data.open(m_scratch_folder_path + "/FETI_convergence.dat");
676  scalar_data.precision(15);
677  scalar_data << m_kkk << " " << residual;
678 
679  if(m_bUsingNullVecs)
680  {
681  scalar_data << " " << RB_correct;
682  }
683 
684  scalar_data << std::endl;
685 
686  scalar_data.close();
687  }
688 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
int m_kkk
Current iteration index.
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::export_iter_vecs ( )

Definition at line 742 of file FETI_operations_IO.cpp.

743 {
744  /* Export the iteration vectors
745  * Vectors to export: 'r(kkk+1)'
746  * 'phi(kkk+1)'
747  * 'p(kkk+1)'
748  * 'q(kkk)'
749  */
750 
751  // r(kkk+1)
752  this->export_r();
753 
754  // phi(kkk+1)
755  this->export_phi();
756 
757  // p(kkk+1)
758  this->export_p();
759 
760  // q(kkk)
761  this->export_q();
762 }
void export_r()
Export the current r(kkk+1) residual vector.
void export_q()
Export the current q(kkk) vector.
void export_p()
Export the current p(kkk+1) vector.
void export_phi()
Export the current Lagrange multiplier / solution.
void carl::FETI_Operations::export_p ( )

Export the current p(kkk+1) vector.

Definition at line 548 of file FETI_operations_IO.cpp.

549 {
550  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
551  homemade_assert_msg(m_bSet_current_p,"Current 'p' not calculated yet!");
552 
553  write_PETSC_vector(m_current_p,m_scratch_folder_path + "/FETI_iter__p__" + std::to_string(m_kkk+1) + ".petscvec",m_comm.rank(),m_comm.get());
554 
555 // Print MatLab debugging output? Variable defined at "carl_headers.h"
556 #ifdef PRINT_MATLAB_DEBUG
557  write_PETSC_vector_MATLAB(m_current_p,m_scratch_folder_path + "/FETI_iter__p__" + std::to_string(m_kkk+1) + ".m",m_comm.get());
558 #endif
559 }
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bSet_current_p
Have the current p(kkk+1) vector been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
Vec m_current_p
Current p(kkk+1) (p(0) for the initialization)
void carl::FETI_Operations::export_phi ( )

Export the current Lagrange multiplier / solution.

Definition at line 587 of file FETI_operations_IO.cpp.

588 {
589  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
590  homemade_assert_msg(m_bSet_current_phi,"Current 'phi' not calculated yet!");
591 
592  write_PETSC_vector(m_current_phi,m_scratch_folder_path + "/FETI_iter__phi__current.petscvec",m_comm.rank(),m_comm.get());
593 
594 // Print MatLab debugging output? Variable defined at "carl_headers.h"
595 #ifdef PRINT_MATLAB_DEBUG
596  write_PETSC_vector_MATLAB(m_current_phi,m_scratch_folder_path + "/FETI_iter__phi__current.m",m_comm.get());
597 #endif
598 }
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bSet_current_phi
Have the current Lagrange multipliers / solution phi(kkk+1) been set?
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_q ( )

Export the current q(kkk) vector.

Definition at line 561 of file FETI_operations_IO.cpp.

562 {
563  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
564  homemade_assert_msg(m_bSet_previous_q_ptr,"'q' vectors not calculated yet!");
565 
566  write_PETSC_vector(m_previous_q_ptr[m_kkk],m_scratch_folder_path + "/FETI_iter__q__" + std::to_string(m_kkk) + ".petscvec",m_comm.rank(),m_comm.get());
567 
568 // Print MatLab debugging output? Variable defined at "carl_headers.h"
569 #ifdef PRINT_MATLAB_DEBUG
570  write_PETSC_vector_MATLAB(m_previous_q_ptr[m_kkk],m_scratch_folder_path + "/FETI_iter__q__" + std::to_string(m_kkk) + ".m",m_comm.get());
571 #endif
572 }
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_r ( )

Export the current r(kkk+1) residual vector.

Definition at line 574 of file FETI_operations_IO.cpp.

575 {
576  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
577  homemade_assert_msg(m_bSet_current_residual,"Current residual not calculated yet!");
578 
579  write_PETSC_vector(m_current_residual,m_scratch_folder_path + "/FETI_iter__r__current.petscvec",m_comm.rank(),m_comm.get());
580 
581 // Print MatLab debugging output? Variable defined at "carl_headers.h"
582 #ifdef PRINT_MATLAB_DEBUG
583  write_PETSC_vector_MATLAB(m_current_residual,m_scratch_folder_path + "/FETI_iter__r__current.m",m_comm.get());
584 #endif
585 }
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_rb_correction_vector ( )

Export the rigid body modes correction.

Definition at line 534 of file FETI_operations_IO.cpp.

535 {
536  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
537  homemade_assert_msg(m_bSet_current_RB_correction,"Current RB correction not calculated yet!");
538 
539 
540  write_PETSC_vector(m_current_rb_correction,m_scratch_folder_path + "/FETI_RB_correction.petscvec",m_comm.rank(),m_comm.get());
541 
542 // Print MatLab debugging output? Variable defined at "carl_headers.h"
543 #ifdef PRINT_MATLAB_DEBUG
545 #endif
546 }
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::export_scalar_data ( )

Export the iteration scalar data, rho(kkk+1), | RB_corr(kkk+1) | and p(kkk).q(kkk)

Definition at line 690 of file FETI_operations_IO.cpp.

691 {
692  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
693  homemade_assert_msg(m_bCalculatedScalar,"Scalar data not calculated yet!");
694 
695  // ONLY write in proc 0!
696  if(m_comm.rank() == 0)
697  {
698  std::ofstream scalar_data;
699 
700  // Export the scalar data
701  scalar_data.open(m_scratch_folder_path + "/FETI_iter_scalar_data.dat");
702  scalar_data.precision(15);
703  scalar_data << m_kkk + 1 << " " << m_rho_0 << " " << m_current_rho;
704 
705  if(m_bUsingNullVecs)
706  {
707  scalar_data << " " << m_current_RB_mode_corr;
708  }
709 
710  scalar_data << std::endl;
711 
712  scalar_data.close();
713 
714  // Export the convergence data
715  scalar_data.open(m_scratch_folder_path + "/FETI_convergence.dat",std::ofstream::app);
716  scalar_data.precision(15);
717  scalar_data << m_kkk + 1 << " " << m_current_rho;
718 
719  if(m_bUsingNullVecs)
720  {
721  scalar_data << " " << m_current_RB_mode_corr;
722  }
723  scalar_data << std::endl;
724 
725  scalar_data.close();
726 
727  // Export `p(kkk).q(kkk)`
728  if(m_kkk == 0)
729  {
730  scalar_data.open(m_scratch_folder_path + "/FETI_iter_p_dot_q.dat");
731  } else {
732 
733  scalar_data.open(m_scratch_folder_path + "/FETI_iter_p_dot_q.dat",std::ofstream::app);
734  }
735  scalar_data.precision(15);
736  scalar_data << m_p_dot_q[m_kkk] << std::endl;
737 
738  scalar_data.close();
739  }
740 }
double m_rho_0
Double containing the initial rho(0)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
bool m_bScratchFolderSet
Have the scratch folder been set?
double m_current_RB_mode_corr
Double containing the current RB_mode_corr(kkk+1)
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
double m_current_rho
Double containing the current rho(kkk+1)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::increase_iter_counter ( )

Increase the iteration counter.

void carl::FETI_Operations::print_previous_iters_conv ( int  nb_of_iters = 5)

Definition at line 779 of file FETI_operations_IO.cpp.

780 {
781  std::cout << std::endl;
782  std::cout << " --> Iteration no. " << m_kkk + 1 << " : ";
783 
785  {
786  std::cout << " > Abs. residual convergence : rho(kkk+1) < " << m_abs_residual_conv << std::endl;
787  }
789  {
790  std::cout << " > Rel. residual convergence : rho(kkk+1) < " << m_rel_residual_conv << " * rho(0) " << std::endl;
791  }
793  {
794  std::cout << " > Rel. residual DIVERGENCE : rho(kkk+1) > " << m_rel_residual_div << " * rho(0) " << std::endl;
795  }
797  {
798  std::cout << " > Negative residual DIVERGENCE" << std::endl;
799  }
801  {
802  std::cout << " > Iter. DIVERGENCE : kkk + 1 > " << m_max_iter_div << std::endl;
803  }
804  if(m_bUsingNullVecs)
805  {
806  if(m_bConvRBCorrRel)
807  {
808  std::cout << " > Rel. RB mode correction convergence : abs( RB(kkk+1) - RB_(kkk) ) / RB(kkk+1) < " << m_rb_modes_conv << std::endl;
809  }
810  }
811  std::cout << std::endl;
812 
813  std::cout << " --> Previous " << std::min(m_kkk+2,nb_of_iters) << " iterations convergence parameter : " << std::endl;
814  if(m_bUsingNullVecs)
815  {
816  std::cout << "[ kkk ] [ rho(kkk) ] [ | RB_corr(kkk) | ]" << std::endl;
817  }
818  else
819  {
820  std::cout << "[ kkk ] [ rho(kkk) ]" << std::endl;
821  }
822 
823  std::string command_string = "tail -n " + std::to_string(nb_of_iters) + " " + m_scratch_folder_path + "/FETI_convergence.dat";
824 
825  if(m_comm.rank() == 0)
826  {
827  std::cout << exec_command(command_string) << std::endl;
828  }
829  if( m_bConv ) {
830  std::cout << " --> Converged!" << std::endl;
831  } else if ( m_bDiv ) {
832  std::cout << " --> DIVERGED!" << std::endl;
833  } else {
834  std::cout << " --> Iterating ..." << std::endl;
835  }
836  std::cout << std::endl;
837 }
double m_abs_residual_conv
Absolute residual convergence.
bool m_bConvResidualRel
The residual converged? (relative to initial value)
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
std::string exec_command(const std::string &cmd)
std::string m_scratch_folder_path
Scratch folder path.
int m_max_iter_div
Number of iterations divergence.
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
double m_rb_modes_conv
Relative RB correction convergence (relative to previous value)
bool m_bDiv
Did the solver diverge?
bool m_bConvRBCorrRel
The RB correction converged? (relative to previous value)
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bConvResidualAbs
The residual converged? (absolute)
double m_rel_residual_div
Relative residual divergence (relative to initial value)
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
int m_kkk
Current iteration index.
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::read_all_previous_p ( )

Read all the previous p vectors.

Definition at line 384 of file FETI_operations_IO.cpp.

385 {
386  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
387  homemade_assert_msg(m_bSet_previous_residual,"Previous residual vector not set yet!");
388  homemade_assert_msg(m_bR_sizes_set,"Mediator space dimensions not set yet!");
389 
390  // Create p(0 ... kkk),
391  m_previous_p_ptr = new Vec[m_kkk+1];
392  VecDuplicateVecs(m_previous_residual,m_kkk+1,&m_previous_p_ptr);
393 
394  // Read p(0 ... kkk)
395  for(int iii = 0; iii < m_kkk+1; ++iii)
396  {
397  read_PETSC_vector(m_previous_p_ptr[iii],m_scratch_folder_path + "/FETI_iter__p__" + std::to_string(iii) + ".petscvec", m_comm.get());
398  }
399 
400  // Set flag
401  m_bSet_previous_p_ptr = true;
402 }
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
std::string m_scratch_folder_path
Scratch folder path.
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
bool m_bScratchFolderSet
Have the scratch folder been set?
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_previous_residual
Previous residual vector, r(kkk)
int m_kkk
Current iteration index.
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_all_previous_q ( )

Read all the previous q vectors.

Definition at line 404 of file FETI_operations_IO.cpp.

405 {
406  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
407  homemade_assert_msg(m_bSet_previous_residual,"Previous residual vector not set yet!");
408  homemade_assert_msg(m_bR_sizes_set,"Mediator space dimensions not set yet!");
409 
410  // Create q(0 ... kkk)
411  m_previous_q_ptr = new Vec[m_kkk+1];
412  VecDuplicateVecs(m_previous_residual,m_kkk+1,&m_previous_q_ptr);
413 
414  // Read q(0 ... kkk - 1)
415  if(m_kkk > 0)
416  {
417  for(int iii = 0; iii < m_kkk; ++iii)
418  {
419  read_PETSC_vector(m_previous_q_ptr[iii],m_scratch_folder_path + "/FETI_iter__q__" + std::to_string(iii) + ".petscvec", m_comm.get());
420  }
421  }
422 
423  // Set flags
424  m_bSet_previous_q_ptr = true;
425 }
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_previous_residual
Previous residual vector, r(kkk)
int m_kkk
Current iteration index.
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_coupling_matrices ( )

Read all the coupling matrices.

Definition at line 122 of file FETI_operations_IO.cpp.

123 {
124  homemade_assert_msg(m_bCouplingFolderSet,"Common coupling matrix path not set yet!");
127  this->set_coupling_matrix_RR();
128 }
void set_coupling_matrix_R_micro()
Read the mediator - micro system coupling matrix.
void set_coupling_matrix_RR()
Read the mediator - mediator system coupling matrix.
void set_coupling_matrix_R_BIG()
Read the mediator - macro system coupling matrix.
bool m_bCouplingFolderSet
Have the Coupling matrices folder been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::read_decoupled_solutions ( )

Read the decoupled solutions, $ u_0,i$.

Definition at line 222 of file FETI_operations_IO.cpp.

223 {
224  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
225 
226  // Create the vectors and, if needed, set sizes
227  VecCreate(m_comm.get(),&m_u_0_BIG);
228  VecCreate(m_comm.get(),&m_u_0_micro);
229 
230  // If the sizes were defined already, set them
231  if(m_bBIG_sizes_set)
232  {
234  }
235 
237  {
239  }
240 
241  // Read them
242  read_PETSC_vector(m_u_0_BIG,m_scratch_folder_path + "/ext_solver_u0_A_sys_sol_vec.petscvec", m_comm.get());
243  read_PETSC_vector(m_u_0_micro,m_scratch_folder_path + "/ext_solver_u0_B_sys_sol_vec.petscvec", m_comm.get());
244 
245  // If the sizes were not defined yet, define them
246  if(!m_bBIG_sizes_set)
247  {
248  VecGetLocalSize(m_u_0_BIG,&m_C_R_BIG_N_local);
249  VecGetSize(m_u_0_BIG,&m_C_R_BIG_N);
250  m_bBIG_sizes_set = true;
251  }
252 
253  if(!m_bmicro_sizes_set)
254  {
255  VecGetLocalSize(m_u_0_micro,&m_C_R_micro_N_local);
256  VecGetSize(m_u_0_micro,&m_C_R_micro_N);
257  m_bmicro_sizes_set = true;
258  }
259 
260  // Set null vector dimensions (if needed)
262  {
263  switch (m_RB_modes_system)
264  {
265  case RBModesSystem::MACRO :
268  break;
269 
270  case RBModesSystem::MICRO :
273  break;
274  }
276  }
277 
278  // Set the flag
279  m_bSet_u_0 = true;
280 }
bool m_bSet_u_0
Have the u_0 vectors been set?
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
Vec m_u_0_BIG
Solution of the decoupled macro model.
std::string m_scratch_folder_path
Scratch folder path.
Vec m_u_0_micro
Solution of the decoupled micro model.
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
bool m_bScratchFolderSet
Have the scratch folder been set?
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bmicro_sizes_set
Have the micro dimensions been set yet?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::read_ext_solver_output ( )

Read the latest external solver output.

Definition at line 282 of file FETI_operations_IO.cpp.

283 {
284  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
285 
286  // Create the vectors
287  VecCreate(m_comm.get(),&m_ext_solver_sol_BIG);
288  VecCreate(m_comm.get(),&m_ext_solver_sol_micro);
289 
290  // If the sizes were defined already, set them
291  if(m_bBIG_sizes_set)
292  {
294  }
295 
297  {
299  }
300 
301  // Read them
302  read_PETSC_vector(m_ext_solver_sol_BIG,m_scratch_folder_path + "/ext_solver_A_sys_sol_vec.petscvec", m_comm.get());
303  read_PETSC_vector(m_ext_solver_sol_micro,m_scratch_folder_path + "/ext_solver_B_sys_sol_vec.petscvec", m_comm.get());
304 
305  // If the sizes were not defined yet, define them
306  if(!m_bBIG_sizes_set)
307  {
308  VecGetLocalSize(m_ext_solver_sol_BIG,&m_C_R_BIG_N_local);
309  VecGetSize(m_ext_solver_sol_BIG,&m_C_R_BIG_N);
310  m_bBIG_sizes_set = true;
311  }
312 
313  if(!m_bmicro_sizes_set)
314  {
317  m_bmicro_sizes_set = true;
318  }
319 
320  // Set null vector dimensions (if needed)
322  {
323  switch (m_RB_modes_system)
324  {
325  case RBModesSystem::MACRO :
328  break;
329 
330  case RBModesSystem::MICRO :
333  break;
334  }
336  }
337 
338  // Set the flag
339  m_bSet_ext_solver_sol = true;
340 }
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
Vec m_ext_solver_sol_micro
Micro model external solver solution.
std::string m_scratch_folder_path
Scratch folder path.
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
bool m_bScratchFolderSet
Have the scratch folder been set?
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
libMesh::Parallel::Communicator & m_comm
Communicator.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
bool m_bSet_ext_solver_sol
Have the external solvers solutions been set vectors been set?
bool m_bmicro_sizes_set
Have the micro dimensions been set yet?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::read_jacobi_precond_vector ( )
protected

Read the Jacobi coupling matrix preconditioner vector.

Definition at line 44 of file FETI_operations_setup.cpp.

45 {
46  // Create and set the vector
47  VecCreate(m_comm.get(),&m_coupling_jacobi_precond_vec);
49 
50  // Read it
51  read_PETSC_vector(m_coupling_jacobi_precond_vec,m_scratch_folder_path + "/precond_Jacobi_vector.petscvec", m_comm.get());
52 
53  // Set flag
55 }
std::string m_scratch_folder_path
Scratch folder path.
Vec m_coupling_jacobi_precond_vec
Preconditioner Jacobi vector.
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCreatedPrecondJacobiVec
Have the preconditioner system solver been set?
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_null_space_inv_RITRI_mat ( )

Read the $ inv({R^I}^t \cdot R^I)$ matrix.

Definition at line 173 of file FETI_operations_IO.cpp.

174 {
175  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
176 
177  // A dummy vector which will be used to sync the matrices
178  std::vector<PetscScalar> dummy_matrix_contents(m_null_nb_vecs*m_null_nb_vecs, 0);
179 
180  MatCreateSeqDense(PETSC_COMM_SELF,m_null_nb_vecs,m_null_nb_vecs,NULL,&m_inv_RITRI_mat);
181 
182  // Only really read the matrix in the first processor
183  if(m_comm.rank() == 0)
184  {
185  read_PETSC_matrix(m_inv_RITRI_mat,m_scratch_folder_path + "/rb_inv_RITRI.petscmat",PETSC_COMM_SELF);
186 
187  // Get the data
188  PetscScalar *dummy_array;
189  MatDenseGetArray(m_inv_RITRI_mat,&dummy_array);
190 
191  for(int iii = 0; iii < m_null_nb_vecs*m_null_nb_vecs; ++iii)
192  {
193  dummy_matrix_contents[iii] = dummy_array[iii];
194  }
195 
196  MatDenseRestoreArray(m_inv_RITRI_mat,&dummy_array);
197  }
198 
199  // Sync the matrix!
200  m_comm.barrier();
201  m_comm.broadcast(dummy_matrix_contents);
202 
203  if(m_comm.rank() != 0)
204  {
205  std::vector<PetscInt> dummy_indexes(m_null_nb_vecs,0);
206 
207  for(int iii = 0; iii < m_null_nb_vecs; ++iii)
208  {
209  dummy_indexes[iii] = iii;
210  }
211 
212  MatSetValues(m_inv_RITRI_mat,m_null_nb_vecs,&dummy_indexes[0],m_null_nb_vecs,&dummy_indexes[0],&dummy_matrix_contents[0],INSERT_VALUES);
213  MatAssemblyBegin(m_inv_RITRI_mat,MAT_FINAL_ASSEMBLY);
214  MatAssemblyEnd(m_inv_RITRI_mat,MAT_FINAL_ASSEMBLY);
215  }
216 
217  // Set up flag
218  m_binvRITRIMatSet = true;
219 }
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
std::string m_scratch_folder_path
Scratch folder path.
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
bool m_bScratchFolderSet
Have the scratch folder been set?
void read_PETSC_matrix(Mat input_mat, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::read_null_space_vecs ( const std::string &  RB_vectors_base,
int  nb_of_rb_vectors 
)

Read the null space vectors.

Definition at line 131 of file FETI_operations_IO.cpp.

132 {
133 
134  /*
135  * Note: for now, this function reads both sets of null space vectors (the "original" ones and
136  * the ones multiplied by the coupling matrix), but I'm not sure if this less efficient than re-calculating
137  * these vectors each time. [Thiago]
138  */
139 
140  homemade_assert_msg(m_bNullVecsDimensionsSet,"Null vectors sizes not set yet!");
141  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
142 
143  // Set the null vec arrays
144  m_null_nb_vecs = nb_of_rb_vectors;
145 
146  // Set the first nullspace vectors
147  std::string rb_vec_filename = RB_vectors_base + "_0_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
148  VecCreate(m_comm.get(),&m_null_vecs[0]);
150  read_PETSC_vector(m_null_vecs[0],rb_vec_filename, m_comm.get());
151 
152  std::string rb_coupl_vec_filename = m_scratch_folder_path + "/rb_coupl_vector_0_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
153  VecCreate(m_comm.get(),&m_null_coupled_vecs[0]);
155  read_PETSC_vector(m_null_coupled_vecs[0],rb_coupl_vec_filename, m_comm.get());
156 
157  // Read and calculate the rest of the nullspace vectors
158  for(int iii = 1; iii < m_null_nb_vecs; ++iii)
159  {
160  rb_vec_filename = RB_vectors_base + "_" + std::to_string(iii) + "_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
161  VecDuplicate(m_null_vecs[0],&m_null_vecs[iii]);
162  read_PETSC_vector(m_null_vecs[iii],rb_vec_filename, m_comm.get());
163 
164  rb_coupl_vec_filename = m_scratch_folder_path + "/rb_coupl_vector_" + std::to_string(iii) + "_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
165  VecDuplicate(m_null_coupled_vecs[0],&m_null_coupled_vecs[iii]);
166  read_PETSC_vector(m_null_coupled_vecs[iii],rb_coupl_vec_filename, m_comm.get());
167  }
168 
169  // Set up flag
170  m_bNullVecsSet = true;
171 }
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
Vec m_null_vecs[maxVecLimit]
Null space vectors.
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::read_previous_phi ( )

Read the previous Lagrage multiplier / solution.

Definition at line 356 of file FETI_operations_IO.cpp.

357 {
358  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
359  homemade_assert_msg(m_bR_sizes_set,"Mediator space dimensions not set yet!");
360 
361  // Create the vectors
362  VecCreate(m_comm.get(),&m_previous_phi);
364  read_PETSC_vector(m_previous_phi,m_scratch_folder_path + "/FETI_iter__phi__current.petscvec", m_comm.get());
365 
366  // Set flag
367  m_bSet_previous_phi = true;
368 }
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
Vec m_previous_phi
Previous Lagrange multipliers / solution, phi(kkk)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bSet_previous_phi
Have the previous Lagrange multipliers / solution phi(kkk) been set?
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_previous_r ( )

Read the previous residual.

Definition at line 370 of file FETI_operations_IO.cpp.

371 {
372  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
373  homemade_assert_msg(m_bR_sizes_set,"Mediator space dimensions not set yet!");
374 
375  // Create the vectors
376  VecCreate(m_comm.get(),&m_previous_residual);
378  read_PETSC_vector(m_previous_residual,m_scratch_folder_path + "/FETI_iter__r__current.petscvec", m_comm.get());
379 
380  // Set flag
382 }
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_previous_residual
Previous residual vector, r(kkk)
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_rb_corr ( )

Read the rigid body modes correction vector.

Definition at line 342 of file FETI_operations_IO.cpp.

343 {
344  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
345  homemade_assert_msg(m_bNullVecsDimensionsSet,"Null vectors sizes not set yet!");
346 
347  // Create the vectors
348  VecCreate(m_comm.get(),&m_current_rb_correction);
350  read_PETSC_vector(m_current_rb_correction,m_scratch_folder_path + "/FETI_RB_correction.petscvec", m_comm.get());
351 
352  // Set flag
354 }
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
std::string m_scratch_folder_path
Scratch folder path.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
bool m_bScratchFolderSet
Have the scratch folder been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
void carl::FETI_Operations::read_scalar_data ( )

Read the scalar data, rho(0 ... kkk), | RB_corr(0 ... kkk) | and p(0 ... kkk - 1).q(0 ... kkk - 1)

Definition at line 427 of file FETI_operations_IO.cpp.

428 {
429  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
430 
431  // Import the scalar data
432  // File format: kkk rho(0) rho(kkk) [ RB_corr(kkk) ]
433 
434  // ONLY read in proc 0!
435  if(m_comm.rank() == 0)
436  {
437  std::ifstream scalar_data;
438 
439  scalar_data.open(m_scratch_folder_path + "/FETI_iter_scalar_data.dat");
440  scalar_data >> m_kkk >> m_rho_0 >> m_previous_rho;
441 
442  if(m_bUsingNullVecs)
443  {
444  scalar_data >> m_previous_RB_mode_corr;
445  }
446  scalar_data.close();
447  }
448 
449  // Broadcast the values
450  m_comm.broadcast(m_kkk);
451  m_comm.broadcast(m_rho_0);
452  m_comm.broadcast(m_previous_rho);
453  if(m_bUsingNullVecs)
454  {
455  m_comm.broadcast(m_previous_RB_mode_corr);
456  }
457 
458  // Import `p(0 ... kkk - 1).q(0 ... kkk - 1)`
459  m_p_dot_q.resize(m_kkk+1,0);
460  if(m_kkk != 0)
461  {
462  // ONLY read in proc 0!
463  if(m_comm.rank() == 0)
464  {
465  std::ifstream scalar_data;
466  scalar_data.open(m_scratch_folder_path + "/FETI_iter_p_dot_q.dat");
467 
468  for(int iii = 0; iii < m_kkk; ++iii)
469  {
470  scalar_data >> m_p_dot_q[iii];
471  }
472  scalar_data.close();
473  }
474 
475  // Broadcast the values
476  m_comm.broadcast(m_p_dot_q);
477  }
478 
479  // Set flag
480  m_bReadPreviousScalar = true;
481 }
double m_rho_0
Double containing the initial rho(0)
double m_previous_RB_mode_corr
Double containing the previous RB_mode_corr(kkk)
std::string m_scratch_folder_path
Scratch folder path.
bool m_bScratchFolderSet
Have the scratch folder been set?
double m_previous_rho
Double containing the previous rho(kkk)
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
bool m_bReadPreviousScalar
Read the previous iterations scalar data?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
int m_kkk
Current iteration index.
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::read_vector_data ( )

Read the vector data - essentially calls the "read_previous" and "read_all_previous" methods.

Definition at line 483 of file FETI_operations_IO.cpp.

484 {
485  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
486  homemade_assert_msg(m_bReadPreviousScalar,"Scalar data not set yet!");
487 
488  /* Vectors to read: 'r(kkk)'
489  * 'phi(kkk)'
490  * 'p(0 ... kkk)'
491  * 'q(0 ... kkk - 1)'
492  */
493 
494  // Create and read the vectors
495  // r(kkk)
496  this->read_previous_r();
497 
498  // phi(kkk)
499  this->read_previous_phi();
500 
501  // p(0 ... kkk)
502  this->read_all_previous_p();
503 
504  // q(0 ... kkk)
505  // Create q(0 ... kkk), read q(0 ... kkk - 1)
506  this->read_all_previous_q();
507 }
void read_previous_phi()
Read the previous Lagrage multiplier / solution.
void read_all_previous_q()
Read all the previous q vectors.
void read_previous_r()
Read the previous residual.
bool m_bScratchFolderSet
Have the scratch folder been set?
void read_all_previous_p()
Read all the previous p vectors.
bool m_bReadPreviousScalar
Read the previous iterations scalar data?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::set_coupling_matrix_R_BIG ( )

Read the mediator - macro system coupling matrix.

Definition at line 50 of file FETI_operations_IO.cpp.

51 {
52  homemade_assert_msg(m_bCouplingFolderSet,"Common coupling matrix path not set yet!");
53 
54  // Create matrix and, if needed, get sizes
55  MatCreate(m_comm.get(),&m_C_R_BIG);
56 
57  // If the sizes were defined already, set them
59  {
61  }
62 
63  // Read the matrix
64  read_PETSC_matrix(m_C_R_BIG,m_coupling_folder_path + "/coupling_matrix_macro.petscmat",m_comm.get());
65 
66  // If the macro sizes were not defined yet, define them
67  if(!m_bBIG_sizes_set)
68  {
70  MatGetSize(m_C_R_BIG,&m_C_R_BIG_M,&m_C_R_BIG_N);
71  m_bBIG_sizes_set = true;
72  }
73 
74  // If the mediator sizes were not defined yet, define them
75  if(!m_bR_sizes_set)
76  {
78  m_bR_sizes_set = true;
79  }
80 
81  // Set null vector dimensions (if needed)
83  {
87  }
88 
89  // Set flags
90  m_bC_R_BIG_MatrixSet = true;
92 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
std::string m_coupling_folder_path
Coupling matrices path.
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
bool m_bBIG_sizes_set
Have the macro dimensions been set yet?
void read_PETSC_matrix(Mat input_mat, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCouplingFolderSet
Have the Coupling matrices folder been set?
bool m_bCouplingMatricesSet
All coupling matrices has been set?
bool m_bC_R_micro_MatrixSet
Mediator - micro coupling matrix has been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::set_coupling_matrix_R_micro ( )

Read the mediator - micro system coupling matrix.

Definition at line 6 of file FETI_operations_IO.cpp.

7 {
8  homemade_assert_msg(m_bCouplingFolderSet,"Common coupling matrix path not set yet!");
9 
10  // Create matrix and, if needed, get sizes
11  MatCreate(m_comm.get(),&m_C_R_micro);
12 
13  // If the sizes were defined already, set them
15  {
17  }
18 
19  // Read the matrix
20  read_PETSC_matrix(m_C_R_micro,m_coupling_folder_path + "/coupling_matrix_micro.petscmat",m_comm.get());
21 
22  // If the micro sizes were not defined yet, define them
24  {
27  m_bmicro_sizes_set = true;
28  }
29 
30  // If the mediator sizes were not defined yet, define them
31  if(!m_bR_sizes_set)
32  {
34  m_bR_sizes_set = true;
35  }
36 
37  // Set null vector dimensions (if needed)
39  {
43  }
44 
45  // Set flags
48 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
std::string m_coupling_folder_path
Coupling matrices path.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
void read_PETSC_matrix(Mat input_mat, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCouplingFolderSet
Have the Coupling matrices folder been set?
bool m_bCouplingMatricesSet
All coupling matrices has 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?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
bool m_bUsingNullVecs
Do we need to use the null space vectors?
void carl::FETI_Operations::set_coupling_matrix_RR ( )

Read the mediator - mediator system coupling matrix.

Definition at line 94 of file FETI_operations_IO.cpp.

95 {
96  homemade_assert_msg(m_bCouplingFolderSet,"Common coupling matrix path not set yet!");
97 
98  // Create matrix and, if needed, get sizes
99  MatCreate(m_comm.get(),&m_C_RR);
100 
101  // If the sizes were defined already, set them
102  if(m_bR_sizes_set)
103  {
105  }
106 
107  read_PETSC_matrix(m_C_RR,m_coupling_folder_path + "/coupling_matrix_mediator.petscmat",m_comm.get());
108 
109  // If the mediator sizes were not defined yet, define them
110  if(!m_bR_sizes_set)
111  {
112  MatGetLocalSize(m_C_RR,&m_C_RR_M_local,NULL);
113  MatGetSize(m_C_RR,&m_C_RR_M,NULL);
114  m_bR_sizes_set = true;
115  }
116 
117  // Set flags
118  m_bC_RR_MatrixSet = true;
120 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
bool m_bR_sizes_set
Have the mediator dimensions been set yet?
std::string m_coupling_folder_path
Coupling matrices path.
Mat m_C_RR
Mediator - mediator system coupling matrix.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
void read_PETSC_matrix(Mat input_mat, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCouplingFolderSet
Have the Coupling matrices folder been set?
bool m_bCouplingMatricesSet
All coupling matrices has been set?
bool m_bC_R_micro_MatrixSet
Mediator - micro coupling matrix has been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::set_inverse_precond_solver ( )
protected

Set up the full inversed coupling matrix preconditioner.

Definition at line 6 of file FETI_operations_setup.cpp.

7 {
8  homemade_assert_msg(m_bC_RR_MatrixSet,"Preconditioner matrix not set yet!");
9 
10  KSPCreate(m_comm.get(), &m_coupling_precond_solver);
11  KSPSetOperators(m_coupling_precond_solver, m_C_RR, m_C_RR);
12  KSPSetFromOptions(m_coupling_precond_solver);
13 
15 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
Mat m_C_RR
Mediator - mediator system coupling matrix.
KSP m_coupling_precond_solver
Preconditioner system solver.
bool m_bCreatedPrecondSolver
Have the preconditioner system solver been set?
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void carl::FETI_Operations::set_jacobi_precond_vector ( )
protected

Set up the Jacobi coupling matrix preconditioner vector.

Definition at line 17 of file FETI_operations_setup.cpp.

18 {
19  homemade_assert_msg(m_bC_RR_MatrixSet,"Preconditioner matrix not set yet!");
20 
21  // Create and set the vector
22  VecCreate(m_comm.get(),&m_coupling_jacobi_precond_vec);
24  VecSetFromOptions(m_coupling_jacobi_precond_vec);
25 
26  // Get the diagonal
27  MatGetDiagonal(m_C_RR,m_coupling_jacobi_precond_vec);
28 
29  // Calculate the reciprocal
30  VecReciprocal(m_coupling_jacobi_precond_vec);
31 
32  // Export it
33  write_PETSC_vector(m_coupling_jacobi_precond_vec,m_scratch_folder_path + "/precond_Jacobi_vector.petscvec",m_comm.rank(),m_comm.get());
34 
35 // Print MatLab debugging output? Variable defined at "carl_headers.h"
36 #ifdef PRINT_MATLAB_DEBUG
38 #endif
39 
40  // Set flag
42 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
Mat m_C_RR
Mediator - mediator system coupling matrix.
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
Vec m_coupling_jacobi_precond_vec
Preconditioner Jacobi vector.
libMesh::Parallel::Communicator & m_comm
Communicator.
bool m_bCreatedPrecondJacobiVec
Have the preconditioner system solver been set?
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
void write_PETSC_vector_MATLAB(Vec input_vec, const std::string &filename, MPI_Comm comm=PETSC_COMM_WORLD)
void carl::FETI_Operations::set_null_space ( const std::string &  input_filename_base,
int  nb_of_vecs 
)

Set and print the null space vectors and matrices.

Definition at line 280 of file FETI_operations_setup.cpp.

281 {
282  homemade_assert_msg(m_bNullVecsDimensionsSet,"Null vectors sizes not set yet!");
283  homemade_assert_msg(m_bScratchFolderSet,"Scratch folder not set yet!");
284 
285  // Set the null vec arrays
286  m_null_nb_vecs = nb_of_vecs;
287 
288  // Set the (dummy) coupling matrix pointer
289  Mat * coupling_matrix;
290 
291  switch (m_RB_modes_system)
292  {
293  case RBModesSystem::MICRO :
294  coupling_matrix = &m_C_R_micro;
295  break;
296 
297  case RBModesSystem::MACRO :
298  // TODO: Remove the error message below after the more general code was implemented
299  homemade_error_msg("Option not implemented yet!");
300  coupling_matrix = &m_C_R_BIG;
301  break;
302  }
303 
304  // Matrix dimensions
305  // M x N
306  // coupling_matrix : n_med x n_sys
307  // m_null_vecs : n_sys x nb_of_vecs ( R ) -> nb_of_vecs vectors of dim n_sys
308  // m_null_coupled_vecs : n_med x nb_of_vecs ( RC ) -> nb_of_vecs vectors of dim n_coupl
309 
310  // Set the first nullspace vectors
311  std::string input_filename = input_filename_base + "_0_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
312  VecCreate(m_comm.get(),&m_null_vecs[0]);
314  read_PETSC_vector(m_null_vecs[0],input_filename, m_comm.get());
315 
316  std::string output_filename = m_scratch_folder_path + "/rb_coupl_vector_0_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
317  VecCreate(m_comm.get(),&m_null_coupled_vecs[0]);
319  VecSetFromOptions(m_null_coupled_vecs[0]);
320  MatMult(*coupling_matrix,m_null_vecs[0],m_null_coupled_vecs[0]);
321  write_PETSC_vector(m_null_coupled_vecs[0],output_filename,m_comm.rank(),m_comm.get());
322 
323  // Read and calculate the rest of the nullspace vectors
324  for(int iii = 1; iii < m_null_nb_vecs; ++iii)
325  {
326  input_filename = input_filename_base + "_" + std::to_string(iii) + "_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
327  VecDuplicate(m_null_vecs[0],&m_null_vecs[iii]);
328  read_PETSC_vector(m_null_vecs[iii],input_filename, m_comm.get());
329 
330  std::string output_filename = m_scratch_folder_path + "/rb_coupl_vector_" + std::to_string(iii) + "_n_" + std::to_string(m_null_nb_vecs) + ".petscvec";
331  VecDuplicate(m_null_coupled_vecs[0],&m_null_coupled_vecs[iii]);
332  MatMult(*coupling_matrix,m_null_vecs[iii],m_null_coupled_vecs[iii]);
333 
334  write_PETSC_vector(m_null_coupled_vecs[iii],output_filename,m_comm.rank(),m_comm.get());
335  }
336 
337  // Build the LOCAL dense matrix
338  std::vector<PetscScalar> dummy_vec_val(m_null_nb_vecs,0);
339  std::vector<PetscInt> dummy_vec_row(m_null_nb_vecs,0);
340 
341  for(PetscInt iii = 0; iii < m_null_nb_vecs; ++iii)
342  {
343  dummy_vec_row[iii] = iii;
344  }
345 
346  MatCreateSeqDense(PETSC_COMM_SELF,m_null_nb_vecs,m_null_nb_vecs,NULL,&m_RITRI_mat);
347 
348  for(PetscInt iii = 0; iii < m_null_nb_vecs; ++iii)
349  {
350  VecMDot(m_null_coupled_vecs[iii],m_null_nb_vecs,m_null_coupled_vecs,dummy_vec_val.data());
351  MatSetValues(m_RITRI_mat,m_null_nb_vecs,dummy_vec_row.data(),1,&iii,dummy_vec_val.data(),INSERT_VALUES);
352  }
353  MatAssemblyBegin(m_RITRI_mat,MAT_FINAL_ASSEMBLY);
354  MatAssemblyEnd(m_RITRI_mat,MAT_FINAL_ASSEMBLY);
355 
357 
358  if(m_comm.rank() == 0)
359  {
360  write_PETSC_matrix(m_inv_RITRI_mat,m_scratch_folder_path + "/rb_inv_RITRI.petscmat",0,PETSC_COMM_SELF);
361  }
362 
363  // Set up flag
364  m_bNullVecsSet = true;
365  m_binvRITRIMatSet = true;
366 
367  // Cleanup
368  MatDestroy(&m_RITRI_mat);
369 }
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_bNullVecsDimensionsSet
Have the null space vectors' dimensions been set?
#define homemade_error_msg(msg)
Definition: common_header.h:73
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
std::string m_scratch_folder_path
Scratch folder path.
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
bool m_bScratchFolderSet
Have the scratch folder been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
void PETSC_invert_dense_matrix(Mat &matrix_in, Mat &matrix_out)
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
libMesh::Parallel::Communicator & m_comm
Communicator.
#define homemade_assert_msg(asserted, msg)
Definition: common_header.h:63
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
void read_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename)
Vec m_null_vecs[maxVecLimit]
Null space vectors.
void write_PETSC_matrix(Mat input_mat, const std::string &filename, int rank, MPI_Comm comm=PETSC_COMM_WORLD, int dim=1)
bool m_bNullVecsSet
Have the null space vectors been set?
void carl::FETI_Operations::set_preconditioner ( BaseCGPrecondType  CG_precond_type,
bool  bInitialSet = true 
)

Set the preconditioner type. The boolean bInitialSet determinates if, in the case of a COUPLING_JACOBI preconditioner, if it will calculate the needed vector (true) or if it will read it (false).

Definition at line 241 of file FETI_operations_setup.cpp.

242 {
243  m_precond_type = CG_precond_type;
244 
245  switch (m_precond_type)
246  {
248  // Well ... nothing to do ...
249  break;
250 
252  // Read the mediator - mediator coupling matrix and set the solver
253  this->set_coupling_matrix_RR();
255  m_bC_RR_MatrixSet = true;
256  break;
257 
259  if(bInitialSet)
260  {
261  // Read the mediator - mediator coupling matrix and build the Jacobi coupling preconditioner vector
262  this->set_coupling_matrix_RR();
264  m_bC_RR_MatrixSet = true;
265  } else {
266  // Just read the Jacobi coupling preconditioner vector
268  m_bC_RR_MatrixSet = true;
269  }
270  break;
271  }
272 }
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
void read_jacobi_precond_vector()
Read the Jacobi coupling matrix preconditioner vector.
void set_coupling_matrix_RR()
Read the mediator - mediator system coupling matrix.
void set_jacobi_precond_vector()
Set up the Jacobi coupling matrix preconditioner vector.
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
void set_inverse_precond_solver()
Set up the full inversed coupling matrix preconditioner.
void carl::FETI_Operations::using_rb_modes ( bool  bUseRigidBodyModes)

Set up the.

Definition at line 275 of file FETI_operations_setup.cpp.

276 {
277  m_bUsingNullVecs = bUseRigidBodyModes;
278 }
bool m_bUsingNullVecs
Do we need to use the null space vectors?

Member Data Documentation

double carl::FETI_Operations::m_abs_residual_conv
protected

Absolute residual convergence.

Definition at line 166 of file FETI_operations.h.

bool carl::FETI_Operations::m_bBIG_sizes_set
protected

Have the macro dimensions been set yet?

Definition at line 79 of file FETI_operations.h.

bool carl::FETI_Operations::m_bC_R_BIG_MatrixSet
protected

Mediator - macro coupling matrix has been set?

Definition at line 74 of file FETI_operations.h.

bool carl::FETI_Operations::m_bC_R_micro_MatrixSet
protected

Mediator - micro coupling matrix has been set?

Definition at line 73 of file FETI_operations.h.

bool carl::FETI_Operations::m_bC_RR_MatrixSet
protected

Mediator - mediator coupling matrix has been set?

Definition at line 75 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCalculatedScalar
protected

Calculated the current iterations scalar data?

Definition at line 163 of file FETI_operations.h.

bool carl::FETI_Operations::m_bConv
protected

Did the solver converge?

Definition at line 179 of file FETI_operations.h.

bool carl::FETI_Operations::m_bConvRBCorrRel
protected

The RB correction converged? (relative to previous value)

Definition at line 175 of file FETI_operations.h.

bool carl::FETI_Operations::m_bConvResidualAbs
protected

The residual converged? (absolute)

Definition at line 173 of file FETI_operations.h.

bool carl::FETI_Operations::m_bConvResidualRel
protected

The residual converged? (relative to initial value)

Definition at line 174 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCoupled_sols_set
protected

Have the coupled solutions been set yet?

Definition at line 186 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCouplingFolderSet
protected

Have the Coupling matrices folder been set?

Definition at line 43 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCouplingMatricesSet
protected

All coupling matrices has been set?

Definition at line 76 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCreatedPrecondJacobiVec
protected

Have the preconditioner system solver been set?

Definition at line 88 of file FETI_operations.h.

bool carl::FETI_Operations::m_bCreatedPrecondSolver
protected

Have the preconditioner system solver been set?

Definition at line 87 of file FETI_operations.h.

bool carl::FETI_Operations::m_bDiv
protected

Did the solver diverge?

Definition at line 180 of file FETI_operations.h.

bool carl::FETI_Operations::m_bDivIter
protected

The number of iterations diverged?

Definition at line 178 of file FETI_operations.h.

bool carl::FETI_Operations::m_bDivResidualNeg
protected

The residual is negative? (more usefull for debugging, really)

Definition at line 177 of file FETI_operations.h.

bool carl::FETI_Operations::m_bDivResidualRel
protected

The residual diverged? (relative to initial value)

Definition at line 176 of file FETI_operations.h.

bool carl::FETI_Operations::m_binvRITRIMatSet
protected

Have the inv(RI^T * RI) matrix been set?

Definition at line 113 of file FETI_operations.h.

bool carl::FETI_Operations::m_bmicro_sizes_set
protected

Have the micro dimensions been set yet?

Definition at line 78 of file FETI_operations.h.

bool carl::FETI_Operations::m_bNullVecsDimensionsSet
protected

Have the null space vectors' dimensions been set?

Definition at line 112 of file FETI_operations.h.

bool carl::FETI_Operations::m_bNullVecsSet
protected

Have the null space vectors been set?

Definition at line 111 of file FETI_operations.h.

bool carl::FETI_Operations::m_bR_sizes_set
protected

Have the mediator dimensions been set yet?

Definition at line 80 of file FETI_operations.h.

bool carl::FETI_Operations::m_bReadPreviousScalar
protected

Read the previous iterations scalar data?

Definition at line 162 of file FETI_operations.h.

bool carl::FETI_Operations::m_bScratchFolderSet
protected

Have the scratch folder been set?

Definition at line 42 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_current_p
protected

Have the current p(kkk+1) vector been set?

Definition at line 149 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_current_phi
protected

Have the current Lagrange multipliers / solution phi(kkk+1) been set?

Definition at line 150 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_current_RB_correction
protected

Have the RB modes correction RB_corr(kkk+1) vector been set?

Definition at line 151 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_current_residual
protected

Have the current r(kkk+1) vector been set?

Definition at line 147 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_current_z
protected

Have the current z(kkk+1) vector been set?

Definition at line 148 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_ext_solver_sol
protected

Have the external solvers solutions been set vectors been set?

Definition at line 145 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_previous_p_ptr
protected

Have the previous p vectors, p(0 ... kkk), been set?

Definition at line 155 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_previous_phi
protected

Have the previous Lagrange multipliers / solution phi(kkk) been set?

Definition at line 154 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_previous_q_ptr
protected

Have the previous q vectors, q(0 ... kkk), been set?

Definition at line 156 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_previous_residual
protected

Have the previous r(kkk) vector been set?

Definition at line 153 of file FETI_operations.h.

bool carl::FETI_Operations::m_bSet_u_0
protected

Have the u_0 vectors been set?

Definition at line 144 of file FETI_operations.h.

bool carl::FETI_Operations::m_bUsingNullVecs
protected

Do we need to use the null space vectors?

Definition at line 110 of file FETI_operations.h.

Mat carl::FETI_Operations::m_C_R_BIG
protected

Mediator - macro system coupling matrix.

Definition at line 53 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_BIG_M
protected

Definition at line 65 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_BIG_M_local
protected

Definition at line 65 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_BIG_N
protected

Definition at line 65 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_BIG_N_local
protected

Definition at line 65 of file FETI_operations.h.

Mat carl::FETI_Operations::m_C_R_micro
protected

Mediator - micro system coupling matrix.

Definition at line 52 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_micro_M
protected

Definition at line 64 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_micro_M_local
protected

Definition at line 64 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_micro_N
protected

Definition at line 64 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_R_micro_N_local
protected

Definition at line 64 of file FETI_operations.h.

Mat carl::FETI_Operations::m_C_RR
protected

Mediator - mediator system coupling matrix.

Definition at line 54 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_RR_M
protected

Definition at line 66 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_C_RR_M_local
protected

Definition at line 66 of file FETI_operations.h.

libMesh::Parallel::Communicator& carl::FETI_Operations::m_comm
protected

Communicator.

Definition at line 41 of file FETI_operations.h.

Vec carl::FETI_Operations::m_coupled_sol_BIG
protected

Coupled system solution for the macro model.

Definition at line 184 of file FETI_operations.h.

Vec carl::FETI_Operations::m_coupled_sol_micro
protected

Coupled system solution for the micro model.

Definition at line 183 of file FETI_operations.h.

std::string carl::FETI_Operations::m_coupling_folder_path
protected

Coupling matrices path.

Definition at line 45 of file FETI_operations.h.

Vec carl::FETI_Operations::m_coupling_jacobi_precond_vec
protected

Preconditioner Jacobi vector.

Definition at line 70 of file FETI_operations.h.

KSP carl::FETI_Operations::m_coupling_precond_solver
protected

Preconditioner system solver.

Definition at line 69 of file FETI_operations.h.

Vec carl::FETI_Operations::m_current_p
protected

Current p(kkk+1) (p(0) for the initialization)

Definition at line 125 of file FETI_operations.h.

Vec carl::FETI_Operations::m_current_phi
protected

Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization)

Definition at line 127 of file FETI_operations.h.

Vec carl::FETI_Operations::m_current_rb_correction
protected

Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization)

Definition at line 128 of file FETI_operations.h.

double carl::FETI_Operations::m_current_RB_mode_corr
protected

Double containing the current RB_mode_corr(kkk+1)

Definition at line 139 of file FETI_operations.h.

Vec carl::FETI_Operations::m_current_residual
protected

Current residual vector, r(kkk+1) (r(0) for the initialization)

Definition at line 123 of file FETI_operations.h.

double carl::FETI_Operations::m_current_rho
protected

Double containing the current rho(kkk+1)

Definition at line 138 of file FETI_operations.h.

Vec carl::FETI_Operations::m_current_z
protected

Current z(kkk+1) (z(0) for the initialization)

Definition at line 124 of file FETI_operations.h.

Vec carl::FETI_Operations::m_ext_solver_sol_BIG
protected

Macro model external solver solution.

Definition at line 121 of file FETI_operations.h.

Vec carl::FETI_Operations::m_ext_solver_sol_micro
protected

Micro model external solver solution.

Definition at line 120 of file FETI_operations.h.

IterationStatus carl::FETI_Operations::m_FETI_solver_status
protected

Current FETI / CG solver status.

Definition at line 46 of file FETI_operations.h.

double carl::FETI_Operations::m_gamma
protected

Double containing the value of rho(kkk) / p(kkk) . q(kkk)

Definition at line 136 of file FETI_operations.h.

Mat carl::FETI_Operations::m_inv_RITRI_mat
protected

Matrix $ inv({R^I}^t \cdot R^I)$, used in some projectors.

Definition at line 107 of file FETI_operations.h.

int carl::FETI_Operations::m_kkk
protected

Current iteration index.

Definition at line 47 of file FETI_operations.h.

int carl::FETI_Operations::m_max_iter_div
protected

Number of iterations divergence.

Definition at line 170 of file FETI_operations.h.

Vec carl::FETI_Operations::m_null_coupled_vecs[maxVecLimit]
protected

Null space vectors times the coupling matrix.

Definition at line 100 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_null_nb_vecs
protected

Number of null space vectors.

Definition at line 97 of file FETI_operations.h.

Vec carl::FETI_Operations::m_null_vecs[maxVecLimit]
protected

Null space vectors.

Definition at line 99 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_null_vecs_N
protected

Definition at line 103 of file FETI_operations.h.

PetscInt carl::FETI_Operations::m_null_vecs_N_local
protected

Definition at line 103 of file FETI_operations.h.

std::vector<double> carl::FETI_Operations::m_p_dot_q
protected

Vector containing the p.q scalar products.

Definition at line 159 of file FETI_operations.h.

BaseCGPrecondType carl::FETI_Operations::m_precond_type
protected

Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.

Definition at line 82 of file FETI_operations.h.

Vec* carl::FETI_Operations::m_previous_p_ptr
protected

Pointer to the previous p vectors, p(0 ... kkk)

Definition at line 132 of file FETI_operations.h.

Vec carl::FETI_Operations::m_previous_phi
protected

Previous Lagrange multipliers / solution, phi(kkk)

Definition at line 131 of file FETI_operations.h.

Vec* carl::FETI_Operations::m_previous_q_ptr
protected

Pointer to the previous q vectors, q(0 ... kkk)

Definition at line 133 of file FETI_operations.h.

double carl::FETI_Operations::m_previous_RB_mode_corr
protected

Double containing the previous RB_mode_corr(kkk)

Definition at line 141 of file FETI_operations.h.

Vec carl::FETI_Operations::m_previous_residual
protected

Previous residual vector, r(kkk)

Definition at line 130 of file FETI_operations.h.

double carl::FETI_Operations::m_previous_rho
protected

Double containing the previous rho(kkk)

Definition at line 140 of file FETI_operations.h.

double carl::FETI_Operations::m_rb_modes_conv
protected

Relative RB correction convergence (relative to previous value)

Definition at line 168 of file FETI_operations.h.

RBModesSystem carl::FETI_Operations::m_RB_modes_system
protected

Which model is associated to the RB modes? Default: RBModesSystem::MICRO.

Definition at line 85 of file FETI_operations.h.

double carl::FETI_Operations::m_rel_residual_conv
protected

Relative residual convergence (relative to initial value)

Definition at line 167 of file FETI_operations.h.

double carl::FETI_Operations::m_rel_residual_div
protected

Relative residual divergence (relative to initial value)

Definition at line 169 of file FETI_operations.h.

double carl::FETI_Operations::m_rho_0
protected

Double containing the initial rho(0)

Definition at line 137 of file FETI_operations.h.

Mat carl::FETI_Operations::m_RITRI_mat
protected

Matrix ${R^I}^t \cdot R^I = R^t C^t \cdot C R $.

Definition at line 106 of file FETI_operations.h.

std::string carl::FETI_Operations::m_scratch_folder_path
protected

Scratch folder path.

Definition at line 44 of file FETI_operations.h.

Vec carl::FETI_Operations::m_u_0_BIG
protected

Solution of the decoupled macro model.

Definition at line 118 of file FETI_operations.h.

Vec carl::FETI_Operations::m_u_0_micro
protected

Solution of the decoupled micro model.

Definition at line 117 of file FETI_operations.h.


The documentation for this class was generated from the following files: