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 "SamplerFullSolveMultiApp.h" 14 : #include "PODReducedBasisTrainer.h" 15 : #include "SamplerInterface.h" 16 : #include "SurrogateModelInterface.h" 17 : 18 : #include "StochasticToolsTypes.h" 19 : 20 : class PODSamplerSolutionTransfer; 21 : class PODResidualTransfer; 22 : 23 : class PODFullSolveMultiApp : public SamplerFullSolveMultiApp, SurrogateModelInterface 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : PODFullSolveMultiApp(const InputParameters & parameters); 29 : 30 : virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) override; 31 : 32 : /// Overriding preTransfer to reinit the subappliations if the object needs to be 33 : /// executed twice. 34 : virtual void preTransfer(Real dt, Real target_time) override; 35 : 36 : /// Returning the value of the snapshot generation flag. 37 0 : bool snapshotGeneration() { return _snapshot_generation; } 38 : 39 : protected: 40 : /// Returning pointers to the solution transfers. Used in batch mode. 41 : std::vector<std::shared_ptr<PODSamplerSolutionTransfer>> 42 : getActiveSolutionTransfers(Transfer::DIRECTION direction); 43 : 44 : /// Returning pointers to the solution transfers. Used in batch mode. 45 : std::vector<std::shared_ptr<PODResidualTransfer>> 46 : getActiveResidualTransfers(Transfer::DIRECTION direction); 47 : 48 : /// Evaluating the residuals for every tag in the trainer. 49 : void computeResidual(); 50 : 51 : /// Evaluating the residuals for every tag in the trainer in batch mode. 52 : void computeResidualBatch(Real target_time); 53 : 54 : /// Pointer to the trainer object itself. 55 : PODReducedBasisTrainer & _trainer; 56 : 57 : /// Switch used to differentiate between snapshot generation and residual 58 : /// computation. Residual generation is only possible after the snapshot generation 59 : /// part is complete. 60 : bool _snapshot_generation; 61 : 62 : private: 63 : };