https://mooseframework.inl.gov
MOOSEQuantityToNEML2.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 "MOOSEToNEML2.h"
13 #include "NEML2Utils.h"
14 #include "ElementUserObject.h"
15 
16 #include "RankTwoTensor.h"
17 #include "SymmetricRankTwoTensor.h"
18 
22 template <typename T, unsigned int state>
24 {
25 public:
27 
28  MOOSEQuantityToNEML2(const InputParameters & params);
29 
30 #ifndef NEML2_ENABLED
31  void initialize() override {}
32  void execute() override {}
33  void finalize() override {}
34  void threadJoin(const UserObject &) override {}
35 #else
36  void initialize() override;
37  void execute() override;
38  void finalize() override {}
39  void threadJoin(const UserObject &) override;
40 
41  neml2::Tensor gatheredData() const override;
42 
43 protected:
44  T qpData(unsigned int) const;
45 
48 
51  const VariableValue * _var_scalar = nullptr;
52  const VariableValue * _var_scalar_old = nullptr;
53  const Function * _func = nullptr;
54  const MaterialProperty<T> * _mat_prop = nullptr;
56  const VariableValue * _var = nullptr;
57  const VariableValue * _var_old = nullptr;
59 
61  bool _batched = false;
62 
64  std::vector<T> _buffer;
65 #endif
66 };
67 
68 #define defineMOOSEQuantityToNEML2(T) \
69  using MOOSE##T##ToNEML2 = MOOSEQuantityToNEML2<T, 0>; \
70  using MOOSEOld##T##ToNEML2 = MOOSEQuantityToNEML2<T, 1>
75 #undef defineMOOSEQuantityToNEML2
const MaterialProperty< T > * _mat_prop
Base class for function objects.
Definition: Function.h:29
MOOSEQuantityToNEML2(const InputParameters &params)
const VariableValue * _var
Gather a MOOSE quantity for insertion into the NEML2 model.
bool _batched
Whether the gathered data should be batched.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
defineMOOSEQuantityToNEML2(Real)
void execute() override
Execute method.
void threadJoin(const UserObject &) override
Must override.
const VariableValue * _var_old
neml2::Tensor gatheredData() const override
Convert data gathered from MOOSE into neml2::Tensor.
const VariableValue * _var_scalar
void finalize() override
Finalize.
const NEML2Utils::MOOSEIOType _type
MOOSE quantity type to read from.
T qpData(unsigned int) const
static InputParameters validParams()
forward declarations
const VariableValue * _var_scalar_old
Common interface for inserting gathered MOOSE data into the NEML2 material model. ...
Definition: MOOSEToNEML2.h:28
std::vector< T > _buffer
Intermediate data buffer, filled during the element loop.
void initialize() override
Called before execute() is ever called so that data can be cleared.
const MaterialProperty< T > * _mat_prop_old
Base class for user-specific data.
Definition: UserObject.h:19