/*---------------------------------------------------------------------------*\ ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗ ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║ ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║ ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝ ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ * In real Time Highly Advanced Computational Applications for Finite Volumes * Copyright (C) 2017 by the ITHACA-FV authors ------------------------------------------------------------------------------- License This file is part of ITHACA-FV ITHACA-FV is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ITHACA-FV is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with ITHACA-FV. If not, see . Description Example of the reconstruction of a non-linear function using the HyperReduction SourceFiles 24HyperReduction.C \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "fvOptions.H" #include "simpleControl.H" #include "simpleControl.H" #include "fvMeshSubset.H" #include "ITHACAutilities.H" #include "Foam2Eigen.H" #include "ITHACAstream.H" #include "ITHACAPOD.H" #include "hyperReduction.templates.H" #include class HyperReduction_function : public HyperReduction & > { public: using HyperReduction::HyperReduction; static volScalarField evaluate_expression(volScalarField& S, Eigen::MatrixXd mu) { volScalarField yPos = S.mesh().C().component(vector::Y).ref(); volScalarField xPos = S.mesh().C().component(vector::X).ref(); for (auto i = 0; i < S.size(); i++) { S[i] = std::exp(- 2 * std::pow(xPos[i] - mu(0) - 1, 2) - 2 * std::pow(yPos[i] - mu(1) - 0.5, 2)); } return S; } static Eigen::VectorXd evaluate_expression(volScalarField& S, Eigen::MatrixXd mu, List