19 {
21 this->s = s;
22 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tSet s = %6.4e", this->s);
24}
25
31 "\tSet alpha = %6.4e beta = %6.4e",
32 this->alpha, this->beta);
34}
35
37 const std::string &problem_name,
39 : mField(m_field), dx2(0), F_lambda2(0), res_lambda(0) {
40
41 auto create_f_lambda = [&]() {
44 F_lambda);
45 CHKERR VecSetOption(F_lambda, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
47 };
48
49 auto vec_duplicate = [&]() {
56 };
57
58 auto zero_vectors = [&]() {
60 CHKERR VecZeroEntries(F_lambda);
62 CHKERR VecZeroEntries(xLambda);
66 };
67
68 auto find_lambda_dof = [&]() {
70
73 boost::shared_ptr<NumeredDofEntity_multiIndex> dofs_ptr_no_const =
76 auto dIt = dofs_ptr_no_const->get<
Unique_mi_tag>().lower_bound(
78 auto hi_dit = dofs_ptr_no_const->get<
Unique_mi_tag>().upper_bound(
80 if (std::distance(dIt, hi_dit) != 1)
82 ("can not find unique LAMBDA (load factor) but found " +
83 boost::lexical_cast<std::string>(std::distance(dIt, hi_dit)))
84 .c_str());
85 arcDofRawPtr = (*dIt).get();
87 };
88
89 auto create_ghost_vecs = [&]() {
91 Vec ghost_d_lambda, ghost_diag;
92 if ((unsigned int)mField.get_comm_rank() == arcDofRawPtr->getPart()) {
93 CHKERR VecCreateGhostWithArray(mField.get_comm(), 1, 1, 0, PETSC_NULLPTR,
94 &dLambda, &ghost_d_lambda);
95
96 CHKERR VecCreateGhostWithArray(mField.get_comm(), 1, 1, 0, PETSC_NULLPTR,
97 &dIag, &ghost_diag);
98 } else {
99 int one[] = {0};
100 CHKERR VecCreateGhostWithArray(mField.get_comm(), 0, 1, 1, one, &dLambda,
101 &ghost_d_lambda);
102 CHKERR VecCreateGhostWithArray(mField.get_comm(), 0, 1, 1, one, &dIag,
103 &ghost_diag);
104 }
105 dLambda = 0;
106 dIag = 0;
110 };
111
112 CHKERRABORT(PETSC_COMM_SELF, create_f_lambda());
113 CHKERRABORT(PETSC_COMM_SELF, vec_duplicate());
114 CHKERRABORT(PETSC_COMM_SELF, zero_vectors());
115 CHKERRABORT(PETSC_COMM_SELF, find_lambda_dof());
116 CHKERRABORT(PETSC_COMM_SELF, create_ghost_vecs());
117}
118
119
120
121
123 string problem_name)
124 : Aij(aij, true), problemName(problem_name), arcPtrRaw(arc_ptr_raw) {}
125
127 boost::shared_ptr<ArcLengthCtx> arc_ptr,
128 string problem_name)
129 : Aij(aij, true), problemName(problem_name), arcPtrRaw(arc_ptr.get()),
130 arcPtr(arc_ptr) {}
131
133 ScatterMode scattermode) {
135
138
139 switch (scattermode) {
140 case SCATTER_FORWARD: {
142 if (rank == part) {
144 PETSC_NULLPTR,
lambda, &lambda_ghost);
145 } else {
146 int one[] = {0};
149 }
151 if (part == rank) {
153 }
154 CHKERR VecGhostUpdateBegin(lambda_ghost, INSERT_VALUES, SCATTER_FORWARD);
155 CHKERR VecGhostUpdateEnd(lambda_ghost, INSERT_VALUES, SCATTER_FORWARD);
156 CHKERR VecDestroy(&lambda_ghost);
157 } break;
158 case SCATTER_REVERSE: {
160 PetscScalar *array;
161 CHKERR VecGetArray(ksp_x, &array);
163 CHKERR VecRestoreArray(ksp_x, &array);
164 }
165 } break;
166 default:
168 }
169
171}
172
175 void *void_ctx;
176 CHKERR MatShellGetContext(A, &void_ctx);
181 double db_dot_x;
183 double f_lambda;
188}
189
190
191
193 : shellAij(shell_Aij, true), Aij(aij, true), arcPtrRaw(arc_ptr) {
194 auto comm = PetscObjectComm((PetscObject)aij);
197 CHKERRABORT(PETSC_COMM_WORLD, KSPAppendOptionsPrefix(kSP, "arc_length_"));
198}
199
202 : pC(pc, true), shellAij(shell_Aij, true), Aij(aij, true),
203 arcPtrRaw(arc_ptr) {
204 auto comm = PetscObjectComm((PetscObject)aij);
206 CHKERRABORT(PETSC_COMM_WORLD, KSPAppendOptionsPrefix(kSP, "arc_length_"));
207}
208
210 boost::shared_ptr<ArcLengthCtx> arc_ptr)
211 : shellAij(shell_Aij, true), Aij(aij, true), arcPtrRaw(arc_ptr.get()),
212 arcPtr(arc_ptr) {
213 auto comm = PetscObjectComm((PetscObject)aij);
216 CHKERRABORT(PETSC_COMM_WORLD, KSPAppendOptionsPrefix(kSP, "arc_length_"));
217}
218
220 boost::shared_ptr<ArcLengthCtx> arc_ptr)
221 : pC(pc, true), shellAij(shell_Aij, true), Aij(aij, true),
222 arcPtrRaw(arc_ptr.get()), arcPtr(arc_ptr) {
223 auto comm = PetscObjectComm((PetscObject)aij);
225 CHKERRABORT(PETSC_COMM_WORLD, KSPAppendOptionsPrefix(kSP, "arc_length_"));
226}
227
230 void *void_ctx;
231 CHKERR PCShellGetContext(pc, &void_ctx);
233 void *void_MatCtx;
236 PetscBool same;
237 CHKERR PetscObjectTypeCompare((PetscObject)ctx->
kSP, KSPPREONLY, &same);
238
239 double res_lambda;
241
242
243 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_FALSE);
244 CHKERR KSPSetInitialGuessKnoll(ctx->
kSP, PETSC_FALSE);
246 double db_dot_pc_x;
248
249
250 if (same != PETSC_TRUE) {
251 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_TRUE);
252 } else {
253 CHKERR KSPSetInitialGuessNonzero(ctx->
kSP, PETSC_FALSE);
254 }
256 double db_dot_x_lambda;
258
259
261 double ddlambda = -(res_lambda - db_dot_pc_x) / denominator;
262
263
266
267 if (ddlambda != ddlambda || denominator == 0) {
268
269 double nrm2_pc_f, nrm2_db, nrm2_pc_x, nrm2_xLambda;
270 CHKERR VecNorm(pc_f, NORM_2, &nrm2_pc_f);
272 CHKERR VecNorm(pc_x, NORM_2, &nrm2_pc_x);
274
276 << "problem with ddlambda=" << ddlambda;
277 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"res_lambda=" << res_lambda;
278 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"denominator=" << denominator;
279 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"db_dot_pc_x=" << db_dot_pc_x;
281 << "db_dot_x_lambda=" << db_dot_x_lambda;
284 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"nrm2_db=" << nrm2_db;
285 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"nrm2_pc_f=" << nrm2_pc_f;
286 MOFEM_LOG(
"ARC_LENGTH", Sev::error) <<
"nrm2_pc_x=" << nrm2_pc_x;
288 << "nrm2_xLambda=" << nrm2_xLambda;
289
291 "Increment of lambda is not number");
292 }
293
294
295 if (0) {
297 CHKERR VecDuplicate(pc_x, &y);
299 CHKERR VecAXPY(y, -1, pc_f);
300 double res_lambda_y;
302 double zero;
304 double norm_y;
305 CHKERR VecNorm(y, NORM_2, &norm_y);
307 "Debug res y = %3.4e res_lambda_y = %3.4e", norm_y,
308 res_lambda_y);
310 }
311
313}
314
317 void *void_ctx;
318 CHKERR PCShellGetContext(pc, &void_ctx);
320 auto get_pc_ops = [&](auto pc) {
322 Mat shell_aij_raw, aij_raw;
323 CHKERR PCGetOperators(pc, &shell_aij_raw, &aij_raw);
327 };
329 CHKERR PCSetUseAmat(pc, PETSC_TRUE);
333#if PETSC_VERSION_LT(3, 12, 0)
335#else
336 CHKERR PetscObjectSetTabLevel((PetscObject)ctx->
kSP, 3);
337#endif
343}
344
345
346
347
349 : arcPtr(arc_ptr) {}
350
353 switch (snes_ctx) {
354 case CTX_SNESSETFUNCTION: {
355
356 auto zero_vals = [&](
auto v) {
358 int size = problemPtr->getNbLocalDofsRow();
359 int ghosts = problemPtr->getNbGhostDofsRow();
360 double *array;
362 for (
int i = 0;
i != size + ghosts; ++
i)
364 CHKERR VecRestoreArray(
v, &array);
366 };
367
368 Vec l_x_lambda, l_f_lambda;
369 CHKERR VecGhostGetLocalForm(
arcPtr->xLambda, &l_x_lambda);
370 CHKERR VecGhostGetLocalForm(
arcPtr->F_lambda, &l_f_lambda);
371 CHKERR zero_vals(l_x_lambda);
372 CHKERR zero_vals(l_f_lambda);
373 CHKERR VecGhostRestoreLocalForm(
arcPtr->xLambda, &l_x_lambda);
374 CHKERR VecGhostRestoreLocalForm(
arcPtr->F_lambda, &l_f_lambda);
375
376 } break;
377 default:
379 "Lambda can be zeroed ONLY when the right hand side is evaluated.");
380 }
382}
383
384#ifdef __DIRICHLET_HPP__
385
386AssembleFlambda::AssembleFlambda(boost::shared_ptr<ArcLengthCtx> arc_ptr,
387 boost::shared_ptr<DirichletDisplacementBc> bc)
388 : arcPtr(arc_ptr) {
389 bCs.push_back(bc);
390}
391
395}
399}
400
403 switch (snes_ctx) {
404 case CTX_SNESSETFUNCTION: {
405
406 CHKERR VecAssemblyBegin(arcPtr->F_lambda);
407 CHKERR VecAssemblyEnd(arcPtr->F_lambda);
408 CHKERR VecAssemblyBegin(snes_f);
409 CHKERR VecAssemblyEnd(snes_f);
410 CHKERR VecGhostUpdateBegin(arcPtr->F_lambda, ADD_VALUES, SCATTER_REVERSE);
411 CHKERR VecGhostUpdateEnd(arcPtr->F_lambda, ADD_VALUES, SCATTER_REVERSE);
412 CHKERR VecGhostUpdateBegin(snes_f, ADD_VALUES, SCATTER_REVERSE);
413 CHKERR VecGhostUpdateEnd(snes_f, ADD_VALUES, SCATTER_REVERSE);
414
415 auto set_bc = [&](auto l_snes_f, auto l_f_lambda) {
417 if (!bCs.empty()) {
418 double *f_array, *f_lambda_array;
419 CHKERR VecGetArray(l_snes_f, &f_array);
420 CHKERR VecGetArray(l_f_lambda, &f_lambda_array);
421 for (auto &bc : bCs) {
422 for (auto idx : bc->dofsIndices) {
423 auto weak_dof = problemPtr->getRowDofsByPetscGlobalDofIdx(idx);
424 if (auto shared_dof = weak_dof.lock()) {
425 f_array[shared_dof->getPetscLocalDofIdx()] = 0;
426 f_lambda_array[shared_dof->getPetscLocalDofIdx()] = 0;
427 }
428 }
429 }
430 CHKERR VecRestoreArray(l_snes_f, &f_array);
431 CHKERR VecRestoreArray(l_f_lambda, &f_lambda_array);
432 }
434 };
435
436 auto add_f_lambda = [&](auto l_snes_f, auto l_f_lambda) {
438 int size = problemPtr->getNbLocalDofsRow();
439 int ghosts = problemPtr->getNbGhostDofsRow();
440 double lambda = arcPtr->getFieldData();
441 int local_lambda_idx = arcPtr->getPetscLocalDofIdx();
442 double *f_array, *f_lambda_array;
443 CHKERR VecGetArray(l_snes_f, &f_array);
444 CHKERR VecGetArray(l_f_lambda, &f_lambda_array);
445 for (
int i = 0;
i != size; ++
i) {
446 f_array[
i] +=
lambda * f_lambda_array[
i];
447 }
448 CHKERR VecRestoreArray(l_snes_f, &f_array);
449 CHKERR VecRestoreArray(l_f_lambda, &f_lambda_array);
451 };
452
453 auto zero_ghost = [&](auto l_snes_f, auto l_f_lambda) {
455 int size = problemPtr->getNbLocalDofsRow();
456 int ghosts = problemPtr->getNbGhostDofsRow();
457 double lambda = arcPtr->getFieldData();
458 int local_lambda_idx = arcPtr->getPetscLocalDofIdx();
459 double *f_array, *f_lambda_array;
460 CHKERR VecGetArray(l_snes_f, &f_array);
461 CHKERR VecGetArray(l_f_lambda, &f_lambda_array);
462 f_lambda_array[local_lambda_idx] = 0;
463 for (
int i = size;
i != size + ghosts; ++
i) {
465 f_lambda_array[
i] = 0;
466 }
467 CHKERR VecRestoreArray(l_snes_f, &f_array);
468 CHKERR VecRestoreArray(l_f_lambda, &f_lambda_array);
470 };
471
472 Vec l_snes_f, l_f_lambda;
473 CHKERR VecGhostGetLocalForm(snes_f, &l_snes_f);
474 CHKERR VecGhostGetLocalForm(arcPtr->F_lambda, &l_f_lambda);
475 CHKERR add_f_lambda(l_snes_f, l_f_lambda);
476 CHKERR set_bc(l_snes_f, l_f_lambda);
477 CHKERR zero_ghost(l_snes_f, l_f_lambda);
478
479 CHKERR VecGhostRestoreLocalForm(snes_f, &l_snes_f);
480 CHKERR VecGhostRestoreLocalForm(arcPtr->F_lambda, &l_f_lambda);
481
482 double snes_fnorm, snes_xnorm;
483 CHKERR VecNorm(snes_f, NORM_2, &snes_fnorm);
484 CHKERR VecNorm(snes_x, NORM_2, &snes_xnorm);
485 CHKERR VecDot(arcPtr->F_lambda, arcPtr->F_lambda, &arcPtr->F_lambda2);
486
488 "\tF_lambda2 = %6.4g lambda = %6.4g", arcPtr->F_lambda2,
489 arcPtr->getFieldData());
491 "\tsnes_f norm = %6.4e snes_x norm = %6.4g", snes_fnorm,
492 snes_xnorm);
493
494 if (!boost::math::isfinite(snes_fnorm)) {
495 CHKERR arcPtr->mField.getInterface<
Tools>()->checkVectorForNotANumber(
496 problemPtr,
ROW, snes_f);
497 }
498
499 } break;
500 default:
501 SETERRQ(
503 "Lambda can be assembled only when the right hand side is evaluated.");
504
506 }
508}
509
510#endif
511
512
513
514
516 boost::shared_ptr<ArcLengthCtx> &arc_ptr, const bool assemble)
517 :
FEMethod(), arcPtr(arc_ptr), aSsemble(assemble) {}
518
520
523 switch (snes_ctx) {
524 case CTX_SNESSETFUNCTION: {
526 CHKERR VecAssemblyBegin(snes_f);
527 CHKERR VecAssemblyEnd(snes_f);
528 }
531 } break;
532 case CTX_SNESSETJACOBIAN: {
534 CHKERR MatAssemblyBegin(snes_B, MAT_FLUSH_ASSEMBLY);
535 CHKERR MatAssemblyEnd(snes_B, MAT_FLUSH_ASSEMBLY);
536 }
537 } break;
538 default:
539 break;
540 }
542}
543
546 switch (snes_ctx) {
547 case CTX_SNESSETFUNCTION: {
549 CHKERR VecSetValue(snes_f,
arcPtr->getPetscGlobalDofIdx(),
550 arcPtr->res_lambda, ADD_VALUES);
551 } break;
552 case CTX_SNESSETJACOBIAN: {
554 CHKERR MatSetValue(snes_B,
arcPtr->getPetscGlobalDofIdx(),
555 arcPtr->getPetscGlobalDofIdx(), 1, ADD_VALUES);
556 } break;
557 default:
558 break;
559 }
561}
562
565 switch (snes_ctx) {
566 case CTX_SNESSETFUNCTION: {
568 CHKERR VecAssemblyBegin(snes_f);
569 CHKERR VecAssemblyEnd(snes_f);
570 }
571 } break;
572 case CTX_SNESSETJACOBIAN: {
574 CHKERR MatAssemblyBegin(snes_B, MAT_FLUSH_ASSEMBLY);
575 CHKERR MatAssemblyEnd(snes_B, MAT_FLUSH_ASSEMBLY);
576 }
577 CHKERR VecGhostUpdateBegin(
arcPtr->ghostDiag, INSERT_VALUES,
578 SCATTER_FORWARD);
579 CHKERR VecGhostUpdateEnd(
arcPtr->ghostDiag, INSERT_VALUES, SCATTER_FORWARD);
580 } break;
581 default:
582 break;
583 }
585}
586
589}
590
594 CHKERR VecGhostUpdateBegin(
arcPtr->db, INSERT_VALUES, SCATTER_FORWARD);
595 CHKERR VecGhostUpdateEnd(
arcPtr->db, INSERT_VALUES, SCATTER_FORWARD);
597}
598
601
602 CHKERR VecGhostUpdateBegin(
arcPtr->x0, INSERT_VALUES, SCATTER_FORWARD);
603 CHKERR VecGhostUpdateEnd(
arcPtr->x0, INSERT_VALUES, SCATTER_FORWARD);
604
606 CHKERR VecGhostGetLocalForm(x, &l_x);
609 {
610 double *x_array, *x0_array, *dx_array;
611 CHKERR VecGetArray(l_x, &x_array);
612 CHKERR VecGetArray(l_x0, &x0_array);
613 CHKERR VecGetArray(l_dx, &dx_array);
614 int size =
615 problemPtr->getNbLocalDofsRow() + problemPtr->getNbGhostDofsRow();
616 for (
int i = 0;
i != size; ++
i) {
617 dx_array[
i] = x_array[
i] - x0_array[
i];
618 }
619 CHKERR VecRestoreArray(l_x, &x_array);
620 CHKERR VecRestoreArray(l_x0, &x0_array);
621 CHKERR VecRestoreArray(l_dx, &dx_array);
622 }
623 CHKERR VecGhostRestoreLocalForm(x, &l_x);
626
627
628 if (
arcPtr->getPetscLocalDofIdx() != -1) {
629 double *array;
632 array[
arcPtr->getPetscLocalDofIdx()] = 0;
634 }
635 CHKERR VecGhostUpdateBegin(
arcPtr->ghosTdLambda, INSERT_VALUES,
636 SCATTER_FORWARD);
637 CHKERR VecGhostUpdateEnd(
arcPtr->ghosTdLambda, INSERT_VALUES,
638 SCATTER_FORWARD);
639
640
641 double x_nrm, x0_nrm;
642 CHKERR VecNorm(x, NORM_2, &x_nrm);
645
647 "\tx norm = %6.4e x0 norm = %6.4e dx2 = %6.4e", x_nrm, x0_nrm,
650}
651
652
653
654
656 :
FEMethod(), arcPtrRaw(arc_ptr_raw) {}
657
659 boost::shared_ptr<ArcLengthCtx> &arc_ptr)
660 :
FEMethod(), arcPtrRaw(arc_ptr.get()), arcPtr(arc_ptr) {}
661
663
666 switch (snes_ctx) {
667 case CTX_SNESSETFUNCTION: {
670 } break;
671 case CTX_SNESSETJACOBIAN: {
672 } break;
673 default:
674 break;
675 }
677}
678
683}
684
690}
691
694 switch (snes_ctx) {
695 case CTX_SNESSETFUNCTION: {
699 MOFEM_LOG_C(
"ARC_LENGTH", Sev::verbose,
"\tres_lambda = %6.4e",
701 } break;
702 case CTX_SNESSETJACOBIAN: {
707 } break;
708 default:
709 break;
710 }
712}
713
716 switch (snes_ctx) {
717 case CTX_SNESSETFUNCTION: {
718 MOFEM_LOG_C(
"ARC_LENGTH", Sev::verbose,
"\tlambda = %6.4e",
720 } break;
721 case CTX_SNESSETJACOBIAN: {
723 SCATTER_FORWARD);
725 SCATTER_FORWARD);
726 CHKERR MatAssemblyBegin(snes_B, MAT_FLUSH_ASSEMBLY);
727 CHKERR MatAssemblyEnd(snes_B, MAT_FLUSH_ASSEMBLY);
728 MOFEM_LOG_C(
"ARC_LENGTH", Sev::verbose,
"\tdiag = %6.4e",
730 } break;
731 default:
732 break;
733 }
735}
736
739
744
746 double *array;
751 }
753 SCATTER_FORWARD);
755 SCATTER_FORWARD);
756
762}
763
769 if (!(*dlambda == *dlambda)) {
774 "Increment of lambda is not a number");
775 }
777}
778
781
782
784 double *array;
785 CHKERR VecGetArray(x, &array);
787 if (!(dlambda == dlambda)) {
792 "Increment of lambda is not a number");
793 }
796 "\tlambda = %6.4e, %6.4e (%6.4e)", lambda_old,
798 CHKERR VecRestoreArray(x, &array);
799 }
801}
#define MOFEM_LOG_C(channel, severity, format,...)
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
auto createKSP(MPI_Comm comm)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
auto createPC(MPI_Comm comm)
constexpr auto field_name
Store variables for ArcLength analysis.
double s
arc length radius
SmartPetscObj< Vec > xLambda
solution of eq. K*xLambda = F_lambda
double res_lambda
f_lambda - s
DofIdx getPetscLocalDofIdx()
Get local index of load factor.
MoFEMErrorCode setAlphaBeta(double alpha, double beta)
set parameters controlling arc-length equations alpha controls off diagonal therms beta controls diag...
ArcLengthCtx(MoFEM::Interface &m_field, const std::string &problem_name, const std::string &field_name="LAMBDA")
double alpha
displacement scaling factor
double F_lambda2
inner_prod(F_lambda,F_lambda);
SmartPetscObj< Vec > dx
dx = x-x0
double dIag
diagonal value
double dx2
inner_prod(dX,dX)
FieldData & getFieldData()
Get value of load factor.
MoFEM::Interface & mField
SmartPetscObj< Vec > F_lambda
F_lambda reference load vector.
SmartPetscObj< Vec > ghostDiag
SmartPetscObj< Vec > ghosTdLambda
double dLambda
increment of load factor
double beta
force scaling factor
int getPart()
Get proc owning lambda dof.
SmartPetscObj< Vec > db
db derivative of f(dx*dx), i.e. db = d[ f(dx*dx) ]/dx
DofIdx getPetscGlobalDofIdx()
Get global index of load factor.
SmartPetscObj< Vec > x0
displacement vector at beginning of step
shell matrix for arc-length method
ArcLengthMatShell(Mat aij, boost::shared_ptr< ArcLengthCtx > arc_ptr, string problem_name)
MoFEMErrorCode setLambda(Vec ksp_x, double *lambda, ScatterMode scattermode)
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
Structure for user loop methods on finite elements.
static UId getHiBitNumberUId(const FieldBitNumber bit_number)
static UId getLoBitNumberUId(const FieldBitNumber bit_number)
keeps basic data about problem
auto & getNumeredRowDofsPtr() const
get access to numeredRowDofsPtr storing DOFs on rows
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.
structure for Arc Length pre-conditioner
SmartPetscObj< Mat > shellAij
PCArcLengthCtx(Mat shell_Aij, Mat aij, boost::shared_ptr< ArcLengthCtx > arc_ptr)
MoFEMErrorCode preProcess()
MoFEMErrorCode calculateDb()
Calculate db.
MoFEMErrorCode operator()()
SimpleArcLengthControl(boost::shared_ptr< ArcLengthCtx > &arc_ptr, const bool assemble=false)
double calculateLambdaInt()
Calculate internal lambda.
MoFEMErrorCode calculateDxAndDlambda(Vec x)
MoFEMErrorCode postProcess()
boost::shared_ptr< ArcLengthCtx > arcPtr
~SimpleArcLengthControl()
MoFEMErrorCode postProcess()
virtual MoFEMErrorCode calculateDxAndDlambda(Vec x)
MoFEMErrorCode preProcess()
MoFEMErrorCode operator()()
virtual ~SphericalArcLengthControl()
virtual MoFEMErrorCode calculateDb()
Calculate db.
DEPRECATED SphericalArcLengthControl(ArcLengthCtx *arc_ptr_raw)
virtual double calculateLambdaInt()
Calculate f_lambda(dx,lambda)
virtual MoFEMErrorCode calculateInitDlambda(double *dlambda)
virtual MoFEMErrorCode setDlambdaToX(Vec x, double dlambda)
ZeroFLmabda(boost::shared_ptr< ArcLengthCtx > arc_ptr)
MoFEMErrorCode preProcess()
boost::shared_ptr< ArcLengthCtx > arcPtr