Loading...
Searching...
No Matches
ReducedSteadyNS.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 reducedSteadyNS
26Description
27 A reduced problem for the stationary NS equations
28SourceFiles
29 reducedSteadyNS.C
30\*---------------------------------------------------------------------------*/
31
36
37#ifndef ReducedSteadyNS_H
38#define ReducedSteadyNS_H
39
40#include "fvCFD.H"
41#include "IOmanip.H"
42#include "ReducedProblem.H"
43#include "steadyNS.H"
44#include "ITHACAutilities.H"
45#include "EigenFunctions.H"
46#include <Eigen/Eigen>
47#include <unsupported/Eigen/NonLinearOptimization>
48#include <unsupported/Eigen/NumericalDiff>
49
51struct newton_steadyNS: public newton_argument<double>
52{
53 public:
55
56 newton_steadyNS(int Nx, int Ny,
57 steadyNS& problem): newton_argument<double>(Nx,
58 Ny),
60 Nphi_u(problem.NUmodes + problem.liftfield.size() + problem.NSUPmodes),
61 Nphi_p(problem.NPmodes),
62 N_BC(problem.inletIndex.rows())
63 {}
64
65 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
66 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
67
69 int Nphi_u;
70 int Nphi_p;
71 int N_BC;
72 scalar nu;
73 Eigen::MatrixXd tauU;
74 Eigen::VectorXd BC;
75};
76
77
78/*---------------------------------------------------------------------------*\
79 Class reducedProblem Declaration
80\*---------------------------------------------------------------------------*/
81
83
86{
87 private:
88
89 public:
90 // Constructors
93
100
102
105
107 Eigen::MatrixXd vel_now;
108
110 Eigen::MatrixXd fTau;
111
113 Eigen::MatrixXd fN;
114
116 Eigen::VectorXd y_old;
117
119 Eigen::VectorXd y;
120
122 scalar nu;
123
125 List < Eigen::MatrixXd> online_solution;
126
128 PtrList<volVectorField> Umodes;
129
131 PtrList<volScalarField> Pmodes;
132
134 PtrList<volVectorField> Usnapshots;
135
137 PtrList<volScalarField> Psnapshots;
138
140 PtrList<volScalarField> PREC;
141
143 PtrList<volVectorField> UREC;
144
146 PtrList<volScalarField> pRecFields;
147
149 PtrList<volVectorField> uRecFields;
150
153
156
159
162
165
167 int N_BC;
168
171
173 Eigen::MatrixXd tauU;
174
175 // Functions
176
183 void solveOnline_PPE(Eigen::MatrixXd vel_now);
184
192 void solveOnline_sup(Eigen::MatrixXd vel_now);
193
200 void reconstruct_PPE(fileName folder = "./ITHACAoutput/online_rec",
201 int printevery = 1);
202
203
211 void reconstruct(bool exportFields = false,
212 fileName folder = "./ITHACAoutput/online_rec",
213 int printevery = 1);
214
220 void reconstructLiftAndDrag(steadyNS& problem, fileName folder);
221
225 double inf_sup_constant();
226
234 Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel);
235
236};
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240
241
242#endif
243
244
245
246
247
248
Header file of the EigenFunctions class.
Header file of the ITHACAutilities namespace.
Header file of the reducedProblem class.
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
reducedProblem()
Construct Null.
PtrList< volScalarField > PREC
Reconstructed pressure field.
int Nphi_sup
Number of supremizer modes.
Eigen::VectorXd y
Vector to store the solution during the Newton procedure.
ITHACAparameters * para
parameters to be read from the ITHACAdict file
Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel)
Sets the online velocity.
void solveOnline_sup(Eigen::MatrixXd vel_now)
Method to perform an online solve using a supremizer stabilisation method.
Eigen::MatrixXd fTau
Reduced matrix for tangent forces.
PtrList< volScalarField > Pmodes
List of pointers to store the modes for pressure.
List< Eigen::MatrixXd > online_solution
List of Eigen matrices to store the online solution.
int Nphi_p
Number of pressure modes.
Eigen::VectorXd y_old
Vector to store the previous solution during the Newton procedure.
scalar nu
Reduced viscosity in case of parametrized viscosity.
Eigen::MatrixXd tauU
Penalty Factor.
void reconstructLiftAndDrag(steadyNS &problem, fileName folder)
Method to compute the reduced order forces.
void solveOnline_PPE(Eigen::MatrixXd vel_now)
Method to perform an online solve using a PPE stabilisation method.
PtrList< volScalarField > pRecFields
Reconstructed pressure fields list.
steadyNS * problem
Pointer to the FOM problem.
int count_online_solve
Counter to count the online solutions.
reducedSteadyNS()
Construct Null.
Eigen::MatrixXd vel_now
Online inlet velocity vector.
Eigen::MatrixXd fN
Reduced matrix for normal forces.
PtrList< volScalarField > Psnapshots
List of pointers to store the snapshots for pressure.
PtrList< volVectorField > Usnapshots
List of pointers to store the snapshots for velocity.
PtrList< volVectorField > Umodes
List of pointers to store the modes for velocity.
PtrList< volVectorField > uRecFields
Recontructed velocity fields list.
int N_BC
Number of parametrized boundary conditions.
PtrList< volVectorField > UREC
Recontructed velocity field.
void reconstruct_PPE(fileName folder="./ITHACAoutput/online_rec", int printevery=1)
Method to reconstruct a solution from an online solve with a PPE stabilisation technique.
double inf_sup_constant()
Method to evaluate the online inf-sup constant.
int Nphi_u
Number of velocity modes.
void reconstruct(bool exportFields=false, fileName folder="./ITHACAoutput/online_rec", int printevery=1)
Method to reconstruct the solutions from an online solve.
newton_steadyNS newton_object
Newton object used to solve the non linear problem.
Implementation of a parametrized full order steady NS problem and preparation of the the reduced ma...
Definition steadyNS.H:70
Header file of the steadyNS class.
Structure to implement a newton object for a stationary NS problem.
Eigen::MatrixXd tauU
Eigen::VectorXd BC
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
newton_steadyNS(int Nx, int Ny, steadyNS &problem)