structure for Arc Length pre-conditioner
More...
#include <users_modules/basic_finite_elements/src/ArcLengthTools.hpp>
|
| PCArcLengthCtx (Mat shell_Aij, Mat aij, boost::shared_ptr< ArcLengthCtx > arc_ptr) |
|
| PCArcLengthCtx (PC pc, Mat shell_Aij, Mat aij, boost::shared_ptr< ArcLengthCtx > arc_ptr) |
|
DEPRECATED | PCArcLengthCtx (Mat shell_Aij, Mat aij, ArcLengthCtx *arc_ptr_raw) |
|
DEPRECATED | PCArcLengthCtx (PC pc, Mat shell_Aij, Mat aij, ArcLengthCtx *arc_ptr_raw) |
|
structure for Arc Length pre-conditioner
Definition at line 235 of file ArcLengthTools.hpp.
◆ PCArcLengthCtx() [1/4]
PCArcLengthCtx::PCArcLengthCtx |
( |
Mat |
shell_Aij, |
|
|
Mat |
aij, |
|
|
boost::shared_ptr< ArcLengthCtx > |
arc_ptr |
|
) |
| |
Definition at line 222 of file ArcLengthTools.cpp.
226 auto comm = PetscObjectComm((PetscObject)aij);
229 ierr = KSPAppendOptionsPrefix(
kSP,
"arc_length_");
230 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
◆ PCArcLengthCtx() [2/4]
PCArcLengthCtx::PCArcLengthCtx |
( |
PC |
pc, |
|
|
Mat |
shell_Aij, |
|
|
Mat |
aij, |
|
|
boost::shared_ptr< ArcLengthCtx > |
arc_ptr |
|
) |
| |
Definition at line 233 of file ArcLengthTools.cpp.
237 auto comm = PetscObjectComm((PetscObject)aij);
239 ierr = KSPAppendOptionsPrefix(
kSP,
"arc_length_");
240 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
◆ PCArcLengthCtx() [3/4]
PCArcLengthCtx::PCArcLengthCtx |
( |
Mat |
shell_Aij, |
|
|
Mat |
aij, |
|
|
ArcLengthCtx * |
arc_ptr_raw |
|
) |
| |
- Deprecated:
- use with shared_ptr
Definition at line 203 of file ArcLengthTools.cpp.
205 auto comm = PetscObjectComm((PetscObject)aij);
208 ierr = KSPAppendOptionsPrefix(
kSP,
"arc_length_");
209 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
◆ PCArcLengthCtx() [4/4]
PCArcLengthCtx::PCArcLengthCtx |
( |
PC |
pc, |
|
|
Mat |
shell_Aij, |
|
|
Mat |
aij, |
|
|
ArcLengthCtx * |
arc_ptr_raw |
|
) |
| |
- Deprecated:
- use with shared_ptr
Definition at line 212 of file ArcLengthTools.cpp.
216 auto comm = PetscObjectComm((PetscObject)aij);
218 ierr = KSPAppendOptionsPrefix(
kSP,
"arc_length_");
219 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
◆ PCApplyArcLength
apply operator for Arc Length pre-conditioner solves K*pc_x = pc_f solves K*xLambda = -dF_lambda solves ddlambda = ( res_lambda - db*xLambda )/( diag + db*pc_x ) calculate pc_x = pc_x + ddlambda*xLambda
Definition at line 243 of file ArcLengthTools.cpp.
246 CHKERR PCShellGetContext(pc, &void_ctx);
249 MatShellGetContext(ctx->
shellAij, &void_MatCtx);
252 PetscObjectTypeCompare((PetscObject)ctx->
kSP, KSPPREONLY, &same);
258 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_FALSE);
259 CHKERR KSPSetInitialGuessKnoll(ctx->
kSP, PETSC_FALSE);
265 if (same != PETSC_TRUE) {
266 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_TRUE);
268 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_FALSE);
271 double db_dot_x_lambda;
276 double ddlambda = -(res_lambda - db_dot_pc_x) / denominator;
282 if (ddlambda != ddlambda || denominator == 0) {
284 double nrm2_pc_f, nrm2_db, nrm2_pc_x, nrm2_xLambda;
285 CHKERR VecNorm(pc_f, NORM_2, &nrm2_pc_f);
287 CHKERR VecNorm(pc_x, NORM_2, &nrm2_pc_x);
290 MOFEM_LOG(
"WORLD", Sev::error) <<
"problem with ddlambda=" << ddlambda;
291 MOFEM_LOG(
"WORLD", Sev::error) <<
"res_lambda=" << res_lambda;
292 MOFEM_LOG(
"WORLD", Sev::error) <<
"denominator=" << denominator;
293 MOFEM_LOG(
"WORLD", Sev::error) <<
"db_dot_pc_x=" << db_dot_pc_x;
294 MOFEM_LOG(
"WORLD", Sev::error) <<
"db_dot_x_lambda=" << db_dot_x_lambda;
296 MOFEM_LOG(
"WORLD", Sev::error) <<
"nrm2_db=" << nrm2_db;
297 MOFEM_LOG(
"WORLD", Sev::error) <<
"nrm2_pc_f=" << nrm2_pc_f;
298 MOFEM_LOG(
"WORLD", Sev::error) <<
"nrm2_pc_x=" << nrm2_pc_x;
299 MOFEM_LOG(
"WORLD", Sev::error) <<
"nrm2_xLambda=" << nrm2_xLambda;
302 "Increment of lambda is not number");
309 CHKERR VecDuplicate(pc_x, &y);
311 CHKERR VecAXPY(y, -1, pc_f);
317 CHKERR VecNorm(y, NORM_2, &norm_y);
318 MOFEM_LOG_C(
"WORLD", Sev::noisy,
"Debug res y = %3.4e res_lambda_y = %3.4e",
319 norm_y, res_lambda_y);
◆ PCSetupArcLength
set up structure for Arc Length pre-conditioner
it sets pre-conditioner for matrix K
Definition at line 326 of file ArcLengthTools.cpp.
329 CHKERR PCShellGetContext(pc, &void_ctx);
331 auto get_pc_ops = [&](
auto pc) {
333 Mat shell_aij_raw, aij_raw;
334 CHKERR PCGetOperators(pc, &shell_aij_raw, &aij_raw);
340 CHKERR PCSetUseAmat(pc, PETSC_TRUE);
344 #if PETSC_VERSION_LT(3, 12, 0)
347 CHKERR PetscObjectSetTabLevel((PetscObject)ctx->
kSP, 3);
◆ Aij
SmartPetscObj<Mat> PCArcLengthCtx::Aij |
◆ arcPtr
◆ arcPtrRaw
◆ kSP
SmartPetscObj<KSP> PCArcLengthCtx::kSP |
◆ pC
SmartPetscObj<PC> PCArcLengthCtx::pC |
◆ shellAij
SmartPetscObj<Mat> PCArcLengthCtx::shellAij |
The documentation for this struct was generated from the following files: