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 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::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
 
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...
 
std::vector< NonlinearVariableName > _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 20 of file PoroMechanicsAction.h.

Member Enumeration Documentation

◆ OutOfPlaneDirection

enum TensorMechanicsAction::OutOfPlaneDirection
strongprotectedinherited
Enumerator

Definition at line 82 of file TensorMechanicsAction.h.

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

◆ PlanarFormulation

enum TensorMechanicsAction::PlanarFormulation
strongprotectedinherited

use an out of plane stress/strain formulation

Enumerator
None 
PlaneStrain 
GeneralizedPlaneStrain 

Definition at line 74 of file TensorMechanicsAction.h.

75  {
76  None,
77  PlaneStrain,
79  /* PlaneStress */
enum TensorMechanicsAction::PlanarFormulation _planar_formulation

◆ Strain

enum TensorMechanicsAction::Strain
strongprotectedinherited

strain formulation

Enumerator
Small 
Finite 

Definition at line 58 of file TensorMechanicsAction.h.

59  {
60  Small,
61  Finite
62  } _strain;
enum TensorMechanicsAction::Strain _strain

◆ StrainAndIncrement

enum TensorMechanicsAction::StrainAndIncrement
strongprotectedinherited

strain formulation

Enumerator
SmallTotal 
FiniteTotal 
SmallIncremental 
FiniteIncremental 

Definition at line 65 of file TensorMechanicsAction.h.

66  {
67  SmallTotal,
68  FiniteTotal,
69  SmallIncremental,
70  FiniteIncremental
enum TensorMechanicsAction::StrainAndIncrement _strain_and_increment

Constructor & Destructor Documentation

◆ PoroMechanicsAction()

PoroMechanicsAction::PoroMechanicsAction ( const InputParameters &  params)

Definition at line 32 of file PoroMechanicsAction.C.

33  : TensorMechanicsAction(params)
34 {
35 }
TensorMechanicsAction(const InputParameters &params)

Member Function Documentation

◆ act()

void PoroMechanicsAction::act ( )
virtual

Reimplemented from TensorMechanicsAction.

Definition at line 38 of file PoroMechanicsAction.C.

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

◆ actGatherActionParameters()

void TensorMechanicsAction::actGatherActionParameters ( )
protectedinherited

Definition at line 422 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

423 {
424  //
425  // Gather info about all other master actions when we add variables
426  //
427  if (_current_task == "validate_coordinate_systems" && getParam<bool>("add_variables"))
428  {
429  auto actions = _awh.getActions<TensorMechanicsAction>();
430  for (const auto & action : actions)
431  {
432  const auto size_before = _subdomain_id_union.size();
433  const auto added_size = action->_subdomain_ids.size();
434  _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
435  const auto size_after = _subdomain_id_union.size();
436 
437  if (size_after != size_before + added_size)
438  mooseError("The block restrictions in the TensorMechanics/Master actions must be "
439  "non-overlapping.");
440 
441  if (added_size == 0 && actions.size() > 1)
442  mooseError("No TensorMechanics/Master action can be block unrestricted if more than one "
443  "TensorMechanics/Master action is specified.");
444  }
445  }
446 }
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all TensorMechanics/Master action blocks ...

◆ actOutputGeneration()

void TensorMechanicsAction::actOutputGeneration ( )
protectedinherited

Definition at line 348 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

349 {
350  //
351  // Add variables (optional)
352  //
353  if (_current_task == "add_aux_variable")
354  {
355  // Loop through output aux variables
356  for (auto out : _generate_output)
357  {
358  // Create output helper aux variables
359  _problem->addAuxVariable(out,
360  FEType(Utility::string_to_enum<Order>("CONSTANT"),
361  Utility::string_to_enum<FEFamily>("MONOMIAL")),
362  _subdomain_id_union.empty() ? nullptr : &_subdomain_id_union);
363  }
364  }
365 
366  //
367  // Add output AuxKernels
368  //
369  else if (_current_task == "add_aux_kernel")
370  {
371  // Loop through output aux variables
372  for (auto out : _generate_output)
373  {
374  std::string type = "";
375  InputParameters params = emptyInputParameters();
376 
377  // RankTwoAux
378  for (const auto & r2a : _ranktwoaux_table)
379  for (unsigned int a = 0; a < 3; ++a)
380  for (unsigned int b = 0; b < 3; ++b)
381  if (r2a.first + '_' + _component_table[a] + _component_table[b] == out)
382  {
383  type = "RankTwoAux";
384  params = _factory.getValidParams(type);
385  params.set<MaterialPropertyName>("rank_two_tensor") = r2a.second;
386  params.set<unsigned int>("index_i") = a;
387  params.set<unsigned int>("index_j") = b;
388  }
389 
390  // RankTwoScalarAux
391  for (const auto & r2sa : _ranktwoscalaraux_table)
392  for (const auto & t : r2sa.second.second)
393  if (r2sa.first + '_' + t == out)
394  {
395  const auto r2a = _ranktwoaux_table.find(t);
396  if (r2a != _ranktwoaux_table.end())
397  {
398  type = "RankTwoScalarAux";
399  params = _factory.getValidParams(type);
400  params.set<MaterialPropertyName>("rank_two_tensor") = r2a->second;
401  params.set<MooseEnum>("scalar_type") = r2sa.second.first;
402  }
403  else
404  mooseError("Internal error. The permitted tensor shortcuts in "
405  "'_ranktwoscalaraux_table' must be keys in the '_ranktwoaux_table'.");
406  }
407 
408  if (type != "")
409  {
410  params.applyParameters(parameters());
411  params.set<AuxVariableName>("variable") = out;
412  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
413  _problem->addAuxKernel(type, out + '_' + name(), params);
414  }
415  else
416  mooseError("Unable to add output AuxKernel");
417  }
418  }
419 }
static const std::vector< char > _component_table
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _ranktwoscalaraux_table
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all TensorMechanics/Master action blocks ...
const std::string name
Definition: Setup.h:22
std::vector< std::string > _generate_output
output aux variables to generate for sclar stress/strain tensor quantities
static const std::map< std::string, std::string > _ranktwoaux_table
table data for output generation

◆ actSubdomainChecks()

void TensorMechanicsAction::actSubdomainChecks ( )
protectedinherited

Definition at line 315 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

316 {
317  //
318  // Do the coordinate system check only once the problem is created
319  //
320  if (_current_task == "setup_mesh_complete")
321  {
322  // get subdomain IDs
323  for (auto & name : _subdomain_names)
324  _subdomain_ids.insert(_mesh->getSubdomainID(name));
325  }
326 
327  if (_current_task == "validate_coordinate_systems")
328  {
329  // use either block restriction list or list of all subdomains in the mesh
330  const auto & check_subdomains =
331  _subdomain_ids.empty() ? _problem->mesh().meshSubdomains() : _subdomain_ids;
332  if (check_subdomains.empty())
333  mooseError("No subdomains found");
334 
335  // make sure all subdomains are using the same coordinate system
336  _coord_system = _problem->getCoordSystem(*check_subdomains.begin());
337  for (auto subdomain : check_subdomains)
338  if (_problem->getCoordSystem(subdomain) != _coord_system)
339  mooseError("The TensorMechanics action requires all subdomains to have the same coordinate "
340  "system.");
341 
342  if (_coord_system == Moose::COORD_RZ && _out_of_plane_direction != OutOfPlaneDirection::z)
343  paramError("out_of_plane_direction", "must be set to z for axisymmetric simulations.");
344  }
345 }
std::set< SubdomainID > _subdomain_ids
set generated from the passed in vector of subdomain names
const OutOfPlaneDirection _out_of_plane_direction
const std::string name
Definition: Setup.h:22
std::vector< SubdomainName > _subdomain_names
if this vector is not empty the variables, kernels and materials are restricted to these subdomains ...
Moose::CoordinateSystemType _coord_system

◆ getKernelParameters()

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

Definition at line 465 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

466 {
467  InputParameters params = _factory.getValidParams(type);
468  params.applyParameters(parameters(),
469  {"displacements", "use_displaced_mesh", "save_in", "diag_save_in"});
470 
471  params.set<std::vector<VariableName>>("displacements") = _coupled_displacements;
472  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
473 
474  return params;
475 }
std::vector< VariableName > _coupled_displacements
bool _use_displaced_mesh
use displaced mesh (true unless _strain is SMALL)

◆ getKernelType()

std::string TensorMechanicsAction::getKernelType ( )
protectedvirtualinherited

Reimplemented in DynamicTensorMechanicsAction.

Definition at line 449 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

450 {
451  std::map<Moose::CoordinateSystemType, std::string> type_map = {
452  {Moose::COORD_XYZ, "StressDivergenceTensors"},
453  {Moose::COORD_RZ, "StressDivergenceRZTensors"},
454  {Moose::COORD_RSPHERICAL, "StressDivergenceRSphericalTensors"}};
455 
456  // choose kernel type based on coordinate system
457  auto type_it = type_map.find(_coord_system);
458  if (type_it != type_map.end())
459  return type_it->second;
460  else
461  mooseError("Unsupported coordinate system");
462 }
Moose::CoordinateSystemType _coord_system

◆ outputPropertiesType()

MultiMooseEnum TensorMechanicsActionBase::outputPropertiesType ( )
staticinherited

Definition at line 128 of file TensorMechanicsActionBase.C.

Referenced by validParams< TensorMechanicsAction >(), and validParams< TensorMechanicsActionBase >().

129 {
130  std::string options = "";
131  for (auto & r2a : _ranktwoaux_table)
132  for (unsigned int a = 0; a < 3; ++a)
133  for (unsigned int b = 0; b < 3; ++b)
134  options += (options == "" ? "" : " ") + r2a.first + '_' + _component_table[a] +
135  _component_table[b];
136 
137  for (auto & r2sa : _ranktwoscalaraux_table)
138  for (auto & t : r2sa.second.second)
139  options += " " + r2sa.first + "_" + t;
140 
141  return MultiMooseEnum(options);
142 }
static const std::vector< char > _component_table
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _ranktwoscalaraux_table
static const std::map< std::string, std::string > _ranktwoaux_table
table data for output generation

Member Data Documentation

◆ _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<NonlinearVariableName> TensorMechanicsAction::_displacements
protectedinherited

displacement variables

Definition at line 36 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 95 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 29 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 32 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 42 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 55 of file TensorMechanicsAction.h.

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

◆ _subdomain_ids

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

set generated from the passed in vector of subdomain names

Definition at line 52 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 49 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actSubdomainChecks().

◆ _use_displaced_mesh

bool TensorMechanicsAction::_use_displaced_mesh
protectedinherited

use displaced mesh (true unless _strain is SMALL)

Definition at line 92 of file TensorMechanicsAction.h.

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


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