Line data Source code
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 : // MOOSE includes 13 : #include "GeneralUserObject.h" 14 : #include "MappingInterface.h" 15 : #include "SurrogateModelInterface.h" 16 : #include "SurrogateModel.h" 17 : 18 : /** 19 : * A user object which takes a surrogate (or just user supplied values) 20 : * to determine coordinates in a latent space and uses those coordinates 21 : * to create approximations of full solution values for given variables. 22 : */ 23 : class InverseMapping : public GeneralUserObject, 24 : public MappingInterface, 25 : public SurrogateModelInterface 26 : { 27 : public: 28 : static InputParameters validParams(); 29 : 30 : InverseMapping(const InputParameters & params); 31 : 32 : void execute() override; 33 60 : void initialize() override {} 34 60 : void finalize() override {} 35 : 36 : void initialSetup() override; 37 : 38 : protected: 39 : /// The names of the variables which serve as a container 40 : /// for the reconstructed solution 41 : const std::vector<VariableName> & _var_names_to_fill; 42 : 43 : /// The names of the variables in the nonlinear system whose reconstruction 44 : /// we are working on 45 : const std::vector<VariableName> & _var_names_to_reconstruct; 46 : 47 : /// The names of the surrogate models for each variable 48 : const std::vector<UserObjectName> & _surrogate_model_names; 49 : 50 : /// Links to the MooseVariables of the requested variables 51 : std::vector<MooseVariableFieldBase *> _variable_to_fill; 52 : 53 : /// Links to the MooseVariables from the nonlinear system whose dof numbering 54 : /// we need to populate the variables in (variables_to_fill) 55 : std::vector<MooseVariableFieldBase *> _variable_to_reconstruct; 56 : 57 : /// Link to the mapping object which provides the inverse mapping function 58 : VariableMappingBase * _mapping; 59 : 60 : /// Links to the surrogate models which provide functions to determine the 61 : /// coordinates in the latent space 62 : std::vector<SurrogateModel *> _surrogate_models; 63 : 64 : /// Input parameters for the surrogate models. If no surrogates are given, 65 : /// we assume that these are the coordinates in the latent space 66 : const std::vector<Real> & _input_parameters; 67 : };