https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
MultiPlasticityLinearSystem Class Reference

MultiPlasticityLinearSystem computes the linear system and handles linear-dependence removal for use in FiniteStrainMultiPlasticity. More...

#include <MultiPlasticityLinearSystem.h>

Inheritance diagram for MultiPlasticityLinearSystem:
[legend]

Public Member Functions

 MultiPlasticityLinearSystem (const MooseObject *moose_object)
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const TgetUserObject (const std::string &param_name, bool is_dependency=true) const
 
const TgetUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void calculateConstraints (const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankTwoTensor &delta_dp, std::vector< Real > &f, std::vector< RankTwoTensor > &r, RankTwoTensor &epp, std::vector< Real > &ic, const std::vector< bool > &active)
 The constraints.
 
virtual void calculateRHS (const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankTwoTensor &delta_dp, std::vector< Real > &rhs, const std::vector< bool > &active, bool eliminate_ld, std::vector< bool > &deactivated_due_to_ld)
 Calculate the RHS which is rhs = -(epp(0,0), epp(1,0), epp(1,1), epp(2,0), epp(2,1), epp(2,2), f[0], f[1], ..., f[num_f], ic[0], ic[1], ..., ic[num_ic])
 
virtual void calculateJacobian (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankFourTensor &E_inv, const std::vector< bool > &active, const std::vector< bool > &deactivated_due_to_ld, std::vector< std::vector< Real > > &jac)
 d(rhs)/d(dof)
 
virtual void nrStep (const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankFourTensor &E_inv, const RankTwoTensor &delta_dp, RankTwoTensor &dstress, std::vector< Real > &dpm, std::vector< Real > &dintnl, const std::vector< bool > &active, std::vector< bool > &deactivated_due_to_ld)
 Performs one Newton-Raphson step.
 
virtual void yieldFunction (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &f)
 The active yield function(s)
 
virtual void dyieldFunction_dstress (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &df_dstress)
 The derivative of the active yield function(s) with respect to stress.
 
virtual void dyieldFunction_dintnl (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &df_dintnl)
 The derivative of active yield function(s) with respect to their internal parameters (the user objects assume there is exactly one internal param per yield function)
 
virtual void flowPotential (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &r)
 The active flow potential(s) - one for each yield function.
 
virtual void dflowPotential_dstress (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankFourTensor > &dr_dstress)
 The derivative of the active flow potential(s) with respect to stress.
 
virtual void dflowPotential_dintnl (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &dr_dintnl)
 The derivative of the active flow potentials with respect to the active internal parameters The UserObjects explicitly assume that r[alpha] is only dependent on intnl[alpha].
 
virtual void hardPotential (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &h)
 The active hardening potentials (one for each internal parameter and for each yield function) by assumption in the Userobjects, the h[a][alpha] is nonzero only if the surface alpha is part of model a, so we only calculate those here.
 
virtual void dhardPotential_dstress (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &dh_dstress)
 The derivative of the active hardening potentials with respect to stress By assumption in the Userobjects, the h[a][alpha] is nonzero only for a = alpha, so we only calculate those here.
 
virtual void dhardPotential_dintnl (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &dh_dintnl)
 The derivative of the active hardening potentials with respect to the active internal parameters.
 
virtual void buildActiveConstraints (const std::vector< Real > &f, const RankTwoTensor &stress, const std::vector< Real > &intnl, const RankFourTensor &Eijkl, std::vector< bool > &act)
 Constructs a set of active constraints, given the yield functions, f.
 
unsigned int modelNumber (unsigned int surface)
 returns the model number, given the surface number
 
bool anyActiveSurfaces (int model, const std::vector< bool > &active)
 returns true if any internal surfaces of the given model are active according to 'active'
 
void activeModelSurfaces (int model, const std::vector< bool > &active, std::vector< unsigned int > &active_surfaces_of_model)
 Returns the internal surface number(s) of the active surfaces of the given model This may be of size=0 if there are no active surfaces of the given model.
 
void activeSurfaces (int model, const std::vector< bool > &active, std::vector< unsigned int > &active_surfaces)
 Returns the external surface number(s) of the active surfaces of the given model This may be of size=0 if there are no active surfaces of the given model.
 
bool returnMapAll (const RankTwoTensor &trial_stress, const std::vector< Real > &intnl_old, const RankFourTensor &E_ijkl, Real ep_plastic_tolerance, RankTwoTensor &stress, std::vector< Real > &intnl, std::vector< Real > &pm, std::vector< Real > &cumulative_pm, RankTwoTensor &delta_dp, std::vector< Real > &yf, unsigned &num_successful_plastic_returns, unsigned &custom_model)
 Performs a returnMap for each plastic model using their inbuilt returnMap functions.
 
virtual void addUserObjectDependencyHelper (const UserObjectBase &) const
 

Protected Attributes

Real _svd_tol
 Tolerance on the minimum ratio of singular values before flow-directions are deemed linearly dependent.
 
Real _min_f_tol
 Minimum value of the _f_tol parameters for the Yield Function User Objects.
 
const InputParameters_params
 
unsigned int _num_models
 Number of plastic models for this material.
 
unsigned int _num_surfaces
 Number of surfaces within the plastic models.
 
std::vector< std::vector< unsigned int > > _surfaces_given_model
 _surfaces_given_model[model_number] = vector of surface numbers for this model
 
MooseEnum _specialIC
 Allows initial set of active constraints to be chosen optimally.
 
std::vector< const SolidMechanicsPlasticModel * > _f
 User objects that define the yield functions, flow potentials, etc.
 

Private Member Functions

virtual int singularValuesOfR (const std::vector< RankTwoTensor > &r, std::vector< Real > &s)
 Performs a singular-value decomposition of r and returns the singular values.
 
virtual void eliminateLinearDependence (const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< Real > &f, const std::vector< RankTwoTensor > &r, const std::vector< bool > &active, std::vector< bool > &deactivated_due_to_ld)
 Performs a number of singular-value decompositions to check for linear-dependence of the active directions "r" If linear dependence is found, then deactivated_due_to_ld will contain 'true' entries where surfaces need to be deactivated_due_to_ld.
 
void buildActiveConstraintsRock (const std::vector< Real > &f, const RankTwoTensor &stress, const std::vector< Real > &intnl, const RankFourTensor &Eijkl, std::vector< bool > &act)
 "Rock" version Constructs a set of active constraints, given the yield functions, f.
 
void buildActiveConstraintsJoint (const std::vector< Real > &f, const RankTwoTensor &stress, const std::vector< Real > &intnl, const RankFourTensor &Eijkl, std::vector< bool > &act)
 "Joint" version Constructs a set of active constraints, given the yield functions, f.
 
const UserObjectBasegetUserObjectFromFEProblem (const UserObjectName &object_name, const THREAD_ID tid=0) const
 
const TcastUserObject (const UserObjectBase &uo_base, const std::string &param_name="") const
 
void mooseObjectError (const std::string &param_name, std::stringstream &oss) const
 
const std::string & userObjectType (const UserObjectBase &uo) const
 
const std::string & userObjectName (const UserObjectBase &uo) const
 

Private Attributes

std::vector< unsigned int_model_given_surface
 given a surface number, this returns the model number
 
std::vector< unsigned int_model_surface_given_surface
 given a surface number, this returns the corresponding-model's internal surface number
 
const MooseObject_uoi_moose_object
 
const FEProblemBase_uoi_feproblem
 
const THREAD_ID _uoi_tid
 

Detailed Description

MultiPlasticityLinearSystem computes the linear system and handles linear-dependence removal for use in FiniteStrainMultiPlasticity.

Note that if run in debug mode you might have to use the –no-trap-fpe flag because PETSc-LAPACK-BLAS explicitly compute 0/0 and 1/0, and this causes Libmesh to trap the floating-point exceptions

These routines are quite complicated, so here is an extended explanation.

SURFACES AND MODELS

Each plasticity model can have multiple surfaces (eg, Mohr-Coulomb has 6 surfaces), and one internal parameter. This is also described in MultiPlasticityRawComponentAssembler. The

VARIABLE NAMES

_num_surfaces = total number of surfaces _num_models = total number of plasticity models pm = plasticity multiplier. pm.size() = _num_surfaces intnl = internal variable. intnl.size() = _num_models

DEGREES OF FREEDOM

The degrees of freedom are: the 6 components of stress (it is assumed to be symmetric) the plasticity multipliers, pm. the internal parameters, intnl.

Note that in any single Newton-Raphson (NR) iteration, the number of pm and intnl may be different from any other NR iteration. This is because of deactivating surfaces because they are deemed unimportant by the calling program (eg, their yield function is < 0), or because their flow direction is linearly dependent on other surfaces. Therefore:

Hence, more exactly, the degrees of freedom, whose changes will be provided in the NR step are: the 6 components of stress (it is assumed to be symmetric) the plasticity multipliers, pm, belonging to linearly independent surfaces the internal parameters, intnl, belonging to models with at least one linearly-independent surface

THE CONSTRAINTS AND RHS

The variables calculated by calculateConstraints and calculateRHS are: epp = pm*r - E_inv*(trial_stress - stress) = pm*r - delta_dp f = yield function [all the active constraints, including the deactivated_due_to_ld. The latter ones will not be put into the linear system] ic = intnl - intnl_old + pm*h [only for models that contain active surfaces]

Here pm*r = sum_{active_alpha} pm[alpha]*r[alpha]. Note that this contains all the "active" surfaces, even the ones that have been deactivated_due_to_ld. in calculateConstraints, etc, r is a std::vector containing only all the active flow directions (including deactivated_due_to_ld, but not the "not active"). f = all the "active" surfaces, even the ones that have been deactivated_due_to_ld. However, the latter are not put into the RHS pm*h = sum_{active_alpha} pm[alpha]*h[alpha]. Note that this only contains the "active" hardening potentials, even the ones that have been deactivated_due_to_ld. In calculateConstraints, calculateRHS and calculateJacobian, h is a std::vector containing only these "active" ones. Hence, the sum_{active_alpha} contains deactivated_due_to_ld contributions. HOWEVER, if all the surfaces belonging to a model are either "not active" or deactivated_due_to_ld, then this ic is not included in the RHS

The RHS is rhs = -(epp(0,0), epp(1,0), epp(1,1), epp(2,0), epp(2,1), epp(2,2), f[0], f[1], ..., f[_num_active_f], ic[0], ic[1], ..., ic[num_active_ic]) Notice the appearance of only the i>=j "epp" components.

THE JACOBIAN

This is d(-rhs)/d(dof). Remember that the dofs are dependent on what is deactivated_due_to_ld, as specified above. In matrix form, the Jacobian is: ( depp_dstress depp_dpm depp_dintnl ) ( df_dstress 0 df_dintnl ) ( dic_dstress dic_dpm dic_dintnl ) For the "epp" terms, only the i>=j components are kept in the RHS, so only these terms are kept here too

Definition at line 119 of file MultiPlasticityLinearSystem.h.

Constructor & Destructor Documentation

◆ MultiPlasticityLinearSystem()

MultiPlasticityLinearSystem::MultiPlasticityLinearSystem ( const MooseObject moose_object)

Definition at line 32 of file MultiPlasticityLinearSystem.C.

34 _svd_tol(_params.get<Real>("linear_dependent")),
35 _min_f_tol(-1.0)
36{
37 for (unsigned model = 0; model < _num_models; ++model)
38 if (_min_f_tol == -1.0 || _min_f_tol > _f[model]->_f_tol)
39 _min_f_tol = _f[model]->_f_tol;
40
42}
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
void seed(std::size_t i, unsigned int seed)
Real _svd_tol
Tolerance on the minimum ratio of singular values before flow-directions are deemed linearly dependen...
Real _min_f_tol
Minimum value of the _f_tol parameters for the Yield Function User Objects.
MultiPlasticityRawComponentAssembler holds and computes yield functions, flow directions,...
std::vector< const SolidMechanicsPlasticModel * > _f
User objects that define the yield functions, flow potentials, etc.
unsigned int _num_models
Number of plastic models for this material.

Member Function Documentation

◆ activeModelSurfaces()

void MultiPlasticityRawComponentAssembler::activeModelSurfaces ( int  model,
const std::vector< bool > &  active,
std::vector< unsigned int > &  active_surfaces_of_model 
)
protectedinherited

Returns the internal surface number(s) of the active surfaces of the given model This may be of size=0 if there are no active surfaces of the given model.

Parameters
modelthe model number
activearray with entries being 'true' if the surface is active
[out]active_surfaces_of_modelthe output

Definition at line 809 of file MultiPlasticityRawComponentAssembler.C.

813{
814 active_surfaces_of_model.resize(0);
815 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
816 if (active[_surfaces_given_model[model][model_surface]])
817 active_surfaces_of_model.push_back(model_surface);
818}
std::vector< std::vector< unsigned int > > _surfaces_given_model
_surfaces_given_model[model_number] = vector of surface numbers for this model

Referenced by MultiPlasticityRawComponentAssembler::dflowPotential_dintnl(), MultiPlasticityRawComponentAssembler::dflowPotential_dstress(), MultiPlasticityRawComponentAssembler::dhardPotential_dintnl(), MultiPlasticityRawComponentAssembler::dhardPotential_dstress(), MultiPlasticityRawComponentAssembler::dyieldFunction_dintnl(), MultiPlasticityRawComponentAssembler::dyieldFunction_dstress(), MultiPlasticityRawComponentAssembler::flowPotential(), MultiPlasticityRawComponentAssembler::hardPotential(), and MultiPlasticityRawComponentAssembler::yieldFunction().

◆ activeSurfaces()

void MultiPlasticityRawComponentAssembler::activeSurfaces ( int  model,
const std::vector< bool > &  active,
std::vector< unsigned int > &  active_surfaces 
)
protectedinherited

Returns the external surface number(s) of the active surfaces of the given model This may be of size=0 if there are no active surfaces of the given model.

Parameters
modelthe model number
activearray with entries being 'true' if the surface is active
[out]active_surfacesthe output

Definition at line 798 of file MultiPlasticityRawComponentAssembler.C.

801{
802 active_surfaces.resize(0);
803 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
804 if (active[_surfaces_given_model[model][model_surface]])
805 active_surfaces.push_back(_surfaces_given_model[model][model_surface]);
806}

Referenced by calculateConstraints().

◆ anyActiveSurfaces()

bool MultiPlasticityRawComponentAssembler::anyActiveSurfaces ( int  model,
const std::vector< bool > &  active 
)
protectedinherited

returns true if any internal surfaces of the given model are active according to 'active'

Definition at line 789 of file MultiPlasticityRawComponentAssembler.C.

790{
791 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
792 if (active[_surfaces_given_model[model][model_surface]])
793 return true;
794 return false;
795}

Referenced by calculateJacobian(), calculateRHS(), MultiPlasticityDebugger::checkSolution(), MultiPlasticityDebugger::dof_included(), nrStep(), and ComputeMultiPlasticityStress::residual2().

◆ buildActiveConstraints()

void MultiPlasticityRawComponentAssembler::buildActiveConstraints ( const std::vector< Real > &  f,
const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const RankFourTensor Eijkl,
std::vector< bool > &  act 
)
protectedvirtualinherited

Constructs a set of active constraints, given the yield functions, f.

This uses SolidMechanicsPlasticModel::activeConstraints to identify the active constraints for each model.

Parameters
fyield functions (should be _num_surfaces of these)
stressstress tensor
intnlinternal parameters
Eijklelasticity tensor (stress = Eijkl*strain)
[out]actthe set of active constraints (will be resized to _num_surfaces)

Definition at line 342 of file MultiPlasticityRawComponentAssembler.C.

347{
348 mooseAssert(f.size() == _num_surfaces,
349 "buildActiveConstraints called with f.size = " << f.size() << " while there are "
350 << _num_surfaces << " surfaces");
351 mooseAssert(intnl.size() == _num_models,
352 "buildActiveConstraints called with intnl.size = "
353 << intnl.size() << " while there are " << _num_models << " models");
354
355 if (_specialIC == "rock")
356 buildActiveConstraintsRock(f, stress, intnl, Eijkl, act);
357 else if (_specialIC == "joint")
358 buildActiveConstraintsJoint(f, stress, intnl, Eijkl, act);
359 else // no specialIC
360 {
361 act.resize(0);
362 unsigned ind = 0;
363 for (unsigned model = 0; model < _num_models; ++model)
364 {
365 std::vector<Real> model_f(0);
366 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
367 model_f.push_back(f[ind++]);
368 std::vector<bool> model_act;
369 RankTwoTensor returned_stress;
370 _f[model]->activeConstraints(
371 model_f, stress, intnl[model], Eijkl, model_act, returned_stress);
372 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
373 act.push_back(model_act[model_surface]);
374 }
375 }
376}
Real f(Real x)
Test function for Brents method.
unsigned int _num_surfaces
Number of surfaces within the plastic models.
void buildActiveConstraintsRock(const std::vector< Real > &f, const RankTwoTensor &stress, const std::vector< Real > &intnl, const RankFourTensor &Eijkl, std::vector< bool > &act)
"Rock" version Constructs a set of active constraints, given the yield functions, f.
void buildActiveConstraintsJoint(const std::vector< Real > &f, const RankTwoTensor &stress, const std::vector< Real > &intnl, const RankFourTensor &Eijkl, std::vector< bool > &act)
"Joint" version Constructs a set of active constraints, given the yield functions,...
MooseEnum _specialIC
Allows initial set of active constraints to be chosen optimally.

Referenced by ComputeMultiPlasticityStress::returnMap().

◆ buildActiveConstraintsJoint()

void MultiPlasticityRawComponentAssembler::buildActiveConstraintsJoint ( const std::vector< Real > &  f,
const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const RankFourTensor Eijkl,
std::vector< bool > &  act 
)
privateinherited

"Joint" version Constructs a set of active constraints, given the yield functions, f.

This uses SolidMechanicsPlasticModel::activeConstraints to identify the active constraints for each model.

Parameters
fyield functions (should be _num_surfaces of these)
stressstress tensor
intnlinternal parameters
Eijklelasticity tensor (stress = Eijkl*strain)
[out]actthe set of active constraints (will be resized to _num_surfaces)

Definition at line 379 of file MultiPlasticityRawComponentAssembler.C.

384{
385 act.assign(2, false);
386
387 RankTwoTensor returned_stress;
388 std::vector<bool> active_tensile;
389 std::vector<bool> active_shear;
390 std::vector<Real> f_single;
391
392 // first try tensile alone
393 f_single.assign(1, 0);
394 f_single[0] = f[0];
395 _f[0]->activeConstraints(f_single, stress, intnl[0], Eijkl, active_tensile, returned_stress);
396 _f[1]->yieldFunctionV(returned_stress, intnl[1], f_single);
397 if (f_single[0] <= _f[1]->_f_tol)
398 {
399 act[0] = active_tensile[0];
400 return;
401 }
402
403 // next try shear alone
404 f_single.assign(1, 0);
405 f_single[0] = f[1];
406 _f[1]->activeConstraints(f_single, stress, intnl[1], Eijkl, active_shear, returned_stress);
407 _f[0]->yieldFunctionV(returned_stress, intnl[0], f_single);
408 if (f_single[0] <= _f[0]->_f_tol)
409 {
410 act[1] = active_shear[0];
411 return;
412 }
413
414 // must be mixed
415 act[0] = act[1] = true;
416 return;
417}

Referenced by MultiPlasticityRawComponentAssembler::buildActiveConstraints().

◆ buildActiveConstraintsRock()

void MultiPlasticityRawComponentAssembler::buildActiveConstraintsRock ( const std::vector< Real > &  f,
const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const RankFourTensor Eijkl,
std::vector< bool > &  act 
)
privateinherited

"Rock" version Constructs a set of active constraints, given the yield functions, f.

This uses SolidMechanicsPlasticModel::activeConstraints to identify the active constraints for each model.

Parameters
fyield functions (should be _num_surfaces of these)
stressstress tensor
intnlinternal parameters
Eijklelasticity tensor (stress = Eijkl*strain)
[out]actthe set of active constraints (will be resized to _num_surfaces)

Definition at line 420 of file MultiPlasticityRawComponentAssembler.C.

425{
426 act.assign(9, false);
427
428 RankTwoTensor returned_stress;
429 std::vector<bool> active_tensile;
430 std::vector<bool> active_MC;
431 std::vector<Real> f_single;
432
433 // first try tensile alone
434 f_single.assign(3, 0);
435 f_single[0] = f[0];
436 f_single[1] = f[1];
437 f_single[2] = f[2];
438 _f[0]->activeConstraints(f_single, stress, intnl[0], Eijkl, active_tensile, returned_stress);
439 _f[1]->yieldFunctionV(returned_stress, intnl[1], f_single);
440 if (f_single[0] <= _f[1]->_f_tol && f_single[1] <= _f[1]->_f_tol &&
441 f_single[2] <= _f[1]->_f_tol && f_single[3] <= _f[1]->_f_tol &&
442 f_single[4] <= _f[1]->_f_tol && f_single[5] <= _f[1]->_f_tol)
443 {
444 act[0] = active_tensile[0];
445 act[1] = active_tensile[1];
446 act[2] = active_tensile[2];
447 return;
448 }
449
450 // next try MC alone
451 f_single.assign(6, 0);
452 f_single[0] = f[3];
453 f_single[1] = f[4];
454 f_single[2] = f[5];
455 f_single[3] = f[6];
456 f_single[4] = f[7];
457 f_single[5] = f[8];
458 _f[1]->activeConstraints(f_single, stress, intnl[1], Eijkl, active_MC, returned_stress);
459 _f[0]->yieldFunctionV(returned_stress, intnl[0], f_single);
460 if (f_single[0] <= _f[0]->_f_tol && f_single[1] <= _f[0]->_f_tol && f_single[2] <= _f[0]->_f_tol)
461 {
462 act[3] = active_MC[0];
463 act[4] = active_MC[1];
464 act[5] = active_MC[2];
465 act[6] = active_MC[3];
466 act[7] = active_MC[4];
467 act[8] = active_MC[5];
468 return;
469 }
470
471 // must be a mix.
472 // The possibilities are enumerated below.
473
474 // tensile=edge, MC=tip (two possibilities)
475 if (active_tensile[0] == false && active_tensile[1] == true && active_tensile[2] == true &&
476 active_MC[0] == true && active_MC[1] == true && active_MC[2] == false &&
477 active_MC[3] == true && active_MC[4] == false && active_MC[5] == false)
478 {
479 act[1] = act[2] = act[6] = true;
480 act[4] = true;
481 return;
482 }
483 if (active_tensile[0] == false && active_tensile[1] == true && active_tensile[2] == true &&
484 active_MC[0] == false && active_MC[1] == true && active_MC[2] == false &&
485 active_MC[3] == true && active_MC[4] == false && active_MC[5] == true)
486 {
487 act[1] = act[2] = act[6] = true; // i don't think act[4] is necessary, is it?!
488 return;
489 }
490
491 // tensile = edge, MC=edge (two possibilities)
492 if (active_tensile[0] == false && active_tensile[1] == true && active_tensile[2] == true &&
493 active_MC[0] == false && active_MC[1] == true && active_MC[2] == false &&
494 active_MC[3] == true && active_MC[4] == false && active_MC[5] == false)
495 {
496 act[1] = act[2] = act[4] = act[6] = true;
497 return;
498 }
499 if (active_tensile[0] == false && active_tensile[1] == true && active_tensile[2] == true &&
500 active_MC[0] == false && active_MC[1] == false && active_MC[2] == false &&
501 active_MC[3] == true && active_MC[4] == false && active_MC[5] == true)
502 {
503 act[1] = act[2] = act[4] = act[6] = true;
504 return;
505 }
506
507 // tensile = edge, MC=face
508 if (active_tensile[0] == false && active_tensile[1] == true && active_tensile[2] == true &&
509 active_MC[0] == false && active_MC[1] == false && active_MC[2] == false &&
510 active_MC[3] == true && active_MC[4] == false && active_MC[5] == false)
511 {
512 act[1] = act[2] = act[6] = true;
513 return;
514 }
515
516 // tensile = face, MC=tip (two possibilities)
517 if (active_tensile[0] == false && active_tensile[1] == false && active_tensile[2] == true &&
518 active_MC[0] == true && active_MC[1] == true && active_MC[2] == false &&
519 active_MC[3] == true && active_MC[4] == false && active_MC[5] == false)
520 {
521 act[2] = act[6] = true;
522 act[4] = true;
523 act[8] = true;
524 return;
525 }
526 if (active_tensile[0] == false && active_tensile[1] == false && active_tensile[2] == true &&
527 active_MC[0] == false && active_MC[1] == true && active_MC[2] == false &&
528 active_MC[3] == true && active_MC[4] == false && active_MC[5] == true)
529 {
530 act[2] = act[6] = true;
531 act[8] = true;
532 return;
533 }
534
535 // tensile = face, MC=face
536 if (active_tensile[0] == false && active_tensile[1] == false && active_tensile[2] == true &&
537 active_MC[0] == false && active_MC[1] == false && active_MC[2] == false &&
538 active_MC[3] == true && active_MC[4] == false && active_MC[5] == false)
539 {
540 act[1] = act[2] = act[6] = true;
541 return;
542 }
543
544 // tensile = face, MC=edge (two possibilites).
545 act[2] = true; // tensile face
546 act[3] = active_MC[0];
547 act[4] = active_MC[1];
548 act[5] = active_MC[2];
549 act[6] = active_MC[3];
550 act[7] = active_MC[4];
551 act[8] = active_MC[5];
552 return;
553}

Referenced by MultiPlasticityRawComponentAssembler::buildActiveConstraints().

◆ calculateConstraints()

void MultiPlasticityLinearSystem::calculateConstraints ( const RankTwoTensor stress,
const std::vector< Real > &  intnl_old,
const std::vector< Real > &  intnl,
const std::vector< Real > &  pm,
const RankTwoTensor delta_dp,
std::vector< Real > &  f,
std::vector< RankTwoTensor > &  r,
RankTwoTensor epp,
std::vector< Real > &  ic,
const std::vector< bool > &  active 
)
protectedvirtual

The constraints.

These are set to zero (or <=0 in the case of the yield functions) by the Newton-Raphson process, except in the case of linear-dependence which complicates things.

Parameters
stressThe stress
intnl_oldold values of the internal parameters
intnlinternal parameters
pmCurrent value(s) of the plasticity multiplier(s) (consistency parameters)
delta_dpChange in plastic strain incurred so far during the return
[out]fActive yield function(s)
[out]rActive flow directions
[out]eppPlastic-strain increment constraint
[out]icActive internal-parameter constraint
activeThe active constraints.

Definition at line 227 of file MultiPlasticityLinearSystem.C.

237{
238 // see comments at the start of .h file
239
240 mooseAssert(intnl_old.size() == _num_models,
241 "Size of intnl_old is " << intnl_old.size()
242 << " which is incorrect in calculateConstraints");
243 mooseAssert(intnl.size() == _num_models,
244 "Size of intnl is " << intnl.size() << " which is incorrect in calculateConstraints");
245 mooseAssert(pm.size() == _num_surfaces,
246 "Size of pm is " << pm.size() << " which is incorrect in calculateConstraints");
247 mooseAssert(active.size() == _num_surfaces,
248 "Size of active is " << active.size()
249 << " which is incorrect in calculateConstraints");
250
251 // yield functions
252 yieldFunction(stress, intnl, active, f);
253
254 // flow directions and "epp"
255 flowPotential(stress, intnl, active, r);
256 epp = RankTwoTensor();
257 unsigned ind = 0;
258 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
259 if (active[surface])
260 epp += pm[surface] * r[ind++]; // note, even the deactivated_due_to_ld must get added in
261 epp -= delta_dp;
262
263 // internal constraints
264 std::vector<Real> h;
265 hardPotential(stress, intnl, active, h);
266 ic.resize(0);
267 ind = 0;
268 std::vector<unsigned int> active_surfaces;
269 std::vector<unsigned int>::iterator active_surface;
270 for (unsigned model = 0; model < _num_models; ++model)
271 {
272 activeSurfaces(model, active, active_surfaces);
273 if (active_surfaces.size() > 0)
274 {
275 // some surfaces are active in this model, so must form an internal constraint
276 ic.push_back(intnl[model] - intnl_old[model]);
277 for (active_surface = active_surfaces.begin(); active_surface != active_surfaces.end();
278 ++active_surface)
279 ic[ic.size() - 1] += pm[*active_surface] * h[ind++]; // we know the correct one is h[ind]
280 // since it was constructed in the same
281 // manner
282 }
283 }
284}
virtual void hardPotential(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &h)
The active hardening potentials (one for each internal parameter and for each yield function) by assu...
void activeSurfaces(int model, const std::vector< bool > &active, std::vector< unsigned int > &active_surfaces)
Returns the external surface number(s) of the active surfaces of the given model This may be of size=...
virtual void yieldFunction(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &f)
The active yield function(s)
virtual void flowPotential(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &r)
The active flow potential(s) - one for each yield function.

Referenced by calculateRHS(), and ComputeMultiPlasticityStress::lineSearch().

◆ calculateJacobian()

void MultiPlasticityLinearSystem::calculateJacobian ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< Real > &  pm,
const RankFourTensor E_inv,
const std::vector< bool > &  active,
const std::vector< bool > &  deactivated_due_to_ld,
std::vector< std::vector< Real > > &  jac 
)
protectedvirtual

d(rhs)/d(dof)

Definition at line 366 of file MultiPlasticityLinearSystem.C.

373{
374 // see comments at the start of .h file
375
376 mooseAssert(intnl.size() == _num_models,
377 "Size of intnl is " << intnl.size() << " which is incorrect in calculateJacobian");
378 mooseAssert(pm.size() == _num_surfaces,
379 "Size of pm is " << pm.size() << " which is incorrect in calculateJacobian");
380 mooseAssert(active.size() == _num_surfaces,
381 "Size of active is " << active.size() << " which is incorrect in calculateJacobian");
382 mooseAssert(deactivated_due_to_ld.size() == _num_surfaces,
383 "Size of deactivated_due_to_ld is " << deactivated_due_to_ld.size()
384 << " which is incorrect in calculateJacobian");
385
386 unsigned ind = 0;
387 unsigned active_surface_ind = 0;
388
389 std::vector<bool> active_surface(_num_surfaces); // active and not deactivated_due_to_ld
390 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
391 active_surface[surface] = (active[surface] && !deactivated_due_to_ld[surface]);
392 unsigned num_active_surface = 0;
393 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
394 if (active_surface[surface])
395 num_active_surface++;
396
397 std::vector<bool> active_model(
398 _num_models); // whether a model has surfaces that are active and not deactivated_due_to_ld
399 for (unsigned model = 0; model < _num_models; ++model)
400 active_model[model] = anyActiveSurfaces(model, active_surface);
401
402 unsigned num_active_model = 0;
403 for (unsigned model = 0; model < _num_models; ++model)
404 if (active_model[model])
405 num_active_model++;
406
407 ind = 0;
408 std::vector<unsigned int> active_model_index(_num_models);
409 for (unsigned model = 0; model < _num_models; ++model)
410 if (active_model[model])
411 active_model_index[model] = ind++;
412 else
413 active_model_index[model] =
414 _num_models + 1; // just a dummy, that will probably cause a crash if something goes wrong
415
416 std::vector<RankTwoTensor> df_dstress;
417 dyieldFunction_dstress(stress, intnl, active_surface, df_dstress);
418
419 std::vector<Real> df_dintnl;
420 dyieldFunction_dintnl(stress, intnl, active_surface, df_dintnl);
421
422 std::vector<RankTwoTensor> r;
423 flowPotential(stress, intnl, active, r);
424
425 std::vector<RankFourTensor> dr_dstress;
426 dflowPotential_dstress(stress, intnl, active, dr_dstress);
427
428 std::vector<RankTwoTensor> dr_dintnl;
429 dflowPotential_dintnl(stress, intnl, active, dr_dintnl);
430
431 std::vector<Real> h;
432 hardPotential(stress, intnl, active, h);
433
434 std::vector<RankTwoTensor> dh_dstress;
435 dhardPotential_dstress(stress, intnl, active, dh_dstress);
436
437 std::vector<Real> dh_dintnl;
438 dhardPotential_dintnl(stress, intnl, active, dh_dintnl);
439
440 // d(epp)/dstress = sum_{active alpha} pm[alpha]*dr_dstress
441 RankFourTensor depp_dstress;
442 ind = 0;
443 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
444 if (active[surface]) // includes deactivated_due_to_ld
445 depp_dstress += pm[surface] * dr_dstress[ind++];
446 depp_dstress += E_inv;
447
448 // d(epp)/dpm_{active_surface_index} = r_{active_surface_index}
449 std::vector<RankTwoTensor> depp_dpm;
450 depp_dpm.resize(num_active_surface);
451 ind = 0;
452 active_surface_ind = 0;
453 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
454 {
455 if (active[surface])
456 {
457 if (active_surface[surface]) // do not include the deactived_due_to_ld, since their pm are not
458 // dofs in the NR
459 depp_dpm[active_surface_ind++] = r[ind];
460 ind++;
461 }
462 }
463
464 // d(epp)/dintnl_{active_model_index} = sum(pm[asdf]*dr_dintnl[fdsa])
465 std::vector<RankTwoTensor> depp_dintnl;
466 depp_dintnl.assign(num_active_model, RankTwoTensor());
467 ind = 0;
468 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
469 {
470 if (active[surface])
471 {
472 unsigned int model_num = modelNumber(surface);
473 if (active_model[model_num]) // only include models with surfaces which are still active after
474 // deactivated_due_to_ld
475 depp_dintnl[active_model_index[model_num]] += pm[surface] * dr_dintnl[ind];
476 ind++;
477 }
478 }
479
480 // df_dstress has been calculated above
481 // df_dpm is always zero
482 // df_dintnl has been calculated above, but only the active_surface+active_model stuff needs to be
483 // included in Jacobian: see below
484
485 std::vector<RankTwoTensor> dic_dstress;
486 dic_dstress.assign(num_active_model, RankTwoTensor());
487 ind = 0;
488 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
489 {
490 if (active[surface])
491 {
492 unsigned int model_num = modelNumber(surface);
493 if (active_model[model_num]) // only include ic for models with active_surface (ie, if model
494 // only contains deactivated_due_to_ld don't include it)
495 dic_dstress[active_model_index[model_num]] += pm[surface] * dh_dstress[ind];
496 ind++;
497 }
498 }
499
500 std::vector<std::vector<Real>> dic_dpm;
501 dic_dpm.resize(num_active_model);
502 ind = 0;
503 active_surface_ind = 0;
504 for (unsigned model = 0; model < num_active_model; ++model)
505 dic_dpm[model].assign(num_active_surface, 0);
506 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
507 {
508 if (active[surface])
509 {
510 if (active_surface[surface]) // only take derivs wrt active-but-not-deactivated_due_to_ld pm
511 {
512 unsigned int model_num = modelNumber(surface);
513 // if (active_model[model_num]) // do not need this check as if the surface has
514 // active_surface, the model must be deemed active!
515 dic_dpm[active_model_index[model_num]][active_surface_ind] = h[ind];
516 active_surface_ind++;
517 }
518 ind++;
519 }
520 }
521
522 std::vector<std::vector<Real>> dic_dintnl;
523 dic_dintnl.resize(num_active_model);
524 for (unsigned model = 0; model < num_active_model; ++model)
525 {
526 dic_dintnl[model].assign(num_active_model, 0);
527 dic_dintnl[model][model] = 1; // deriv wrt internal parameter
528 }
529 ind = 0;
530 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
531 {
532 if (active[surface])
533 {
534 unsigned int model_num = modelNumber(surface);
535 if (active_model[model_num]) // only the models that contain surfaces that are still active
536 // after deactivation_due_to_ld
537 dic_dintnl[active_model_index[model_num]][active_model_index[model_num]] +=
538 pm[surface] * dh_dintnl[ind];
539 ind++;
540 }
541 }
542
543 unsigned int dim = 3;
544 unsigned int system_size =
545 6 + num_active_surface + num_active_model; // "6" comes from symmeterizing epp
546 jac.resize(system_size);
547 for (unsigned i = 0; i < system_size; ++i)
548 jac[i].assign(system_size, 0);
549
550 unsigned int row_num = 0;
551 unsigned int col_num = 0;
552 for (unsigned i = 0; i < dim; ++i)
553 for (unsigned j = 0; j <= i; ++j)
554 {
555 for (unsigned k = 0; k < dim; ++k)
556 for (unsigned l = 0; l <= k; ++l)
557 jac[col_num][row_num++] =
558 depp_dstress(i, j, k, l) +
559 (k != l ? depp_dstress(i, j, l, k)
560 : 0); // extra part is needed because i assume dstress(i, j) = dstress(j, i)
561 for (unsigned surface = 0; surface < num_active_surface; ++surface)
562 jac[col_num][row_num++] = depp_dpm[surface](i, j);
563 for (unsigned a = 0; a < num_active_model; ++a)
564 jac[col_num][row_num++] = depp_dintnl[a](i, j);
565 row_num = 0;
566 col_num++;
567 }
568
569 ind = 0;
570 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
571 if (active_surface[surface])
572 {
573 for (unsigned k = 0; k < dim; ++k)
574 for (unsigned l = 0; l <= k; ++l)
575 jac[col_num][row_num++] =
576 df_dstress[ind](k, l) +
577 (k != l ? df_dstress[ind](l, k)
578 : 0); // extra part is needed because i assume dstress(i, j) = dstress(j, i)
579 for (unsigned beta = 0; beta < num_active_surface; ++beta)
580 jac[col_num][row_num++] = 0; // df_dpm
581 for (unsigned model = 0; model < _num_models; ++model)
582 if (active_model[model]) // only use df_dintnl for models in active_model
583 {
584 if (modelNumber(surface) == model)
585 jac[col_num][row_num++] = df_dintnl[ind];
586 else
587 jac[col_num][row_num++] = 0;
588 }
589 ind++;
590 row_num = 0;
591 col_num++;
592 }
593
594 for (unsigned a = 0; a < num_active_model; ++a)
595 {
596 for (unsigned k = 0; k < dim; ++k)
597 for (unsigned l = 0; l <= k; ++l)
598 jac[col_num][row_num++] =
599 dic_dstress[a](k, l) +
600 (k != l ? dic_dstress[a](l, k)
601 : 0); // extra part is needed because i assume dstress(i, j) = dstress(j, i)
602 for (unsigned alpha = 0; alpha < num_active_surface; ++alpha)
603 jac[col_num][row_num++] = dic_dpm[a][alpha];
604 for (unsigned b = 0; b < num_active_model; ++b)
605 jac[col_num][row_num++] = dic_dintnl[a][b];
606 row_num = 0;
607 col_num++;
608 }
609
610 mooseAssert(col_num == system_size, "Incorrect filling of cols in Jacobian");
611}
unsigned int dim
bool anyActiveSurfaces(int model, const std::vector< bool > &active)
returns true if any internal surfaces of the given model are active according to 'active'
virtual void dhardPotential_dintnl(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &dh_dintnl)
The derivative of the active hardening potentials with respect to the active internal parameters.
virtual void dyieldFunction_dstress(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &df_dstress)
The derivative of the active yield function(s) with respect to stress.
virtual void dyieldFunction_dintnl(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< Real > &df_dintnl)
The derivative of active yield function(s) with respect to their internal parameters (the user object...
virtual void dflowPotential_dstress(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankFourTensor > &dr_dstress)
The derivative of the active flow potential(s) with respect to stress.
unsigned int modelNumber(unsigned int surface)
returns the model number, given the surface number
virtual void dhardPotential_dstress(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &dh_dstress)
The derivative of the active hardening potentials with respect to stress By assumption in the Userobj...
virtual void dflowPotential_dintnl(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< bool > &active, std::vector< RankTwoTensor > &dr_dintnl)
The derivative of the active flow potentials with respect to the active internal parameters The UserO...

Referenced by MultiPlasticityDebugger::checkJacobian(), MultiPlasticityDebugger::checkSolution(), and nrStep().

◆ calculateRHS()

void MultiPlasticityLinearSystem::calculateRHS ( const RankTwoTensor stress,
const std::vector< Real > &  intnl_old,
const std::vector< Real > &  intnl,
const std::vector< Real > &  pm,
const RankTwoTensor delta_dp,
std::vector< Real > &  rhs,
const std::vector< bool > &  active,
bool  eliminate_ld,
std::vector< bool > &  deactivated_due_to_ld 
)
protectedvirtual

Calculate the RHS which is rhs = -(epp(0,0), epp(1,0), epp(1,1), epp(2,0), epp(2,1), epp(2,2), f[0], f[1], ..., f[num_f], ic[0], ic[1], ..., ic[num_ic])

Note that the 'epp' components only contain the upper diagonal. These contain flow directions and plasticity-multipliers for all active surfaces, even the deactivated_due_to_ld surfaces. Note that the 'f' components only contain the active and not deactivated_due_to_ld surfaces Note that the 'ic' components only contain the internal constraints for models which contain active and not deactivated_due_to_ld surfaces. They contain hardening-potentials and plasticity-multipliers for the active surfaces, even the deactivated_due_to_ld surfaces

Parameters
stressThe stress
intnl_oldold values of the internal parameters
intnlinternal parameters
pmCurrent value(s) of the plasticity multiplier(s) (consistency parameters)
delta_dpChange in plastic strain incurred so far during the return
[out]rhsthe rhs
activeThe active constraints.
eliminate_ldCheck for linear dependence of constraints and put the results into deactivated_due_to_ld. Usually this should be true, but for certain debug operations it should be false
[out]deactivated_due_to_ldconstraints deactivated due to linear-dependence of flow directions

Definition at line 287 of file MultiPlasticityLinearSystem.C.

296{
297 // see comments at the start of .h file
298
299 mooseAssert(intnl_old.size() == _num_models,
300 "Size of intnl_old is " << intnl_old.size() << " which is incorrect in calculateRHS");
301 mooseAssert(intnl.size() == _num_models,
302 "Size of intnl is " << intnl.size() << " which is incorrect in calculateRHS");
303 mooseAssert(pm.size() == _num_surfaces,
304 "Size of pm is " << pm.size() << " which is incorrect in calculateRHS");
305 mooseAssert(active.size() == _num_surfaces,
306 "Size of active is " << active.size() << " which is incorrect in calculateRHS");
307
308 std::vector<Real> f; // the yield functions
309 RankTwoTensor epp; // the plastic-strain constraint ("direction constraint")
310 std::vector<Real> ic; // the "internal constraints"
311
312 std::vector<RankTwoTensor> r;
313 calculateConstraints(stress, intnl_old, intnl, pm, delta_dp, f, r, epp, ic, active);
314
315 if (eliminate_ld)
316 eliminateLinearDependence(stress, intnl, f, r, active, deactivated_due_to_ld);
317 else
318 deactivated_due_to_ld.assign(_num_surfaces, false);
319
320 std::vector<bool> active_not_deact(_num_surfaces);
321 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
322 active_not_deact[surface] = (active[surface] && !deactivated_due_to_ld[surface]);
323
324 unsigned num_active_f = 0;
325 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
326 if (active_not_deact[surface])
327 num_active_f++;
328
329 unsigned num_active_ic = 0;
330 for (unsigned model = 0; model < _num_models; ++model)
331 if (anyActiveSurfaces(model, active_not_deact))
332 num_active_ic++;
333
334 unsigned int dim = 3;
335 unsigned int system_size = 6 + num_active_f + num_active_ic; // "6" comes from symmeterizing epp,
336 // num_active_f comes from "f",
337 // num_active_f comes from "ic"
338
339 rhs.resize(system_size);
340
341 unsigned ind = 0;
342 for (unsigned i = 0; i < dim; ++i)
343 for (unsigned j = 0; j <= i; ++j)
344 rhs[ind++] = -epp(i, j);
345 unsigned active_surface = 0;
346 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
347 if (active[surface])
348 {
349 if (!deactivated_due_to_ld[surface])
350 rhs[ind++] = -f[active_surface];
351 active_surface++;
352 }
353 unsigned active_model = 0;
354 for (unsigned model = 0; model < _num_models; ++model)
355 if (anyActiveSurfaces(model, active))
356 {
357 if (anyActiveSurfaces(model, active_not_deact))
358 rhs[ind++] = -ic[active_model];
359 active_model++;
360 }
361
362 mooseAssert(ind == system_size, "Incorrect filling of the rhs in calculateRHS");
363}
virtual void calculateConstraints(const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankTwoTensor &delta_dp, std::vector< Real > &f, std::vector< RankTwoTensor > &r, RankTwoTensor &epp, std::vector< Real > &ic, const std::vector< bool > &active)
The constraints.
virtual void eliminateLinearDependence(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< Real > &f, const std::vector< RankTwoTensor > &r, const std::vector< bool > &active, std::vector< bool > &deactivated_due_to_ld)
Performs a number of singular-value decompositions to check for linear-dependence of the active direc...

Referenced by MultiPlasticityDebugger::checkSolution(), MultiPlasticityDebugger::fdJacobian(), and nrStep().

◆ dflowPotential_dintnl()

void MultiPlasticityRawComponentAssembler::dflowPotential_dintnl ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< RankTwoTensor > &  dr_dintnl 
)
protectedvirtualinherited

The derivative of the active flow potentials with respect to the active internal parameters The UserObjects explicitly assume that r[alpha] is only dependent on intnl[alpha].

Parameters
stressthe stress at which to calculate the flow potential
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "dr_dintnl"
[out]dr_dintnlthe derivatives. dr_dintnl[alpha](i, j) = dr[alpha](i, j)/dintnl[alpha]

Definition at line 233 of file MultiPlasticityRawComponentAssembler.C.

237{
238 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
239 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
240
241 dr_dintnl.resize(0);
242 std::vector<unsigned int> active_surfaces_of_model;
243 std::vector<unsigned int>::iterator active_surface;
244 std::vector<RankTwoTensor> model_dr_dintnl;
245 for (unsigned model = 0; model < _num_models; ++model)
246 {
247 activeModelSurfaces(model, active, active_surfaces_of_model);
248 if (active_surfaces_of_model.size() > 0)
249 {
250 _f[model]->dflowPotential_dintnlV(stress, intnl[model], model_dr_dintnl);
251 for (active_surface = active_surfaces_of_model.begin();
252 active_surface != active_surfaces_of_model.end();
253 ++active_surface)
254 dr_dintnl.push_back(model_dr_dintnl[*active_surface]);
255 }
256 }
257}
void activeModelSurfaces(int model, const std::vector< bool > &active, std::vector< unsigned int > &active_surfaces_of_model)
Returns the internal surface number(s) of the active surfaces of the given model This may be of size=...

Referenced by calculateJacobian(), MultiPlasticityDebugger::checkDerivatives(), and ComputeMultiPlasticityStress::consistentTangentOperator().

◆ dflowPotential_dstress()

void MultiPlasticityRawComponentAssembler::dflowPotential_dstress ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< RankFourTensor > &  dr_dstress 
)
protectedvirtualinherited

The derivative of the active flow potential(s) with respect to stress.

Parameters
stressthe stress at which to calculate the flow potential
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "dr_dstress"
[out]dr_dstressthe derivative. dr_dstress[alpha](i, j, k, l) = dr[alpha](i, j)/dstress(k, l)

Definition at line 205 of file MultiPlasticityRawComponentAssembler.C.

210{
211 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
212 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
213
214 dr_dstress.resize(0);
215 std::vector<unsigned int> active_surfaces_of_model;
216 std::vector<unsigned int>::iterator active_surface;
217 std::vector<RankFourTensor> model_dr_dstress;
218 for (unsigned model = 0; model < _num_models; ++model)
219 {
220 activeModelSurfaces(model, active, active_surfaces_of_model);
221 if (active_surfaces_of_model.size() > 0)
222 {
223 _f[model]->dflowPotential_dstressV(stress, intnl[model], model_dr_dstress);
224 for (active_surface = active_surfaces_of_model.begin();
225 active_surface != active_surfaces_of_model.end();
226 ++active_surface)
227 dr_dstress.push_back(model_dr_dstress[*active_surface]);
228 }
229 }
230}

Referenced by calculateJacobian(), MultiPlasticityDebugger::checkDerivatives(), and ComputeMultiPlasticityStress::consistentTangentOperator().

◆ dhardPotential_dintnl()

void MultiPlasticityRawComponentAssembler::dhardPotential_dintnl ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< Real > &  dh_dintnl 
)
protectedvirtualinherited

The derivative of the active hardening potentials with respect to the active internal parameters.

Parameters
stressthe stress at which to calculate the hardening potentials
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "dh_dintnl"
[out]dh_dintnlthe derivatives. dh_dintnl[a][alpha][b] = dh[a][alpha]/dintnl[b]. Note that the userobjects assume that there is exactly one internal parameter per yield function, so the derivative is only nonzero for a=alpha=b, so that is all we calculate

Definition at line 315 of file MultiPlasticityRawComponentAssembler.C.

319{
320 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
321 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
322
323 dh_dintnl.resize(0);
324 std::vector<unsigned int> active_surfaces_of_model;
325 std::vector<unsigned int>::iterator active_surface;
326 std::vector<Real> model_dh_dintnl;
327 for (unsigned model = 0; model < _num_models; ++model)
328 {
329 activeModelSurfaces(model, active, active_surfaces_of_model);
330 if (active_surfaces_of_model.size() > 0)
331 {
332 _f[model]->dhardPotential_dintnlV(stress, intnl[model], model_dh_dintnl);
333 for (active_surface = active_surfaces_of_model.begin();
334 active_surface != active_surfaces_of_model.end();
335 ++active_surface)
336 dh_dintnl.push_back(model_dh_dintnl[*active_surface]);
337 }
338 }
339}

Referenced by calculateJacobian().

◆ dhardPotential_dstress()

void MultiPlasticityRawComponentAssembler::dhardPotential_dstress ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< RankTwoTensor > &  dh_dstress 
)
protectedvirtualinherited

The derivative of the active hardening potentials with respect to stress By assumption in the Userobjects, the h[a][alpha] is nonzero only for a = alpha, so we only calculate those here.

Parameters
stressthe stress at which to calculate the hardening potentials
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "dh_dstress"
[out]dh_dstressthe derivative. dh_dstress[a](i, j) = dh[a]/dstress(k, l)

Definition at line 287 of file MultiPlasticityRawComponentAssembler.C.

292{
293 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
294 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
295
296 dh_dstress.resize(0);
297 std::vector<unsigned int> active_surfaces_of_model;
298 std::vector<unsigned int>::iterator active_surface;
299 std::vector<RankTwoTensor> model_dh_dstress;
300 for (unsigned model = 0; model < _num_models; ++model)
301 {
302 activeModelSurfaces(model, active, active_surfaces_of_model);
303 if (active_surfaces_of_model.size() > 0)
304 {
305 _f[model]->dhardPotential_dstressV(stress, intnl[model], model_dh_dstress);
306 for (active_surface = active_surfaces_of_model.begin();
307 active_surface != active_surfaces_of_model.end();
308 ++active_surface)
309 dh_dstress.push_back(model_dh_dstress[*active_surface]);
310 }
311 }
312}

Referenced by calculateJacobian().

◆ dyieldFunction_dintnl()

void MultiPlasticityRawComponentAssembler::dyieldFunction_dintnl ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< Real > &  df_dintnl 
)
protectedvirtualinherited

The derivative of active yield function(s) with respect to their internal parameters (the user objects assume there is exactly one internal param per yield function)

Parameters
stressthe stress at which to calculate the yield function
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "df_dintnl"
[out]df_dintnlthe derivatives. df_dstress[alpha] = dyieldFunction[alpha]/dintnl[alpha]

Definition at line 151 of file MultiPlasticityRawComponentAssembler.C.

155{
156 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
157 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
158
159 df_dintnl.resize(0);
160 std::vector<unsigned int> active_surfaces_of_model;
161 std::vector<unsigned int>::iterator active_surface;
162 std::vector<Real> model_df_dintnl;
163 for (unsigned model = 0; model < _num_models; ++model)
164 {
165 activeModelSurfaces(model, active, active_surfaces_of_model);
166 if (active_surfaces_of_model.size() > 0)
167 {
168 _f[model]->dyieldFunction_dintnlV(stress, intnl[model], model_df_dintnl);
169 for (active_surface = active_surfaces_of_model.begin();
170 active_surface != active_surfaces_of_model.end();
171 ++active_surface)
172 df_dintnl.push_back(model_df_dintnl[*active_surface]);
173 }
174 }
175}

Referenced by calculateJacobian(), MultiPlasticityDebugger::checkDerivatives(), and ComputeMultiPlasticityStress::consistentTangentOperator().

◆ dyieldFunction_dstress()

void MultiPlasticityRawComponentAssembler::dyieldFunction_dstress ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< RankTwoTensor > &  df_dstress 
)
protectedvirtualinherited

The derivative of the active yield function(s) with respect to stress.

Parameters
stressthe stress at which to calculate the yield function
intnlvector of internal parameters
activeset of active constraints - only the active derivatives are put into "df_dstress"
[out]df_dstressthe derivative (or derivatives in the case of multisurface plasticity). df_dstress[alpha](i, j) = dyieldFunction[alpha]/dstress(i, j)

Definition at line 123 of file MultiPlasticityRawComponentAssembler.C.

128{
129 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
130 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
131
132 df_dstress.resize(0);
133 std::vector<unsigned int> active_surfaces_of_model;
134 std::vector<unsigned int>::iterator active_surface;
135 std::vector<RankTwoTensor> model_df_dstress;
136 for (unsigned model = 0; model < _num_models; ++model)
137 {
138 activeModelSurfaces(model, active, active_surfaces_of_model);
139 if (active_surfaces_of_model.size() > 0)
140 {
141 _f[model]->dyieldFunction_dstressV(stress, intnl[model], model_df_dstress);
142 for (active_surface = active_surfaces_of_model.begin();
143 active_surface != active_surfaces_of_model.end();
144 ++active_surface)
145 df_dstress.push_back(model_df_dstress[*active_surface]);
146 }
147 }
148}

Referenced by ComputeMultiPlasticityStress::buildDumbOrder(), calculateJacobian(), MultiPlasticityDebugger::checkDerivatives(), ComputeMultiPlasticityStress::consistentTangentOperator(), and eliminateLinearDependence().

◆ eliminateLinearDependence()

void MultiPlasticityLinearSystem::eliminateLinearDependence ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< Real > &  f,
const std::vector< RankTwoTensor > &  r,
const std::vector< bool > &  active,
std::vector< bool > &  deactivated_due_to_ld 
)
privatevirtual

Performs a number of singular-value decompositions to check for linear-dependence of the active directions "r" If linear dependence is found, then deactivated_due_to_ld will contain 'true' entries where surfaces need to be deactivated_due_to_ld.

Parameters
stressthe current stress
intnlthe current values of internal parameters
fActive yield function values
rthe flow directions that for those yield functions that are active upon entry to this function
activetrue if active
[out]deactivated_due_to_ldYield functions deactivated due to linearly-dependent flow directions

Definition at line 106 of file MultiPlasticityLinearSystem.C.

112{
113 deactivated_due_to_ld.resize(_num_surfaces, false);
114
115 unsigned num_active = r.size();
116
117 if (num_active <= 1)
118 return;
119
120 std::vector<double> s;
121 int info = singularValuesOfR(r, s);
122 if (info != 0)
123 mooseError("In finding the SVD in the return-map algorithm, the PETSC LAPACK gesvd routine "
124 "returned with error code ",
125 info);
126
127 // num_lin_dep are the number of linearly dependent
128 // "r vectors", if num_active <= 6
129 unsigned int num_lin_dep = 0;
130
131 unsigned i = s.size();
132 while (i-- > 0)
133 if (s[i] < _svd_tol * s[0])
134 num_lin_dep++;
135 else
136 break;
137
138 if (num_lin_dep == 0 && num_active <= 6)
139 return;
140
141 // From here on, some flow directions are linearly dependent
142
143 // Find the signed "distance" of the current (stress, internal) configuration
144 // from the yield surfaces. This distance will not be precise, but
145 // i want to preferentially deactivate yield surfaces that are close
146 // to the current stress point.
147 std::vector<RankTwoTensor> df_dstress;
148 dyieldFunction_dstress(stress, intnl, active, df_dstress);
149
150 typedef std::pair<Real, unsigned> pair_for_sorting;
151 std::vector<pair_for_sorting> dist(num_active);
152 for (unsigned i = 0; i < num_active; ++i)
153 {
154 dist[i].first = f[i] / df_dstress[i].L2norm();
155 dist[i].second = i;
156 }
157 std::sort(dist.begin(), dist.end()); // sorted in ascending order
158
159 // There is a potential problem when we have equal f[i], for it can give oscillations
160 bool equals_detected = false;
161 for (unsigned i = 0; i < num_active - 1; ++i)
162 if (std::abs(dist[i].first - dist[i + 1].first) < _min_f_tol)
163 {
164 equals_detected = true;
165 dist[i].first += _min_f_tol * (MooseRandom::rand() - 0.5);
166 }
167 if (equals_detected)
168 std::sort(dist.begin(), dist.end()); // sorted in ascending order
169
170 std::vector<bool> scheduled_for_deactivation;
171 scheduled_for_deactivation.assign(num_active, false);
172
173 // In the following loop we go through all the flow directions, from
174 // the one with the largest dist, to the one with the smallest dist,
175 // adding them one-by-one into r_tmp. Upon each addition we check
176 // for linear-dependence. if LD is found, we schedule the most
177 // recently added flow direction for deactivation, and pop it
178 // back off r_tmp
179 unsigned current_yf;
180 current_yf = dist[num_active - 1].second;
181 // the one with largest dist
182 std::vector<RankTwoTensor> r_tmp = {r[current_yf]};
183
184 unsigned num_kept_active = 1;
185 for (unsigned yf_to_try = 2; yf_to_try <= num_active; ++yf_to_try)
186 {
187 current_yf = dist[num_active - yf_to_try].second;
188 if (num_active == 2) // shortcut to we don't have to singularValuesOfR
189 scheduled_for_deactivation[current_yf] = true;
190 else if (num_kept_active >= 6) // shortcut to we don't have to singularValuesOfR: there can
191 // never be > 6 linearly-independent r vectors
192 scheduled_for_deactivation[current_yf] = true;
193 else
194 {
195 r_tmp.push_back(r[current_yf]);
196 info = singularValuesOfR(r_tmp, s);
197 if (info != 0)
198 mooseError("In finding the SVD in the return-map algorithm, the PETSC LAPACK gesvd routine "
199 "returned with error code ",
200 info);
201 if (s[s.size() - 1] < _svd_tol * s[0])
202 {
203 scheduled_for_deactivation[current_yf] = true;
204 r_tmp.pop_back();
205 num_lin_dep--;
206 }
207 else
208 num_kept_active++;
209 if (num_lin_dep == 0 && num_active <= 6)
210 // have taken out all the vectors that were linearly dependent
211 // so no point continuing
212 break;
213 }
214 }
215
216 unsigned int old_active_number = 0;
217 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
218 if (active[surface])
219 {
220 if (scheduled_for_deactivation[old_active_number])
221 deactivated_due_to_ld[surface] = true;
222 old_active_number++;
223 }
224}
void mooseError(Args &&... args)
static Real rand()
virtual int singularValuesOfR(const std::vector< RankTwoTensor > &r, std::vector< Real > &s)
Performs a singular-value decomposition of r and returns the singular values.
MPI_Info info

Referenced by calculateRHS().

◆ flowPotential()

void MultiPlasticityRawComponentAssembler::flowPotential ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< RankTwoTensor > &  r 
)
protectedvirtualinherited

The active flow potential(s) - one for each yield function.

Parameters
stressthe stress at which to calculate the flow potential
intnlvector of internal parameters
activeset of active constraints - only the active flow potentials are put into "r"
[out]rthe flow potential (flow potentials in the multi-surface case)

Definition at line 178 of file MultiPlasticityRawComponentAssembler.C.

182{
183 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
184 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
185
186 r.resize(0);
187 std::vector<unsigned int> active_surfaces_of_model;
188 std::vector<unsigned int>::iterator active_surface;
189 std::vector<RankTwoTensor> model_r;
190 for (unsigned model = 0; model < _num_models; ++model)
191 {
192 activeModelSurfaces(model, active, active_surfaces_of_model);
193 if (active_surfaces_of_model.size() > 0)
194 {
195 _f[model]->flowPotentialV(stress, intnl[model], model_r);
196 for (active_surface = active_surfaces_of_model.begin();
197 active_surface != active_surfaces_of_model.end();
198 ++active_surface)
199 r.push_back(model_r[*active_surface]);
200 }
201 }
202}

Referenced by calculateConstraints(), calculateJacobian(), ComputeMultiPlasticityStress::consistentTangentOperator(), MultiPlasticityDebugger::fddflowPotential_dintnl(), and MultiPlasticityDebugger::fddflowPotential_dstress().

◆ hardPotential()

void MultiPlasticityRawComponentAssembler::hardPotential ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< Real > &  h 
)
protectedvirtualinherited

The active hardening potentials (one for each internal parameter and for each yield function) by assumption in the Userobjects, the h[a][alpha] is nonzero only if the surface alpha is part of model a, so we only calculate those here.

Parameters
stressthe stress at which to calculate the hardening potential
intnlvector of internal parameters
activeset of active constraints - only the active hardening potentials are put into "h"
[out]hthe hardening potentials. h[alpha] = hardening potential for yield fcn alpha (and, by the above assumption we know which hardening parameter, a, this belongs to)

Definition at line 260 of file MultiPlasticityRawComponentAssembler.C.

264{
265 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
266 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
267
268 h.resize(0);
269 std::vector<unsigned int> active_surfaces_of_model;
270 std::vector<unsigned int>::iterator active_surface;
271 std::vector<Real> model_h;
272 for (unsigned model = 0; model < _num_models; ++model)
273 {
274 activeModelSurfaces(model, active, active_surfaces_of_model);
275 if (active_surfaces_of_model.size() > 0)
276 {
277 _f[model]->hardPotentialV(stress, intnl[model], model_h);
278 for (active_surface = active_surfaces_of_model.begin();
279 active_surface != active_surfaces_of_model.end();
280 ++active_surface)
281 h.push_back(model_h[*active_surface]);
282 }
283 }
284}

Referenced by calculateConstraints(), calculateJacobian(), and ComputeMultiPlasticityStress::consistentTangentOperator().

◆ modelNumber()

unsigned int MultiPlasticityRawComponentAssembler::modelNumber ( unsigned int  surface)
protectedinherited

◆ nrStep()

void MultiPlasticityLinearSystem::nrStep ( const RankTwoTensor stress,
const std::vector< Real > &  intnl_old,
const std::vector< Real > &  intnl,
const std::vector< Real > &  pm,
const RankFourTensor E_inv,
const RankTwoTensor delta_dp,
RankTwoTensor dstress,
std::vector< Real > &  dpm,
std::vector< Real > &  dintnl,
const std::vector< bool > &  active,
std::vector< bool > &  deactivated_due_to_ld 
)
protectedvirtual

Performs one Newton-Raphson step.

The purpose here is to find the changes, dstress, dpm and dintnl according to the Newton-Raphson procedure

Parameters
stressCurrent value of stress
intnl_oldThe internal variables at the previous "time" step
intnlCurrent value of the internal variables
pmCurrent value of the plasticity multipliers (consistency parameters)
E_invinverse of the elasticity tensor
delta_dpCurrent value of the plastic-strain increment (ie plastic_strain - plastic_strain_old)
[out]dstressThe change in stress for a full Newton step
[out]dpmThe change in all plasticity multipliers for a full Newton step
[out]dintnlThe change in all internal variables for a full Newton step
activeThe active constraints
[out]deactivated_due_to_ldThe constraints deactivated due to linear-dependence of the flow directions

Definition at line 614 of file MultiPlasticityLinearSystem.C.

625{
626 // Calculate RHS and Jacobian
627 std::vector<Real> rhs;
628 calculateRHS(stress, intnl_old, intnl, pm, delta_dp, rhs, active, true, deactivated_due_to_ld);
629
630 std::vector<std::vector<Real>> jac;
631 calculateJacobian(stress, intnl, pm, E_inv, active, deactivated_due_to_ld, jac);
632
633 // prepare for LAPACKgesv_ routine provided by PETSc
634 PetscBLASInt system_size = rhs.size();
635
636 std::vector<double> a(system_size * system_size);
637 // Fill in the a "matrix" by going down columns
638 unsigned ind = 0;
639 for (int col = 0; col < system_size; ++col)
640 for (int row = 0; row < system_size; ++row)
641 a[ind++] = jac[row][col];
642
643 PetscBLASInt nrhs = 1;
644 std::vector<PetscBLASInt> ipiv(system_size);
645 PetscBLASInt info;
646 LAPACKgesv_(&system_size, &nrhs, &a[0], &system_size, &ipiv[0], &rhs[0], &system_size, &info);
647
648 if (info != 0)
649 mooseError("In solving the linear system in a Newton-Raphson process, the PETSC LAPACK gsev "
650 "routine returned with error code ",
651 info);
652
653 // Extract the results back to dstress, dpm and dintnl
654 std::vector<bool> active_not_deact(_num_surfaces);
655 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
656 active_not_deact[surface] = (active[surface] && !deactivated_due_to_ld[surface]);
657
658 unsigned int dim = 3;
659 ind = 0;
660
661 for (unsigned i = 0; i < dim; ++i)
662 for (unsigned j = 0; j <= i; ++j)
663 dstress(i, j) = dstress(j, i) = rhs[ind++];
664 dpm.assign(_num_surfaces, 0);
665 for (unsigned surface = 0; surface < _num_surfaces; ++surface)
666 if (active_not_deact[surface])
667 dpm[surface] = rhs[ind++];
668 dintnl.assign(_num_models, 0);
669 for (unsigned model = 0; model < _num_models; ++model)
670 if (anyActiveSurfaces(model, active_not_deact))
671 dintnl[model] = rhs[ind++];
672
673 mooseAssert(static_cast<int>(ind) == system_size,
674 "Incorrect extracting of changes from NR solution in nrStep");
675}
virtual void calculateRHS(const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankTwoTensor &delta_dp, std::vector< Real > &rhs, const std::vector< bool > &active, bool eliminate_ld, std::vector< bool > &deactivated_due_to_ld)
Calculate the RHS which is rhs = -(epp(0,0), epp(1,0), epp(1,1), epp(2,0), epp(2,1),...
virtual void calculateJacobian(const RankTwoTensor &stress, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankFourTensor &E_inv, const std::vector< bool > &active, const std::vector< bool > &deactivated_due_to_ld, std::vector< std::vector< Real > > &jac)
d(rhs)/d(dof)

Referenced by MultiPlasticityDebugger::checkSolution(), and ComputeMultiPlasticityStress::singleStep().

◆ returnMapAll()

bool MultiPlasticityRawComponentAssembler::returnMapAll ( const RankTwoTensor trial_stress,
const std::vector< Real > &  intnl_old,
const RankFourTensor E_ijkl,
Real  ep_plastic_tolerance,
RankTwoTensor stress,
std::vector< Real > &  intnl,
std::vector< Real > &  pm,
std::vector< Real > &  cumulative_pm,
RankTwoTensor delta_dp,
std::vector< Real > &  yf,
unsigned &  num_successful_plastic_returns,
unsigned &  custom_model 
)
protectedinherited

Performs a returnMap for each plastic model using their inbuilt returnMap functions.

Performs a returnMap for each plastic model.

This may be used to quickly ascertain whether a (trial_stress, intnl_old) configuration is admissible, or whether a single model's customized returnMap function can provide a solution to the return-map problem, or whether a full Newton-Raphson approach such as implemented in ComputeMultiPlasticityStress is needed.

There are three cases mentioned below: (A) The (trial_stress, intnl_old) configuration is admissible according to all plastic models (B) The (trial_stress, intnl_old) configuration is inadmissible to exactly one plastic model, and that model can successfully use its customized returnMap function to provide a returned (stress, intnl) configuration, and that configuration is admissible according to all plastic models (C) All other cases. This includes customized returnMap functions failing, or more than one plastic_model being inadmissible, etc

Parameters
trial_stressthe trial stress
intnl_oldthe old values of the internal parameters
E_ijklthe elasticity tensor
ep_plastic_tolerancethe tolerance on the plastic strain
[out]stressis set to trial_stress in case (A) or (C), and the returned value of stress in case (B).
[out]intnlis set to intnl_old in case (A) or (C), and the returned value of intnl in case (B)
[out]pmZero in case (A) or (C), otherwise the plastic multipliers needed to bring about the returnMap in case (B)
[in/out]cumulative_pm cumulative plastic multipliers, updated in case (B), otherwise left untouched
[out]delta_dpis unchanged in case (A) or (C), and is set to the change in plastic strain in case(B)
[out]yfwill contain the yield function values at (stress, intnl)
[out]num_successful_plastic_returnswill be 0 for (A) and (C), and 1 for (B)
Returns
true in case (A) and (B), and false in case (C)

If all models actually signal "elastic" by returning true from their returnMap, and by returning model_plastically_active=0, then yf will contain the yield function values num_successful_plastic_returns will be zero intnl = intnl_old delta_dp will be unchanged from its input value stress will be set to trial_stress pm will be zero cumulative_pm will be unchanged return value will be true num_successful_plastic_returns = 0

If only one model signals "plastically active" by returning true from its returnMap, and by returning model_plastically_active=1, then yf will contain the yield function values num_successful_plastic_returns will be one intnl will be set by the returnMap algorithm delta_dp will be set by the returnMap algorithm stress will be set by the returnMap algorithm pm will be nonzero for the single model, and zero for other models cumulative_pm will be updated return value will be true num_successful_plastic_returns = 1

If >1 model signals "plastically active" or if >=1 model's returnMap fails, then yf will contain the yield function values num_successful_plastic_returns will be set appropriately intnl = intnl_old delta_dp will be unchanged from its input value stress will be set to trial_stress pm will be zero cumulative_pm will be unchanged return value will be true if all returnMap functions returned true, otherwise it will be false num_successful_plastic_returns is set appropriately

Definition at line 597 of file MultiPlasticityRawComponentAssembler.C.

609{
610 mooseAssert(intnl_old.size() == _num_models,
611 "returnMapAll: Incorrect size of internal parameters");
612 mooseAssert(intnl.size() == _num_models, "returnMapAll: Incorrect size of internal parameters");
613 mooseAssert(pm.size() == _num_surfaces, "returnMapAll: Incorrect size of pm");
614
615 num_successful_plastic_returns = 0;
616 yf.resize(0);
617 pm.assign(_num_surfaces, 0.0);
618
619 RankTwoTensor returned_stress; // each model will give a returned_stress. if only one model is
620 // plastically active, i set stress=returned_stress, so as to
621 // record this returned value
622 std::vector<Real> model_f;
623 RankTwoTensor model_delta_dp;
624 std::vector<Real> model_pm;
625 bool trial_stress_inadmissible;
626 bool successful_return = true;
627 unsigned the_single_plastic_model = 0;
628 bool using_custom_return_map = true;
629
630 // run through all the plastic models, performing their
631 // returnMap algorithms.
632 // If one finds (trial_stress, intnl) inadmissible and
633 // successfully returns, break from the loop to evaluate
634 // all the others at that returned stress
635 for (unsigned model = 0; model < _num_models; ++model)
636 {
637 if (using_custom_return_map)
638 {
639 model_pm.assign(_f[model]->numberSurfaces(), 0.0);
640 bool model_returned = _f[model]->returnMap(trial_stress,
641 intnl_old[model],
642 E_ijkl,
643 ep_plastic_tolerance,
644 returned_stress,
645 intnl[model],
646 model_pm,
647 model_delta_dp,
648 model_f,
649 trial_stress_inadmissible);
650 if (!trial_stress_inadmissible)
651 {
652 // in the elastic zone: record the yield-function values (returned_stress, intnl, model_pm
653 // and model_delta_dp are undefined)
654 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces();
655 ++model_surface)
656 yf.push_back(model_f[model_surface]);
657 }
658 else if (trial_stress_inadmissible && !model_returned)
659 {
660 // in the plastic zone, and the customized returnMap failed
661 // for some reason (or wasn't implemented). The coder
662 // should have correctly returned model_f(trial_stress, intnl_old)
663 // so record them
664 // (returned_stress, intnl, model_pm and model_delta_dp are undefined)
665 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces();
666 ++model_surface)
667 yf.push_back(model_f[model_surface]);
668 // now there's almost zero point in using the custom
669 // returnMap functions
670 using_custom_return_map = false;
671 successful_return = false;
672 }
673 else
674 {
675 // in the plastic zone, and the customized returnMap
676 // succeeded.
677 // record the first returned_stress and delta_dp if everything is going OK
678 // as they could be the actual answer
679 if (trial_stress_inadmissible)
680 num_successful_plastic_returns++;
681 the_single_plastic_model = model;
682 stress = returned_stress;
683 // note that i break here, and don't push_back
684 // model_f to yf. So now yf contains only the values of
685 // model_f from previous models to the_single_plastic_model
686 // also i don't set delta_dp = model_delta_dp yet, because
687 // i might find problems later on
688 // also, don't increment cumulative_pm for the same reason
689
690 break;
691 }
692 }
693 else
694 {
695 // not using custom returnMap functions because one
696 // has already failed and that one said trial_stress
697 // was inadmissible. So now calculate the yield functions
698 // at the trial stress
699 _f[model]->yieldFunctionV(trial_stress, intnl_old[model], model_f);
700 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
701 yf.push_back(model_f[model_surface]);
702 }
703 }
704
705 if (num_successful_plastic_returns == 0)
706 {
707 // here either all the models were elastic (successful_return=true),
708 // or some were plastic and either the customized returnMap failed
709 // or wasn't implemented (successful_return=false).
710 // In either case, have to set the following:
711 stress = trial_stress;
712 for (unsigned model = 0; model < _num_models; ++model)
713 intnl[model] = intnl_old[model];
714 return successful_return;
715 }
716
717 // Now we know that num_successful_plastic_returns == 1 and all the other
718 // models (with model number < the_single_plastic_model) must have been
719 // admissible at (trial_stress, intnl). However, all models might
720 // not be admissible at (trial_stress, intnl), so must check that
721 std::vector<Real> yf_at_returned_stress(0);
722 bool all_admissible = true;
723 for (unsigned model = 0; model < _num_models; ++model)
724 {
725 if (model == the_single_plastic_model)
726 {
727 // no need to spend time calculating the yield function: we know its admissible
728 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
729 yf_at_returned_stress.push_back(model_f[model_surface]);
730 continue;
731 }
732 _f[model]->yieldFunctionV(stress, intnl_old[model], model_f);
733 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
734 {
735 if (model_f[model_surface] > _f[model]->_f_tol)
736 // bummer, this model is not admissible at the returned_stress
737 all_admissible = false;
738 yf_at_returned_stress.push_back(model_f[model_surface]);
739 }
740 if (!all_admissible)
741 // no point in continuing computing yield functions
742 break;
743 }
744
745 if (!all_admissible)
746 {
747 // we tried using the returned value of stress predicted by
748 // the_single_plastic_model, but it wasn't admissible according
749 // to other plastic models. We need to set:
750 stress = trial_stress;
751 for (unsigned model = 0; model < _num_models; ++model)
752 intnl[model] = intnl_old[model];
753 // and calculate the remainder of the yield functions at trial_stress
754 for (unsigned model = the_single_plastic_model; model < _num_models; ++model)
755 {
756 _f[model]->yieldFunctionV(trial_stress, intnl[model], model_f);
757 for (unsigned model_surface = 0; model_surface < _f[model]->numberSurfaces(); ++model_surface)
758 yf.push_back(model_f[model_surface]);
759 }
760 num_successful_plastic_returns = 0;
761 return false;
762 }
763
764 // So the customized returnMap algorithm can provide a returned
765 // (stress, intnl) configuration, and that is admissible according
766 // to all plastic models
767 yf.resize(0);
768 for (unsigned surface = 0; surface < yf_at_returned_stress.size(); ++surface)
769 yf.push_back(yf_at_returned_stress[surface]);
770 delta_dp = model_delta_dp;
771 for (unsigned model_surface = 0; model_surface < _f[the_single_plastic_model]->numberSurfaces();
772 ++model_surface)
773 {
774 cumulative_pm[_surfaces_given_model[the_single_plastic_model][model_surface]] +=
775 model_pm[model_surface];
776 pm[_surfaces_given_model[the_single_plastic_model][model_surface]] = model_pm[model_surface];
777 }
778 custom_model = the_single_plastic_model;
779 return true;
780}

Referenced by ComputeMultiPlasticityStress::quickStep().

◆ singularValuesOfR()

int MultiPlasticityLinearSystem::singularValuesOfR ( const std::vector< RankTwoTensor > &  r,
std::vector< Real > &  s 
)
privatevirtual

Performs a singular-value decomposition of r and returns the singular values.

Example: If r has size 5 then the singular values of the following matrix are returned: ( r[0](0,0) r[0](0,1) r[0](0,2) r[0](1,1) r[0](1,2) r[0](2,2) ) ( r[1](0,0) r[1](0,1) r[1](0,2) r[1](1,1) r[1](1,2) r[1](2,2) ) a = ( r[2](0,0) r[2](0,1) r[2](0,2) r[2](1,1) r[2](1,2) r[2](2,2) ) ( r[3](0,0) r[3](0,1) r[3](0,2) r[3](1,1) r[3](1,2) r[3](2,2) ) ( r[4](0,0) r[4](0,1) r[4](0,2) r[4](1,1) r[4](1,2) r[4](2,2) )

Parameters
rThe flow directions
[out]sThe singular values
Returns
The return value from the PETSc LAPACK gesvd reoutine

Definition at line 45 of file MultiPlasticityLinearSystem.C.

47{
48 PetscBLASInt bm = r.size();
49 PetscBLASInt bn = 6;
50
51 s.resize(std::min(bm, bn));
52
53 // prepare for gesvd or gesdd routine provided by PETSc
54 // Want to find the singular values of matrix
55 // ( r[0](0,0) r[0](0,1) r[0](0,2) r[0](1,1) r[0](1,2) r[0](2,2) )
56 // ( r[1](0,0) r[1](0,1) r[1](0,2) r[1](1,1) r[1](1,2) r[1](2,2) )
57 // a = ( r[2](0,0) r[2](0,1) r[2](0,2) r[2](1,1) r[2](1,2) r[2](2,2) )
58 // ( r[3](0,0) r[3](0,1) r[3](0,2) r[3](1,1) r[3](1,2) r[3](2,2) )
59 // ( r[4](0,0) r[4](0,1) r[4](0,2) r[4](1,1) r[4](1,2) r[4](2,2) )
60 // bm = 5
61
62 std::vector<double> a(bm * 6);
63 // Fill in the a "matrix" by going down columns
64 unsigned ind = 0;
65 for (int col = 0; col < 3; ++col)
66 for (int row = 0; row < bm; ++row)
67 a[ind++] = r[row](0, col);
68 for (int col = 3; col < 5; ++col)
69 for (int row = 0; row < bm; ++row)
70 a[ind++] = r[row](1, col - 2);
71 for (int row = 0; row < bm; ++row)
72 a[ind++] = r[row](2, 2);
73
74 // u and vt are dummy variables because they won't
75 // get referenced due to the "N" and "N" choices
76 PetscBLASInt sizeu = 1;
77 std::vector<double> u(sizeu);
78 PetscBLASInt sizevt = 1;
79 std::vector<double> vt(sizevt);
80
81 PetscBLASInt sizework =
82 16 * (bm + 6); // this is above the lowerbound specified in the LAPACK doco
83 std::vector<double> work(sizework);
84
85 PetscBLASInt info;
86
87 LAPACKgesvd_("N",
88 "N",
89 &bm,
90 &bn,
91 &a[0],
92 &bm,
93 &s[0],
94 &u[0],
95 &sizeu,
96 &vt[0],
97 &sizevt,
98 &work[0],
99 &sizework,
100 &info);
101
102 return info;
103}

Referenced by eliminateLinearDependence().

◆ validParams()

InputParameters MultiPlasticityLinearSystem::validParams ( )
static

Definition at line 20 of file MultiPlasticityLinearSystem.C.

21{
23 params.addRangeCheckedParam<Real>("linear_dependent",
24 1E-4,
25 "linear_dependent>=0 & linear_dependent<1",
26 "Flow directions are considered linearly dependent if the "
27 "smallest singular value is less than linear_dependent times "
28 "the largest singular value");
29 return params;
30}
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by MultiPlasticityDebugger::validParams().

◆ yieldFunction()

void MultiPlasticityRawComponentAssembler::yieldFunction ( const RankTwoTensor stress,
const std::vector< Real > &  intnl,
const std::vector< bool > &  active,
std::vector< Real > &  f 
)
protectedvirtualinherited

The active yield function(s)

Parameters
stressthe stress at which to calculate the yield function
intnlvector of internal parameters
activeset of active constraints - only the active yield functions are put into "f"
[out]fthe yield function (or functions in the case of multisurface plasticity)

Definition at line 96 of file MultiPlasticityRawComponentAssembler.C.

100{
101 mooseAssert(intnl.size() == _num_models, "Incorrect size of internal parameters");
102 mooseAssert(active.size() == _num_surfaces, "Incorrect size of active");
103
104 f.resize(0);
105 std::vector<unsigned int> active_surfaces_of_model;
106 std::vector<unsigned int>::iterator active_surface;
107 std::vector<Real> model_f;
108 for (unsigned model = 0; model < _num_models; ++model)
109 {
110 activeModelSurfaces(model, active, active_surfaces_of_model);
111 if (active_surfaces_of_model.size() > 0)
112 {
113 _f[model]->yieldFunctionV(stress, intnl[model], model_f);
114 for (active_surface = active_surfaces_of_model.begin();
115 active_surface != active_surfaces_of_model.end();
116 ++active_surface)
117 f.push_back(model_f[*active_surface]);
118 }
119 }
120}

Referenced by ComputeMultiPlasticityStress::buildDumbOrder(), calculateConstraints(), ComputeMultiPlasticityStress::checkAdmissible(), MultiPlasticityDebugger::fddyieldFunction_dintnl(), MultiPlasticityDebugger::fddyieldFunction_dstress(), and ComputeMultiPlasticityStress::returnMap().

Member Data Documentation

◆ _f

std::vector<const SolidMechanicsPlasticModel *> MultiPlasticityRawComponentAssembler::_f
protectedinherited

User objects that define the yield functions, flow potentials, etc.

Definition at line 71 of file MultiPlasticityRawComponentAssembler.h.

Referenced by MultiPlasticityRawComponentAssembler::activeModelSurfaces(), MultiPlasticityRawComponentAssembler::activeSurfaces(), MultiPlasticityRawComponentAssembler::anyActiveSurfaces(), ComputeMultiPlasticityStress::applyKuhnTucker(), MultiPlasticityRawComponentAssembler::buildActiveConstraints(), MultiPlasticityRawComponentAssembler::buildActiveConstraintsJoint(), MultiPlasticityRawComponentAssembler::buildActiveConstraintsRock(), ComputeMultiPlasticityStress::canAddConstraints(), ComputeMultiPlasticityStress::checkAdmissible(), ComputeMultiPlasticityStress::checkKuhnTucker(), MultiPlasticityRawComponentAssembler::dflowPotential_dintnl(), MultiPlasticityRawComponentAssembler::dflowPotential_dstress(), MultiPlasticityRawComponentAssembler::dhardPotential_dintnl(), MultiPlasticityRawComponentAssembler::dhardPotential_dstress(), MultiPlasticityRawComponentAssembler::dyieldFunction_dintnl(), MultiPlasticityRawComponentAssembler::dyieldFunction_dstress(), MultiPlasticityRawComponentAssembler::flowPotential(), MultiPlasticityRawComponentAssembler::hardPotential(), MultiPlasticityLinearSystem(), MultiPlasticityRawComponentAssembler::MultiPlasticityRawComponentAssembler(), ComputeMultiPlasticityStress::quickStep(), ComputeMultiPlasticityStress::residual2(), ComputeMultiPlasticityStress::returnMap(), MultiPlasticityRawComponentAssembler::returnMapAll(), ComputeMultiPlasticityStress::singleStep(), and MultiPlasticityRawComponentAssembler::yieldFunction().

◆ _min_f_tol

Real MultiPlasticityLinearSystem::_min_f_tol
protected

Minimum value of the _f_tol parameters for the Yield Function User Objects.

Definition at line 131 of file MultiPlasticityLinearSystem.h.

Referenced by eliminateLinearDependence(), and MultiPlasticityLinearSystem().

◆ _model_given_surface

std::vector<unsigned int> MultiPlasticityRawComponentAssembler::_model_given_surface
privateinherited

◆ _model_surface_given_surface

std::vector<unsigned int> MultiPlasticityRawComponentAssembler::_model_surface_given_surface
privateinherited

given a surface number, this returns the corresponding-model's internal surface number

Definition at line 294 of file MultiPlasticityRawComponentAssembler.h.

Referenced by MultiPlasticityRawComponentAssembler::MultiPlasticityRawComponentAssembler().

◆ _num_models

unsigned int MultiPlasticityRawComponentAssembler::_num_models
protectedinherited

◆ _num_surfaces

unsigned int MultiPlasticityRawComponentAssembler::_num_surfaces
protectedinherited

Number of surfaces within the plastic models.

For many situations this will be = _num_models since each model will contain just one surface. More generally it is >= _num_models. For instance, Mohr-Coulomb is a single model with 6 surfaces

Definition at line 62 of file MultiPlasticityRawComponentAssembler.h.

Referenced by ComputeMultiPlasticityStress::activeCombinationNumber(), ComputeMultiPlasticityStress::applyKuhnTucker(), MultiPlasticityRawComponentAssembler::buildActiveConstraints(), ComputeMultiPlasticityStress::buildDumbOrder(), calculateConstraints(), calculateJacobian(), calculateRHS(), ComputeMultiPlasticityStress::canAddConstraints(), ComputeMultiPlasticityStress::canIncrementDumb(), ComputeMultiPlasticityStress::changeScheme(), ComputeMultiPlasticityStress::checkAdmissible(), MultiPlasticityDebugger::checkDerivatives(), MultiPlasticityDebugger::checkJacobian(), ComputeMultiPlasticityStress::checkKuhnTucker(), MultiPlasticityDebugger::checkSolution(), ComputeMultiPlasticityStress::ComputeMultiPlasticityStress(), ComputeMultiPlasticityStress::computeQpStress(), ComputeMultiPlasticityStress::consistentTangentOperator(), MultiPlasticityRawComponentAssembler::dflowPotential_dintnl(), MultiPlasticityRawComponentAssembler::dflowPotential_dstress(), MultiPlasticityRawComponentAssembler::dhardPotential_dintnl(), MultiPlasticityRawComponentAssembler::dhardPotential_dstress(), MultiPlasticityDebugger::dof_included(), MultiPlasticityRawComponentAssembler::dyieldFunction_dintnl(), MultiPlasticityRawComponentAssembler::dyieldFunction_dstress(), eliminateLinearDependence(), MultiPlasticityDebugger::fddflowPotential_dintnl(), MultiPlasticityDebugger::fddflowPotential_dstress(), MultiPlasticityDebugger::fddyieldFunction_dintnl(), MultiPlasticityDebugger::fddyieldFunction_dstress(), MultiPlasticityDebugger::fdJacobian(), MultiPlasticityRawComponentAssembler::flowPotential(), MultiPlasticityRawComponentAssembler::hardPotential(), ComputeMultiPlasticityStress::incrementDumb(), ComputeMultiPlasticityStress::initQpStatefulProperties(), MultiPlasticityRawComponentAssembler::MultiPlasticityRawComponentAssembler(), nrStep(), ComputeMultiPlasticityStress::numberActive(), MultiPlasticityDebugger::outputAndCheckDebugParameters(), ComputeMultiPlasticityStress::plasticStep(), ComputeMultiPlasticityStress::reinstateLinearDependentConstraints(), ComputeMultiPlasticityStress::residual2(), ComputeMultiPlasticityStress::returnMap(), MultiPlasticityRawComponentAssembler::returnMapAll(), ComputeMultiPlasticityStress::singleStep(), and MultiPlasticityRawComponentAssembler::yieldFunction().

◆ _params

const InputParameters& MultiPlasticityRawComponentAssembler::_params
protectedinherited

◆ _specialIC

MooseEnum MultiPlasticityRawComponentAssembler::_specialIC
protectedinherited

◆ _surfaces_given_model

std::vector<std::vector<unsigned int> > MultiPlasticityRawComponentAssembler::_surfaces_given_model
protectedinherited

◆ _svd_tol

Real MultiPlasticityLinearSystem::_svd_tol
protected

Tolerance on the minimum ratio of singular values before flow-directions are deemed linearly dependent.

Definition at line 128 of file MultiPlasticityLinearSystem.h.

Referenced by eliminateLinearDependence().


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