https://mooseframework.inl.gov
AbaqusUserElement.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "GeneralUserObject.h"
13 #include "BlockRestrictable.h"
14 #include "TaggingInterface.h"
15 #include "DynamicLibraryLoader.h"
16 
17 class MooseMesh;
18 namespace libMesh
19 {
20 class Elem;
21 class MeshBase;
22 }
23 
28  public BlockRestrictable,
29  public TaggingInterface
30 {
31 public:
33  typedef void (*uel_t)(
34  Real RHS[], // (MLVARX,*) Residual vector contribution for the current element
35  Real AMATRX[], // (NDOFEL,NDOFEL) Jacobian contribution for the current element
36  Real SVARS[], // (NSVARS) Persistent state variable values for the current element
37  Real ENERGY[], // (8) Energy quantities at the start of the current
38  // increment (to be updated by the UEL routine)
39  int * NDOFEL, // Number of degrees of freedom (DOFs) for the current element
40  int * NRHS, // NRHS=1: RHS should contain the residual vector,
41  // NRHS=2: not implemented (modified Riks static procedure)
42  int * NSVARS, // Number of persistent state variables for the element
43  Real PROPS[], // (NPROPS) Static property values (parameters) defined for use with this
44  // element.
45  int * NPROPS, //
46  Real COORDS[], // (MCRD,NNODE) Undisplaced coordinates of the element nodes
47  // COORDS(K1,K2) is the K1th coordinate of the
48  // K2th node of the element
49  int * MCRD, // Maximum number of coordinates needed at any node point (COORDINATES keyword -
50  // unsupported)
51  int * NNODE, // Number of nodes in the current element
52  Real U[], // (NDOFEL) Total values of the variables
53  Real DU[], // (MLVARX,*) Incremental values of the variables for the current increment
54  // for right-hand-side
55  Real V[], // (NDOFEL) Time rate of change of the variables (velocities,
56  // rates of rotation). Defined for implicit dynamics only (LFLAGS(1)
57  // 11 or 12)
58  Real A[], // (NDOFEL) Accelerations of the variables. Defined for implicit dynamics
59  // only (LFLAGS(1) 11 or 12).
60  int * JTYPE, // Integer defining the element type. This is the user-defined integer value n in
61  // element type Un
62  Real TIME[], // (2) step time and total time
63  Real * DTIME, // Time increment
64  int * KSTEP, // Step number (as per Abaqus definition) can be set by the user
65  int * KINC, // Increment number (MOOSE time step)
66  int * JELEM, // User-defined element number
67  Real PRAMS[], // (*) parameters associated with the solution procedure
68  int * NDLOAD, // Number of applied loads to the element (unused)
69  int JDLTYP[], // (MDLOAD, *) array containing the integers used to define distributed load
70  // types for the element
71  Real ADLMAG[], // (MDLOAD,*)
72  Real PREDEF[], // (2,NPREDF,NNODE) predefined field variables, such as temperature in an
73  // uncoupled stress/displacement analysis
74  int * NPREDF, // Number of predefined field (auxiliary) variables, including temperature
75  int LFLAGS[], // (*) flags that define the current solution procedure
76  int * MLVARX, // used when several displacement or right-hand-side vectors are used
77  Real DDLMAG[], // (MDLOAD,*)
78  int * MDLOAD, // Total number of distributed loads and/or fluxes defined on this element
79  Real * PNEWDT, // Recommended new timestep (unused)
80  int JPROPS[], // (NJPROP) NJPROP integer property values defined for the current element
81  int * NJPROP, // Number of user defined integer properties
82  Real * PERIOD // Current step time period (unused)
83  );
84 
86  AbaqusUserElement(const InputParameters & params);
87 
88  virtual void initialSetup() override;
89  virtual void meshChanged() override;
90 
91  virtual void initialize() override final;
92  virtual void execute() override;
93  virtual void finalize() override final {}
94 
96  const std::vector<const MooseVariableFieldBase *> & getVariables() const { return _variables; }
97  const std::vector<const MooseVariableFieldBase *> & getAuxVariables() const
98  {
99  return _aux_variables;
100  }
101 
102  const uel_t & getPlugin() const { return _uel; }
103 
104 protected:
106  void setupElemRange();
107 
109  FileName _plugin;
110 
113 
115  const uel_t _uel;
116 
119 
122 
124  const unsigned int _dim;
125 
127  std::vector<NonlinearVariableName> _variable_names;
128 
130  std::vector<AuxVariableName> _aux_variable_names;
131 
133  std::vector<const MooseVariableFieldBase *> _variables;
134 
136  std::vector<const MooseVariableFieldBase *> _aux_variables;
137 
139  const std::set<SubdomainID> _sub_ids;
140 
142  std::unique_ptr<ConstElemRange> _elem_range;
143 
145  std::vector<Real> _props;
146  int _nprops;
147 
149  int _nstatev;
150  std::array<std::map<dof_id_type, std::vector<Real>>, 2> _statev;
152  std::size_t _statev_index_old;
153 
155  const int _jtype;
156 
157  friend class UELThread;
158 };
std::array< std::map< dof_id_type, std::vector< Real > >, 2 > _statev
std::vector< NonlinearVariableName > _variable_names
coupled variables to provide the DOF values
virtual void initialSetup() override
int _nstatev
stateful data
const uel_t _uel
Function pointer to the dynamically loaded function.
virtual void execute() override
const uel_t & getPlugin() const
const libMesh::MeshBase & _mesh
The libMesh mesh that this object acts on.
virtual void initialize() override final
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
virtual void meshChanged() override
std::size_t _statev_index_current
std::unique_ptr< ConstElemRange > _elem_range
All the active and elements local to this process that exist on this object&#39;s subdomains.
std::vector< AuxVariableName > _aux_variable_names
Auxiliary variable names.
const std::vector< const MooseVariableFieldBase * > & getVariables() const
getters for the loop class
const std::set< SubdomainID > _sub_ids
The subdomain ids this object operates on.
AbaqusUserElement(const InputParameters &params)
std::vector< Real > _props
props
This user-object is a testbed for implementing a custom element.
const std::vector< const MooseVariableFieldBase * > & getAuxVariables() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const int _jtype
Abaqus element type.
void setupElemRange()
setup the range of elements this object operates on
FileName _plugin
The plugin file name.
class infix_ostream_iterator if void
static InputParameters validParams()
DynamicLibraryLoader _library
The plugin library wrapper.
std::size_t _statev_index_old
virtual void finalize() override final
void(* uel_t)(Real RHS[], Real AMATRX[], Real SVARS[], Real ENERGY[], int *NDOFEL, int *NRHS, int *NSVARS, Real PROPS[], int *NPROPS, Real COORDS[], int *MCRD, int *NNODE, Real U[], Real DU[], Real V[], Real A[], int *JTYPE, Real TIME[], Real *DTIME, int *KSTEP, int *KINC, int *JELEM, Real PRAMS[], int *NDLOAD, int JDLTYP[], Real ADLMAG[], Real PREDEF[], int *NPREDF, int LFLAGS[], int *MLVARX, Real DDLMAG[], int *MDLOAD, Real *PNEWDT, int JPROPS[], int *NJPROP, Real *PERIOD)
function type for the external UMAT function
Wrapper class to facilitate loading and lifetime management of dynamic libraries and obtaining pointe...
std::vector< const MooseVariableFieldBase * > _variables
pointers to the variable objects
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
std::vector< const MooseVariableFieldBase * > _aux_variables
pointers to the auxiliary variable objects