13#include <ATen/ops/from_blob.h>
28 "This user object gathers the JxWxT values from all elements in the assembly and "
29 "provides them as a neml2 tensor. This is useful for assembling NEML2 models that "
30 "require the JxWxT values for each element.");
64 "NEML2Assembly becomes out of sync with other thread");
70 mooseAssert(
_nqp == other._nqp,
71 "The number of quadrature points per element must be the same in all threads.");
86 mooseError(
"All elements must have the same number of quadrature points per element for all "
98 TIME_SECTION(
"finalize", 1,
"Updating FEM assembly for NEML2");
110 neml2::Tensor(at::from_blob(
_moose_JxWxT.data(), {_nelem, _nqp}, torch::kFloat64), 2)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
registerMooseObject("MooseApp", NEML2Assembly)
static InputParameters validParams()
const MooseArray< Real > & _coord
const MooseArray< Real > & _JxW
const MooseArray< Point > & _q_point
A MultiMooseEnum object to hold "execute_on" flags.
torch::DeviceType getLibtorchDevice() const
Get the device torch is supposed to be running on.
unsigned int size() const
The number of elements that can currently be stored in the array.
MooseApp & _app
The MOOSE application this is associated with.
This user object caches assembly information from MOOSE.
void finalize() override
Finalize.
void execute() override
Execute method.
void initialize() override
Called before execute() is ever called so that data can be cleared.
std::vector< Real > _moose_JxWxT
JxWxT (product of Jacobian determinant, quadrature weight, and coordinate transformation factor) for ...
void invalidate()
Invalidate the cached assembly information.
bool _up_to_date
Whether the current assembly cache is up to date.
static InputParameters validParams()
int64_t _nqp
number of quadrature points per element
int64_t _nelem
number of elements on this rank
void threadJoin(const UserObject &) override
Must override.
neml2::Tensor _neml2_JxWxT
NEML2Assembly(const InputParameters ¶meters)
Base class for user-specific data.
ExecFlagEnum getDefaultExecFlagEnum()
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
auto index_range(const T &sizable)