https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
16
17class MooseMesh;
18namespace libMesh
19{
20class Elem;
21class MeshBase;
22}
23
28 public BlockRestrictable,
29 public TaggingInterface
30{
31public:
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 virtual void timestepSetup() override;
91
92 virtual void initialize() override final;
93 virtual void execute() override;
94 virtual void finalize() override final {}
95
97 const std::vector<const MooseVariableFieldBase *> & getVariables() const { return _variables; }
98 const std::vector<const MooseVariableFieldBase *> & getAuxVariables() const
99 {
100 return _aux_variables;
101 }
102
103 const uel_t & getPlugin() const { return _uel; }
104
105protected:
107 void setupElemRange();
108
110 FileName _plugin;
111
114
116 const uel_t _uel;
117
120
123
125 const unsigned int _dim;
126
128 std::vector<NonlinearVariableName> _variable_names;
129
131 std::vector<AuxVariableName> _aux_variable_names;
132
134 std::vector<const MooseVariableFieldBase *> _variables;
135
137 std::vector<const MooseVariableFieldBase *> _aux_variables;
138
140 const std::set<SubdomainID> _sub_ids;
141
143 std::unique_ptr<ConstElemRange> _elem_range;
144
146 std::vector<Real> _props;
148
151 std::array<std::map<dof_id_type, std::vector<Real>>, 2> _statev;
153 std::size_t _statev_index_old;
155
157 const int _jtype;
158
159 friend class UELThread;
160};
This user-object is a testbed for implementing a custom element.
std::vector< const MooseVariableFieldBase * > _aux_variables
pointers to the auxiliary variable objects
static InputParameters validParams()
std::size_t _statev_index_old
virtual void initialSetup() override
std::vector< NonlinearVariableName > _variable_names
coupled variables to provide the DOF values
std::vector< Real > _props
props
const int _jtype
Abaqus element type.
std::vector< AuxVariableName > _aux_variable_names
Auxiliary variable names.
virtual void initialize() override final
const std::set< SubdomainID > _sub_ids
The subdomain ids this object operates on.
virtual void finalize() override final
const libMesh::MeshBase & _mesh
The libMesh mesh that this object acts on.
std::unique_ptr< ConstElemRange > _elem_range
All the active and elements local to this process that exist on this object's subdomains.
std::size_t _statev_index_current
const uel_t & getPlugin() const
std::array< std::map< dof_id_type, std::vector< Real > >, 2 > _statev
int _nstatev
stateful data
virtual void timestepSetup() override
DynamicLibraryLoader _library
The plugin library wrapper.
virtual void execute() override
const std::vector< const MooseVariableFieldBase * > & getVariables() const
getters for the loop class
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
FileName _plugin
The plugin file name.
std::vector< const MooseVariableFieldBase * > _variables
pointers to the variable objects
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
virtual void meshChanged() override
const std::vector< const MooseVariableFieldBase * > & getAuxVariables() const
void setupElemRange()
setup the range of elements this object operates on
const uel_t _uel
Function pointer to the dynamically loaded function.
Wrapper class to facilitate loading and lifetime management of dynamic libraries and obtaining pointe...
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...