https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TorchScriptMaterial.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#ifdef MOOSE_LIBTORCH_ENABLED
11
12#pragma once
13
14#include "Material.h"
16
22{
23public:
25
27
28protected:
29 virtual void initQpStatefulProperties() override;
30 virtual void computeQpProperties() override;
31
33 const std::vector<std::string> _prop_names;
34
36 const unsigned int _num_props;
37
39 const std::vector<PostprocessorName> _input_names;
40
42 const unsigned int _num_inputs;
43
46 std::vector<const PostprocessorValue *> _module_inputs;
47
49 std::vector<GenericMaterialProperty<Real, false> *> _properties;
50
53
55 torch::Tensor _input_tensor;
56
57private:
62 void computeQpValues();
63};
64
65#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Materials compute MaterialProperties.
Definition Material.h:36
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
This material declares properties which are evaluated as based on a torch script neural network.
void computeQpValues()
A helper method for evaluating the torch script module and populating the material properties.
static InputParameters validParams()
torch::Tensor _input_tensor
Place holder for the inputs to the neural network.
const unsigned int _num_inputs
Number of inputs to the neural net.
const TorchScriptUserObject & _torch_script_userobject
The user object that holds the torch module.
const std::vector< PostprocessorName > _input_names
The functions to use for each property.
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
const unsigned int _num_props
Number of properties that will be defined.
const std::vector< std::string > _prop_names
Names of the material properties to define.
virtual void computeQpProperties() override
Users must override this method.
std::vector< const PostprocessorValue * > _module_inputs
The module input parameters stored as postprocessor values.
std::vector< GenericMaterialProperty< Real, false > * > _properties
Vector of all the properties, for now we don't support AD.
A user object the loads a torch module using the torch script format and just-in-time compilation.