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 newton_steadyNS(int Nx, int Ny,
56 steadyNS& problem): newton_argument<double>(Nx,
57 Ny),
59 Nphi_u(problem.NUmodes + problem.liftfield.size() + problem.NSUPmodes),
60 Nphi_p(problem.NPmodes),
61 N_BC(problem.inletIndex.rows())
62 {}
63
64 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
65 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
66
68 int Nphi_u;
69 int Nphi_p;
70 int N_BC;
71 scalar nu;
72 Eigen::MatrixXd tauU;
73 Eigen::VectorXd BC;
74};
75
76
77/*---------------------------------------------------------------------------*\
78 Class reducedProblem Declaration
79\*---------------------------------------------------------------------------*/
80
82
85{
86 private:
87
88 public:
89 // Constructors
92
99
101
104
106 Eigen::MatrixXd vel_now;
107
109 Eigen::MatrixXd fTau;
110
112 Eigen::MatrixXd fN;
113
115 Eigen::VectorXd y_old;
116
118 Eigen::VectorXd y;
119
121 scalar nu;
122
124 List < Eigen::MatrixXd> online_solution;
125
127 PtrList<volVectorField> Umodes;
128
130 PtrList<volScalarField> Pmodes;
131
133 PtrList<volVectorField> Usnapshots;
134
136 PtrList<volScalarField> Psnapshots;
137
139 PtrList<volScalarField> PREC;
140
142 PtrList<volVectorField> UREC;
143
145 PtrList<volScalarField> pRecFields;
146
148 PtrList<volVectorField> uRecFields;
149
152
155
158
161
164
166 int N_BC;
167
170
172 Eigen::MatrixXd tauU;
173
174 // Functions
175
182 void solveOnline_PPE(Eigen::MatrixXd vel_now);
183
191 void solveOnline_sup(Eigen::MatrixXd vel_now);
192
199 void reconstruct_PPE(fileName folder = "./ITHACAoutput/online_rec",
200 int printevery = 1);
201
202
210 void reconstruct(bool exportFields = false,
211 fileName folder = "./ITHACAoutput/online_rec",
212 int printevery = 1);
213
219 void reconstructLiftAndDrag(steadyNS& problem, fileName folder);
220
224 double inf_sup_constant();
225
233 Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel);
234
235};
236
237// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238
239
240
241#endif
242
243
244
245
246
247
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...
Template object created to solve non linear problems using the Eigen library.
Base class for the implementation of a reduced problem.
Class where it is implemented a reduced problem for the steady Navier-stokes problem.
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)