23 VecCreate(
m_comm.get(),&vec_force_PETSc);
27 Vec aux_null_vec_input;
28 Vec aux_null_vec_output;
33 VecZeroEntries(aux_null_vec_input);
34 VecZeroEntries(aux_null_vec_output);
39 PetscScalar *dummy_array_input;
40 VecGetArray(aux_null_vec_input,&dummy_array_input);
43 VecDot(vec_force_PETSc,
m_null_vecs[iii],&dummy_array_input[iii]);
45 VecRestoreArray(aux_null_vec_input,&dummy_array_input);
61 PetscScalar *dummy_array_output;
62 VecGetArray(aux_null_vec_output,&dummy_array_output);
64 VecRestoreArray(aux_null_vec_output,&dummy_array_output);
69 VecDestroy(&vec_force_PETSc);
70 VecDestroy(&aux_null_vec_input);
71 VecDestroy(&aux_null_vec_output);
130 VecDestroy(&dummy_vec);
146 std::vector<PetscScalar> beta(
m_kkk+1,0);
148 for(
int iii = 0; iii <
m_kkk+1; ++iii)
150 beta[iii] = - beta[iii] /
m_p_dot_q[iii];
184 double dummy_double = -
m_gamma;
223 Vec dummy_vec, dummy_vec_bis;
236 VecDestroy(&dummy_vec);
237 VecDestroy(&dummy_vec_bis);
292 Vec dummy_seq_vec_bis;
294 VecZeroEntries(dummy_seq_vec);
295 VecDuplicate(dummy_seq_vec,&dummy_seq_vec_bis);
304 PetscScalar *dummy_seq_array;
305 VecGetArray(dummy_seq_vec,&dummy_seq_array);
308 VecRestoreArray(dummy_seq_vec,&dummy_seq_array);
322 VecGetArray(dummy_seq_vec_bis,&dummy_seq_array);
324 VecRestoreArray(dummy_seq_vec_bis,&dummy_seq_array);
327 VecDestroy(&dummy_seq_vec);
328 VecDestroy(&dummy_seq_vec_bis);
467 return output_status;
double m_abs_residual_conv
Absolute residual convergence.
Vec m_current_residual
Current residual vector, r(kkk+1) (r(0) for the initialization)
bool m_bC_RR_MatrixSet
Mediator - mediator coupling matrix has been set?
double m_rho_0
Double containing the initial rho(0)
PetscInt m_null_nb_vecs
Number of null space vectors.
bool m_bSet_u_0
Have the u_0 vectors been set?
bool m_bConvResidualRel
The residual converged? (relative to initial value)
bool m_bSet_previous_residual
Have the previous r(kkk) vector been set?
Vec m_previous_phi
Previous Lagrange multipliers / solution, phi(kkk)
double m_previous_RB_mode_corr
Double containing the previous RB_mode_corr(kkk)
bool m_binvRITRIMatSet
Have the inv(RI^T * RI) matrix been set?
void calculate_q()
Calculate the current q(kkk) vector.
double m_gamma
Double containing the value of rho(kkk) / p(kkk) . q(kkk)
Mat m_C_R_BIG
Mediator - macro system coupling matrix.
void calculate_null_space_phi_0(const std::string &force_path)
Calculate the inital solution, .
bool m_bConv
Did the solver converge?
double m_rel_residual_conv
Relative residual convergence (relative to initial value)
Vec m_ext_solver_sol_micro
Micro model external solver solution.
bool m_bDivIter
The number of iterations diverged?
Vec m_u_0_BIG
Solution of the decoupled macro model.
void calculate_z()
Calculate the current z(kkk+1) vector.
Vec m_coupled_sol_micro
Coupled system solution for the micro model.
void calculate_phi()
Calculate the current phi(kkk+1) solution vector.
bool m_bC_R_BIG_MatrixSet
Mediator - macro coupling matrix has been set?
void calculate_scalar_data()
Calculate the scalar quantities.
Vec * m_previous_p_ptr
Pointer to the previous p vectors, p(0 ... kkk)
Mat m_inv_RITRI_mat
Matrix , used in some projectors.
int m_max_iter_div
Number of iterations divergence.
void calculate_initial_p()
Calculate the initial p(0) vector.
bool m_bSet_current_RB_correction
Have the RB modes correction RB_corr(kkk+1) vector been set?
bool m_bCalculatedScalar
Calculated the current iterations scalar data?
Vec m_u_0_micro
Solution of the decoupled micro model.
bool m_bDivResidualNeg
The residual is negative? (more usefull for debugging, really)
Vec m_current_z
Current z(kkk+1) (z(0) for the initialization)
void calculate_coupled_solution()
Calculate the final coupled solution.
Vec m_current_rb_correction
Current rigid body modes correction, RB_corr(kkk+1) (RB_corr(0) for the initialization) ...
bool m_bScratchFolderSet
Have the scratch folder been set?
Mat m_C_R_micro
Mediator - micro system coupling matrix.
bool m_bSet_previous_p_ptr
Have the previous p vectors, p(0 ... kkk), been set?
void calculate_rb_correction()
Calculate the rigid body modes corrections.
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)
Vec * m_previous_q_ptr
Pointer to the previous q vectors, q(0 ... kkk)
void PETSC_MatMultScale_Bcast(Mat mat_seq, Vec vec_seq_in, Vec vec_seq_out, double a_const)
double m_previous_rho
Double containing the previous rho(kkk)
bool m_bDiv
Did the solver diverge?
void calculate_r()
Calculate the current r(kkk+1) residual vector.
bool m_bSet_current_residual
Have the current r(kkk+1) vector been set?
IterationStatus check_convergence(double rel_residual_conv, double abs_residual_conv, int max_iter_div, double rel_residual_div, double rb_modes_conv=-1)
Check the convergence.
void calculate_p()
Calculate the current p(kkk+1) vector.
Vec m_coupled_sol_BIG
Coupled system solution for the macro model.
std::vector< double > m_p_dot_q
Vector containing the p.q scalar products.
RBModesSystem m_RB_modes_system
Which model is associated to the RB modes? Default: RBModesSystem::MICRO.
bool m_bSet_previous_q_ptr
Have the previous q vectors, q(0 ... kkk), been set?
bool m_bConvRBCorrRel
The RB correction converged? (relative to previous value)
libMesh::Parallel::Communicator & m_comm
Communicator.
Vec m_ext_solver_sol_BIG
Macro model external solver solution.
bool m_bConvResidualAbs
The residual converged? (absolute)
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_bSet_current_p
Have the current p(kkk+1) vector been set?
Vec m_current_phi
Current Lagrange multipliers / solution, phi(kkk+1) (phi(0) for the initialization) ...
BaseCGPrecondType m_precond_type
Preconditioner type. Default: BaseCGPrecondType::NO_PRECONDITIONER.
bool m_bSet_previous_phi
Have the previous Lagrange multipliers / solution phi(kkk) been set?
void apply_RB_projection(Vec vec_in, Vec vec_out)
Apply the rigid body modes projection operation.
bool m_bCoupled_sols_set
Have the coupled solutions been set yet?
Vec m_null_coupled_vecs[maxVecLimit]
Null space vectors times the coupling matrix.
bool m_bDivResidualRel
The residual diverged? (relative to initial value)
Vec m_previous_residual
Previous residual vector, r(kkk)
int m_kkk
Current iteration index.
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?
void apply_precond(Vec vec_in, Vec vec_out)
Common interface to the preconditionners.
Vec m_current_p
Current p(kkk+1) (p(0) for the initialization)
void calculate_initial_r()
Calculate the inital residual vector, r(0)
Vec m_null_vecs[maxVecLimit]
Null space vectors.
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?