www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PoroMechanicsAction Class Reference

#include <PoroMechanicsAction.h>

Inheritance diagram for PoroMechanicsAction:
[legend]

Public Member Functions

 PoroMechanicsAction (const InputParameters &params)
 
virtual void act ()
 

Static Public Member Functions

static InputParameters validParams ()
 
static MultiMooseEnum outputPropertiesType ()
 

Static Public Attributes

static const std::map< std::string, std::string > _ranktwoaux_table
 table data for output generation More...
 
static const std::vector< char > _component_table = {'x', 'y', 'z'}
 
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _ranktwoscalaraux_table
 

Protected Types

enum  Strain { Strain::Small, Strain::Finite }
 strain formulation More...
 
enum  StrainAndIncrement { StrainAndIncrement::SmallTotal, StrainAndIncrement::FiniteTotal, StrainAndIncrement::SmallIncremental, StrainAndIncrement::FiniteIncremental }
 strain formulation More...
 
enum  PlanarFormulation { PlanarFormulation::None, PlanarFormulation::WeakPlaneStress, PlanarFormulation::PlaneStrain, PlanarFormulation::GeneralizedPlaneStrain }
 use an out of plane stress/strain formulation More...
 
enum  OutOfPlaneDirection { OutOfPlaneDirection::x, OutOfPlaneDirection::y, OutOfPlaneDirection::z }
 

Protected Member Functions

void actSubdomainChecks ()
 
void actOutputGeneration ()
 
void actGatherActionParameters ()
 
virtual std::string getKernelType ()
 
virtual InputParameters getKernelParameters (std::string type)
 

Protected Attributes

Moose::CoordinateSystemType _coord_system
 
std::vector< SubdomainName > _subdomain_names
 if this vector is not empty the variables, kernels and materials are restricted to these subdomains More...
 
std::set< SubdomainID > _subdomain_ids
 set generated from the passed in vector of subdomain names More...
 
std::set< SubdomainID > _subdomain_id_union
 set generated from the combined block restrictions of all TensorMechanics/Master action blocks More...
 
enum TensorMechanicsAction::Strain _strain
 
enum TensorMechanicsAction::StrainAndIncrement _strain_and_increment
 
enum TensorMechanicsAction::PlanarFormulation _planar_formulation
 
const OutOfPlaneDirection _out_of_plane_direction
 
const std::string _base_name
 base name for the current master action block More...
 
bool _use_displaced_mesh
 use displaced mesh (true unless _strain is SMALL) More...
 
std::vector< std::string > _generate_output
 output aux variables to generate for sclar stress/strain tensor quantities More...
 
const bool _use_ad
 
std::vector< VariableName > _displacements
 displacement variables More...
 
unsigned int _ndisp
 
std::vector< VariableName > _coupled_displacements
 
std::vector< AuxVariableName > _save_in
 residual debugging More...
 
std::vector< AuxVariableName > _diag_save_in
 

Detailed Description

Definition at line 19 of file PoroMechanicsAction.h.

Member Enumeration Documentation

◆ OutOfPlaneDirection

enum TensorMechanicsAction::OutOfPlaneDirection
strongprotectedinherited
Enumerator

Definition at line 83 of file TensorMechanicsAction.h.

84  {
85  x,
86  y,
87  z
88  };

◆ PlanarFormulation

enum TensorMechanicsAction::PlanarFormulation
strongprotectedinherited

use an out of plane stress/strain formulation

Enumerator
None 
WeakPlaneStress 
PlaneStrain 
GeneralizedPlaneStrain 

Definition at line 75 of file TensorMechanicsAction.h.

76  {
77  None,
79  PlaneStrain,

◆ Strain

enum TensorMechanicsAction::Strain
strongprotectedinherited

strain formulation

Enumerator
Small 
Finite 

Definition at line 59 of file TensorMechanicsAction.h.

60  {
61  Small,
62  Finite
63  } _strain;

◆ StrainAndIncrement

enum TensorMechanicsAction::StrainAndIncrement
strongprotectedinherited

strain formulation

Enumerator
SmallTotal 
FiniteTotal 
SmallIncremental 
FiniteIncremental 

Definition at line 66 of file TensorMechanicsAction.h.

67  {
68  SmallTotal,
69  FiniteTotal,
70  SmallIncremental,
71  FiniteIncremental

Constructor & Destructor Documentation

◆ PoroMechanicsAction()

PoroMechanicsAction::PoroMechanicsAction ( const InputParameters &  params)

Definition at line 33 of file PoroMechanicsAction.C.

34  : TensorMechanicsAction(params)
35 {
36  if (_use_ad)
37  paramError("use_ad", "AD not setup for use with PoroMechanicsAction");
38 }

Member Function Documentation

◆ act()

void PoroMechanicsAction::act ( )
virtual

Reimplemented from TensorMechanicsAction.

Definition at line 41 of file PoroMechanicsAction.C.

42 {
44 
45  if (_current_task == "add_kernel")
46  {
47  // Prepare displacements and set value for dim
48  std::vector<VariableName> displacements = getParam<std::vector<VariableName>>("displacements");
49  unsigned int dim = displacements.size();
50 
51  // all the kernels added below have pore pressure as a coupled variable
52  // add this to the kernel's params
53  std::string type("PoroMechanicsCoupling");
54  InputParameters params = _factory.getValidParams(type);
55  VariableName pp_var(getParam<VariableName>("porepressure"));
56  params.addCoupledVar("porepressure", "");
57  params.set<std::vector<VariableName>>("porepressure") = {pp_var};
58 
59  // now add the kernels
60  for (unsigned int i = 0; i < dim; ++i)
61  {
62  std::string kernel_name = "PoroMechanics" + Moose::stringify(i);
63 
64  params.set<unsigned int>("component") = i;
65  params.set<NonlinearVariableName>("variable") = displacements[i];
66 
67  _problem->addKernel(type, kernel_name, params);
68  }
69  }
70 }

◆ actGatherActionParameters()

void TensorMechanicsAction::actGatherActionParameters ( )
protectedinherited

Definition at line 501 of file TensorMechanicsAction.C.

502 {
503  //
504  // Gather info about all other master actions when we add variables
505  //
506  if (_current_task == "validate_coordinate_systems" && getParam<bool>("add_variables"))
507  {
508  auto actions = _awh.getActions<TensorMechanicsAction>();
509  for (const auto & action : actions)
510  {
511  const auto size_before = _subdomain_id_union.size();
512  const auto added_size = action->_subdomain_ids.size();
513  _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
514  const auto size_after = _subdomain_id_union.size();
515 
516  if (size_after != size_before + added_size)
517  mooseError("The block restrictions in the TensorMechanics/Master actions must be "
518  "non-overlapping.");
519 
520  if (added_size == 0 && actions.size() > 1)
521  mooseError("No TensorMechanics/Master action can be block unrestricted if more than one "
522  "TensorMechanics/Master action is specified.");
523  }
524  }
525 }

Referenced by TensorMechanicsAction::act().

◆ actOutputGeneration()

void TensorMechanicsAction::actOutputGeneration ( )
protectedinherited

Definition at line 427 of file TensorMechanicsAction.C.

428 {
429  //
430  // Add variables (optional)
431  //
432  if (_current_task == "add_aux_variable")
433  {
434  auto params = _factory.getValidParams("MooseVariableConstMonomial");
435  params.set<MooseEnum>("order") = "CONSTANT";
436  params.set<MooseEnum>("family") = "MONOMIAL";
437  // Loop through output aux variables
438  for (auto out : _generate_output)
439  {
440  // Create output helper aux variables
441  _problem->addAuxVariable("MooseVariableConstMonomial", _base_name + out, params);
442  }
443  }
444 
445  //
446  // Add output AuxKernels
447  //
448  else if (_current_task == "add_aux_kernel")
449  {
450  // Loop through output aux variables
451  for (auto out : _generate_output)
452  {
453  std::string type = "";
454  InputParameters params = emptyInputParameters();
455 
456  // RankTwoAux
457  for (const auto & r2a : _ranktwoaux_table)
458  for (unsigned int a = 0; a < 3; ++a)
459  for (unsigned int b = 0; b < 3; ++b)
460  if (r2a.first + '_' + _component_table[a] + _component_table[b] == out)
461  {
462  type = "RankTwoAux";
463  params = _factory.getValidParams(type);
464  params.set<MaterialPropertyName>("rank_two_tensor") = _base_name + r2a.second;
465  params.set<unsigned int>("index_i") = a;
466  params.set<unsigned int>("index_j") = b;
467  }
468 
469  // RankTwoScalarAux
470  for (const auto & r2sa : _ranktwoscalaraux_table)
471  for (const auto & t : r2sa.second.second)
472  if (r2sa.first + '_' + t == out)
473  {
474  const auto r2a = _ranktwoaux_table.find(t);
475  if (r2a != _ranktwoaux_table.end())
476  {
477  type = "RankTwoScalarAux";
478  params = _factory.getValidParams(type);
479  params.set<MaterialPropertyName>("rank_two_tensor") = _base_name + r2a->second;
480  params.set<MooseEnum>("scalar_type") = r2sa.second.first;
481  }
482  else
483  mooseError("Internal error. The permitted tensor shortcuts in "
484  "'_ranktwoscalaraux_table' must be keys in the '_ranktwoaux_table'.");
485  }
486 
487  if (type != "")
488  {
489  params.applyParameters(parameters());
490  params.set<AuxVariableName>("variable") = _base_name + out;
491  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
492  _problem->addAuxKernel(type, _base_name + out + '_' + name(), params);
493  }
494  else
495  mooseError("Unable to add output AuxKernel");
496  }
497  }
498 }

Referenced by TensorMechanicsAction::act().

◆ actSubdomainChecks()

void TensorMechanicsAction::actSubdomainChecks ( )
protectedinherited

Definition at line 382 of file TensorMechanicsAction.C.

383 {
384  //
385  // Do the coordinate system check only once the problem is created
386  //
387  if (_current_task == "setup_mesh_complete")
388  {
389  // get subdomain IDs
390  for (auto & name : _subdomain_names)
391  _subdomain_ids.insert(_mesh->getSubdomainID(name));
392  }
393 
394  if (_current_task == "validate_coordinate_systems")
395  {
396  // use either block restriction list or list of all subdomains in the mesh
397  const auto & check_subdomains =
398  _subdomain_ids.empty() ? _problem->mesh().meshSubdomains() : _subdomain_ids;
399  if (check_subdomains.empty())
400  mooseError("No subdomains found");
401 
402  // make sure all subdomains are using the same coordinate system
403  _coord_system = _problem->getCoordSystem(*check_subdomains.begin());
404  for (auto subdomain : check_subdomains)
405  if (_problem->getCoordSystem(subdomain) != _coord_system)
406  mooseError("The TensorMechanics action requires all subdomains to have the same coordinate "
407  "system.");
408 
409  if (_coord_system == Moose::COORD_RZ)
410  {
412  mooseError("'out_of_plane_direction' must be 'z' for axisymmetric simulations");
413  }
415  {
417  mooseError(
418  "Must specify two displacements for plane strain when the out of plane direction is z");
420  mooseError("Must specify three displacements for plane strain when the out of plane "
421  "direction is x or y");
422  }
423  }
424 }

Referenced by TensorMechanicsAction::act().

◆ getKernelParameters()

InputParameters TensorMechanicsAction::getKernelParameters ( std::string  type)
protectedvirtualinherited

Definition at line 544 of file TensorMechanicsAction.C.

545 {
546  InputParameters params = _factory.getValidParams(type);
547  params.applyParameters(parameters(),
548  {"displacements",
549  "use_displaced_mesh",
550  "save_in",
551  "diag_save_in",
552  "out_of_plane_strain"});
553 
554  params.set<std::vector<VariableName>>("displacements") = _coupled_displacements;
555  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
556 
557  return params;
558 }

Referenced by TensorMechanicsAction::act().

◆ getKernelType()

std::string TensorMechanicsAction::getKernelType ( )
protectedvirtualinherited

Reimplemented in DynamicTensorMechanicsAction.

Definition at line 528 of file TensorMechanicsAction.C.

529 {
530  std::map<Moose::CoordinateSystemType, std::string> type_map = {
531  {Moose::COORD_XYZ, "StressDivergenceTensors"},
532  {Moose::COORD_RZ, "StressDivergenceRZTensors"},
533  {Moose::COORD_RSPHERICAL, "StressDivergenceRSphericalTensors"}};
534 
535  // choose kernel type based on coordinate system
536  auto type_it = type_map.find(_coord_system);
537  if (type_it != type_map.end())
538  return type_it->second;
539  else
540  mooseError("Unsupported coordinate system");
541 }

Referenced by TensorMechanicsAction::act().

◆ outputPropertiesType()

MultiMooseEnum TensorMechanicsActionBase::outputPropertiesType ( )
staticinherited

Definition at line 134 of file TensorMechanicsActionBase.C.

135 {
136  std::string options = "";
137  for (auto & r2a : _ranktwoaux_table)
138  for (unsigned int a = 0; a < 3; ++a)
139  for (unsigned int b = 0; b < 3; ++b)
140  options += (options == "" ? "" : " ") + r2a.first + '_' + _component_table[a] +
141  _component_table[b];
142 
143  for (auto & r2sa : _ranktwoscalaraux_table)
144  for (auto & t : r2sa.second.second)
145  options += " " + r2sa.first + "_" + t;
146 
147  return MultiMooseEnum(options);
148 }

Referenced by TensorMechanicsAction::validParams(), and TensorMechanicsActionBase::validParams().

◆ validParams()

InputParameters PoroMechanicsAction::validParams ( )
static

Definition at line 26 of file PoroMechanicsAction.C.

27 {
28  InputParameters params = TensorMechanicsAction::validParams();
29  params.addRequiredParam<VariableName>("porepressure", "The pore pressure variable");
30  return params;
31 }

Member Data Documentation

◆ _base_name

const std::string TensorMechanicsAction::_base_name
protectedinherited

base name for the current master action block

Definition at line 93 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actOutputGeneration().

◆ _component_table

const std::vector< char > TensorMechanicsActionBase::_component_table = {'x', 'y', 'z'}
staticinherited

◆ _coord_system

Moose::CoordinateSystemType TensorMechanicsAction::_coord_system
protectedinherited

◆ _coupled_displacements

std::vector<VariableName> TensorMechanicsAction::_coupled_displacements
protectedinherited

◆ _diag_save_in

std::vector<AuxVariableName> TensorMechanicsAction::_diag_save_in
protectedinherited

◆ _displacements

std::vector<VariableName> TensorMechanicsAction::_displacements
protectedinherited

displacement variables

Definition at line 37 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::act(), and TensorMechanicsAction::TensorMechanicsAction().

◆ _generate_output

std::vector<std::string> TensorMechanicsAction::_generate_output
protectedinherited

output aux variables to generate for sclar stress/strain tensor quantities

Definition at line 99 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actOutputGeneration(), and TensorMechanicsAction::TensorMechanicsAction().

◆ _ndisp

unsigned int TensorMechanicsAction::_ndisp
protectedinherited

◆ _out_of_plane_direction

const OutOfPlaneDirection TensorMechanicsAction::_out_of_plane_direction
protectedinherited

◆ _planar_formulation

enum TensorMechanicsAction::PlanarFormulation TensorMechanicsAction::_planar_formulation
protectedinherited

◆ _ranktwoaux_table

const std::map< std::string, std::string > TensorMechanicsActionBase::_ranktwoaux_table
staticinherited
Initial value:
= {
{"strain", "total_strain"},
{"stress", "stress"},
{"elastic_strain", "elastic_strain"},
{"plastic_strain", "plastic_strain"},
{"creep_strain", "creep_strain"}}

table data for output generation

Definition at line 30 of file TensorMechanicsActionBase.h.

Referenced by TensorMechanicsAction::actOutputGeneration(), and TensorMechanicsActionBase::outputPropertiesType().

◆ _ranktwoscalaraux_table

const std::map< std::string, std::pair< std::string, std::vector< std::string > > > TensorMechanicsActionBase::_ranktwoscalaraux_table
staticinherited
Initial value:
= {
{"vonmises", {"VonMisesStress", {"stress"}}},
{"hydrostatic", {"Hydrostatic", {"stress"}}},
{"max_principal", {"MaxPrincipal", {"stress"}}},
{"mid_principal", {"MidPrincipal", {"stress"}}},
{"min_principal", {"MinPrincipal", {"stress"}}},
{"firstinv", {"FirstInvariant", {"stress", "strain"}}},
{"secondinv", {"SecondInvariant", {"stress", "strain"}}},
{"thirdinv", {"ThirdInvariant", {"stress", "strain"}}}}

Definition at line 33 of file TensorMechanicsActionBase.h.

Referenced by TensorMechanicsAction::actOutputGeneration(), and TensorMechanicsActionBase::outputPropertiesType().

◆ _save_in

std::vector<AuxVariableName> TensorMechanicsAction::_save_in
protectedinherited

residual debugging

Definition at line 43 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::act(), and TensorMechanicsAction::TensorMechanicsAction().

◆ _strain

enum TensorMechanicsAction::Strain TensorMechanicsAction::_strain
protectedinherited

◆ _strain_and_increment

enum TensorMechanicsAction::StrainAndIncrement TensorMechanicsAction::_strain_and_increment
protectedinherited

◆ _subdomain_id_union

std::set<SubdomainID> TensorMechanicsAction::_subdomain_id_union
protectedinherited

set generated from the combined block restrictions of all TensorMechanics/Master action blocks

Definition at line 56 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actGatherActionParameters().

◆ _subdomain_ids

std::set<SubdomainID> TensorMechanicsAction::_subdomain_ids
protectedinherited

set generated from the passed in vector of subdomain names

Definition at line 53 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actSubdomainChecks().

◆ _subdomain_names

std::vector<SubdomainName> TensorMechanicsAction::_subdomain_names
protectedinherited

if this vector is not empty the variables, kernels and materials are restricted to these subdomains

Definition at line 50 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actSubdomainChecks().

◆ _use_ad

const bool TensorMechanicsActionBase::_use_ad
protectedinherited

Definition at line 37 of file TensorMechanicsActionBase.h.

Referenced by TensorMechanicsAction::act(), and PoroMechanicsAction().

◆ _use_displaced_mesh

bool TensorMechanicsAction::_use_displaced_mesh
protectedinherited

use displaced mesh (true unless _strain is SMALL)

Definition at line 96 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::act(), TensorMechanicsAction::getKernelParameters(), and TensorMechanicsAction::TensorMechanicsAction().


The documentation for this class was generated from the following files:
TensorMechanicsAction::PlanarFormulation::None
WeakPlaneStress
Definition: WeakPlaneStress.h:26
GeneralizedPlaneStrain
Definition: GeneralizedPlaneStrain.h:23
TensorMechanicsAction::_planar_formulation
enum TensorMechanicsAction::PlanarFormulation _planar_formulation
TensorMechanicsAction::_ndisp
unsigned int _ndisp
Definition: TensorMechanicsAction.h:38
TensorMechanicsAction
Definition: TensorMechanicsAction.h:19
TensorMechanicsActionBase::_component_table
static const std::vector< char > _component_table
Definition: TensorMechanicsActionBase.h:31
TensorMechanicsAction::OutOfPlaneDirection::z
TensorMechanicsAction::_use_displaced_mesh
bool _use_displaced_mesh
use displaced mesh (true unless _strain is SMALL)
Definition: TensorMechanicsAction.h:96
TensorMechanicsActionBase::_ranktwoaux_table
static const std::map< std::string, std::string > _ranktwoaux_table
table data for output generation
Definition: TensorMechanicsActionBase.h:30
TensorMechanicsAction::_base_name
const std::string _base_name
base name for the current master action block
Definition: TensorMechanicsAction.h:93
TensorMechanicsAction::_strain
enum TensorMechanicsAction::Strain _strain
TensorMechanicsActionBase::_use_ad
const bool _use_ad
Definition: TensorMechanicsActionBase.h:37
TensorMechanicsAction::_coupled_displacements
std::vector< VariableName > _coupled_displacements
Definition: TensorMechanicsAction.h:39
TensorMechanicsAction::_subdomain_names
std::vector< SubdomainName > _subdomain_names
if this vector is not empty the variables, kernels and materials are restricted to these subdomains
Definition: TensorMechanicsAction.h:50
TensorMechanicsActionBase::_ranktwoscalaraux_table
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _ranktwoscalaraux_table
Definition: TensorMechanicsActionBase.h:33
name
const std::string name
Definition: Setup.h:21
TensorMechanicsAction::_subdomain_id_union
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all TensorMechanics/Master action blocks
Definition: TensorMechanicsAction.h:56
TensorMechanicsAction::_generate_output
std::vector< std::string > _generate_output
output aux variables to generate for sclar stress/strain tensor quantities
Definition: TensorMechanicsAction.h:99
TensorMechanicsAction::_strain_and_increment
enum TensorMechanicsAction::StrainAndIncrement _strain_and_increment
TensorMechanicsAction::_subdomain_ids
std::set< SubdomainID > _subdomain_ids
set generated from the passed in vector of subdomain names
Definition: TensorMechanicsAction.h:53
TensorMechanicsAction::act
virtual void act()
Definition: TensorMechanicsAction.C:156
TensorMechanicsAction::TensorMechanicsAction
TensorMechanicsAction(const InputParameters &params)
Definition: TensorMechanicsAction.C:67
TensorMechanicsAction::validParams
static InputParameters validParams()
Definition: TensorMechanicsAction.C:39
TensorMechanicsAction::_out_of_plane_direction
const OutOfPlaneDirection _out_of_plane_direction
Definition: TensorMechanicsAction.h:90
TensorMechanicsAction::_coord_system
Moose::CoordinateSystemType _coord_system
Definition: TensorMechanicsAction.h:47