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...
 

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
 
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 17 of file PoroMechanicsAction.h.

Member Enumeration Documentation

enum TensorMechanicsAction::PlanarFormulation
strongprotectedinherited

use an out of plane stress/strain formulation

Enumerator
None 
PlaneStrain 
GeneralizedPlaneStrain 

Definition at line 71 of file TensorMechanicsAction.h.

72  {
73  None,
74  PlaneStrain,
76  /* PlaneStress */
enum TensorMechanicsAction::PlanarFormulation _planar_formulation
enum TensorMechanicsAction::Strain
strongprotectedinherited

strain formulation

Enumerator
Small 
Finite 

Definition at line 55 of file TensorMechanicsAction.h.

56  {
57  Small,
58  Finite
59  } _strain;
enum TensorMechanicsAction::Strain _strain
enum TensorMechanicsAction::StrainAndIncrement
strongprotectedinherited

strain formulation

Enumerator
SmallTotal 
FiniteTotal 
SmallIncremental 
FiniteIncremental 

Definition at line 62 of file TensorMechanicsAction.h.

63  {
64  SmallTotal,
65  FiniteTotal,
66  SmallIncremental,
67  FiniteIncremental
enum TensorMechanicsAction::StrainAndIncrement _strain_and_increment

Constructor & Destructor Documentation

PoroMechanicsAction::PoroMechanicsAction ( const InputParameters &  params)

Definition at line 23 of file PoroMechanicsAction.C.

24  : TensorMechanicsAction(params)
25 {
26 }
TensorMechanicsAction(const InputParameters &params)

Member Function Documentation

void PoroMechanicsAction::act ( )
virtual

Reimplemented from TensorMechanicsAction.

Definition at line 29 of file PoroMechanicsAction.C.

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

Definition at line 377 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

378 {
379  //
380  // Gather info about all other master actions when we add variables
381  //
382  if (_current_task == "validate_coordinate_systems" && getParam<bool>("add_variables"))
383  {
384  auto actions = _awh.getActions<TensorMechanicsAction>();
385  for (const auto & action : actions)
386  {
387  const auto size_before = _subdomain_id_union.size();
388  const auto added_size = action->_subdomain_ids.size();
389  _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
390  const auto size_after = _subdomain_id_union.size();
391 
392  if (size_after != size_before + added_size)
393  mooseError("The block restrictions in the TensorMechanics/Master actions must be "
394  "non-overlapping.");
395 
396  if (added_size == 0 && actions.size() > 1)
397  mooseError("No TensorMechanics/Master action can be block unrestricted if more than one "
398  "TensorMechanics/Master action is specified.");
399  }
400  }
401 }
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all TensorMechanics/Master action blocks ...
void TensorMechanicsAction::actOutputGeneration ( )
protectedinherited

Definition at line 303 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

304 {
305  //
306  // Add variables (optional)
307  //
308  if (_current_task == "add_aux_variable" && getParam<bool>("add_variables"))
309  {
310  // Loop through output aux variables
311  for (auto out : _generate_output)
312  {
313  // Create output helper aux variables
314  _problem->addAuxVariable(out,
315  FEType(Utility::string_to_enum<Order>("CONSTANT"),
316  Utility::string_to_enum<FEFamily>("MONOMIAL")),
317  _subdomain_id_union.empty() ? nullptr : &_subdomain_id_union);
318  }
319  }
320 
321  //
322  // Add output AuxKernels
323  //
324  else if (_current_task == "add_aux_kernel")
325  {
326  // Loop through output aux variables
327  for (auto out : _generate_output)
328  {
329  std::string type = "";
330  InputParameters params = emptyInputParameters();
331 
332  // RankTwoAux
333  for (const auto & r2a : _ranktwoaux_table)
334  for (unsigned int a = 0; a < 3; ++a)
335  for (unsigned int b = 0; b < 3; ++b)
336  if (r2a.first + '_' + _component_table[a] + _component_table[b] == out)
337  {
338  type = "RankTwoAux";
339  params = _factory.getValidParams(type);
340  params.set<MaterialPropertyName>("rank_two_tensor") = r2a.second;
341  params.set<unsigned int>("index_i") = a;
342  params.set<unsigned int>("index_j") = b;
343  }
344 
345  // RankTwoScalarAux
346  for (const auto & r2sa : _ranktwoscalaraux_table)
347  for (const auto & t : r2sa.second.second)
348  if (r2sa.first + '_' + t == out)
349  {
350  const auto r2a = _ranktwoaux_table.find(t);
351  if (r2a != _ranktwoaux_table.end())
352  {
353  type = "RankTwoScalarAux";
354  params = _factory.getValidParams(type);
355  params.set<MaterialPropertyName>("rank_two_tensor") = r2a->second;
356  params.set<MooseEnum>("scalar_type") = r2sa.second.first;
357  }
358  else
359  mooseError("Internal error. The permitted tensor shortcuts in "
360  "'_ranktwoscalaraux_table' must be keys in the '_ranktwoaux_table'.");
361  }
362 
363  if (type != "")
364  {
365  params.applyParameters(parameters());
366  params.set<AuxVariableName>("variable") = out;
367  params.set<MultiMooseEnum>("execute_on") = "timestep_end";
368  _problem->addAuxKernel(type, out + '_' + name(), params);
369  }
370  else
371  mooseError("Unable to add output AuxKernel");
372  }
373  }
374 }
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 ...
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
void TensorMechanicsAction::actSubdomainChecks ( )
protectedinherited

Definition at line 273 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

274 {
275  //
276  // Do the coordinate system check only once the problem is created
277  //
278  if (_current_task == "setup_mesh_complete")
279  {
280  // get subdomain IDs
281  for (auto & name : _subdomain_names)
282  _subdomain_ids.insert(_mesh->getSubdomainID(name));
283  }
284 
285  if (_current_task == "validate_coordinate_systems")
286  {
287  // use either block restriction list or list of all subdomains in the mesh
288  const auto & check_subdomains =
289  _subdomain_ids.empty() ? _problem->mesh().meshSubdomains() : _subdomain_ids;
290  if (check_subdomains.empty())
291  mooseError("No subdomains found");
292 
293  // make sure all subdomains are using the same coordinate system
294  _coord_system = _problem->getCoordSystem(*check_subdomains.begin());
295  for (auto subdomain : check_subdomains)
296  if (_problem->getCoordSystem(subdomain) != _coord_system)
297  mooseError("The TensorMechanics action requires all subdomains to have the same coordinate "
298  "system.");
299  }
300 }
std::set< SubdomainID > _subdomain_ids
set generated from the passed in vector of subdomain names
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
InputParameters TensorMechanicsAction::getKernelParameters ( std::string  type)
protectedvirtualinherited

Definition at line 420 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

421 {
422  InputParameters params = _factory.getValidParams(type);
423  params.applyParameters(parameters(),
424  {"displacements", "use_displaced_mesh", "save_in", "diag_save_in"});
425 
426  params.set<std::vector<VariableName>>("displacements") = _coupled_displacements;
427  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
428 
429  return params;
430 }
std::vector< VariableName > _coupled_displacements
bool _use_displaced_mesh
use displaced mesh (true unless _strain is SMALL)
std::string TensorMechanicsAction::getKernelType ( )
protectedvirtualinherited

Reimplemented in DynamicTensorMechanicsAction.

Definition at line 404 of file TensorMechanicsAction.C.

Referenced by TensorMechanicsAction::act().

405 {
406  std::map<Moose::CoordinateSystemType, std::string> type_map = {
407  {Moose::COORD_XYZ, "StressDivergenceTensors"},
408  {Moose::COORD_RZ, "StressDivergenceRZTensors"},
409  {Moose::COORD_RSPHERICAL, "StressDivergenceRSphericalTensors"}};
410 
411  // choose kernel type based on coordinate system
412  auto type_it = type_map.find(_coord_system);
413  if (type_it != type_map.end())
414  return type_it->second;
415  else
416  mooseError("Unsupported coordinate system");
417 }
Moose::CoordinateSystemType _coord_system
MultiMooseEnum TensorMechanicsActionBase::outputPropertiesType ( )
staticinherited

Definition at line 117 of file TensorMechanicsActionBase.C.

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

118 {
119  std::string options = "";
120  for (auto & r2a : _ranktwoaux_table)
121  for (unsigned int a = 0; a < 3; ++a)
122  for (unsigned int b = 0; b < 3; ++b)
123  options += (options == "" ? "" : " ") + r2a.first + '_' + _component_table[a] +
124  _component_table[b];
125 
126  for (auto & r2sa : _ranktwoscalaraux_table)
127  for (auto & t : r2sa.second.second)
128  options += " " + r2sa.first + "_" + t;
129 
130  return MultiMooseEnum(options);
131 }
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

const std::vector< char > TensorMechanicsActionBase::_component_table = {'x', 'y', 'z'}
staticinherited
Moose::CoordinateSystemType TensorMechanicsAction::_coord_system
protectedinherited
std::vector<VariableName> TensorMechanicsAction::_coupled_displacements
protectedinherited
std::vector<AuxVariableName> TensorMechanicsAction::_diag_save_in
protectedinherited
std::vector<NonlinearVariableName> TensorMechanicsAction::_displacements
protectedinherited

displacement variables

Definition at line 33 of file TensorMechanicsAction.h.

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

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

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

Definition at line 83 of file TensorMechanicsAction.h.

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

unsigned int TensorMechanicsAction::_ndisp
protectedinherited
enum TensorMechanicsAction::PlanarFormulation TensorMechanicsAction::_planar_formulation
protectedinherited
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 26 of file TensorMechanicsActionBase.h.

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

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"}}},
{"effective", {"EffectiveStrain", {"plastic_strain", "creep_strain"}}},
{"firstinv", {"FirstInvariant", {"stress", "strain"}}},
{"secondinv", {"SecondInvariant", {"stress", "strain"}}},
{"thirdinv", {"ThirdInvariant", {"stress", "strain"}}}}

Definition at line 29 of file TensorMechanicsActionBase.h.

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

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

residual debugging

Definition at line 39 of file TensorMechanicsAction.h.

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

enum TensorMechanicsAction::Strain TensorMechanicsAction::_strain
protectedinherited
enum TensorMechanicsAction::StrainAndIncrement TensorMechanicsAction::_strain_and_increment
protectedinherited
std::set<SubdomainID> TensorMechanicsAction::_subdomain_id_union
protectedinherited

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

Definition at line 52 of file TensorMechanicsAction.h.

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

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

set generated from the passed in vector of subdomain names

Definition at line 49 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actSubdomainChecks().

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 46 of file TensorMechanicsAction.h.

Referenced by TensorMechanicsAction::actSubdomainChecks().

bool TensorMechanicsAction::_use_displaced_mesh
protectedinherited

use displaced mesh (true unless _strain is SMALL)

Definition at line 80 of file TensorMechanicsAction.h.

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


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