Loading...
Searching...
No Matches
ReducedUnsteadyNS.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 reducedProblem
26Description
27 A reduced problem for the unsteady NS equations
28SourceFiles
29 reducedUnsteadyNS.C
30\*---------------------------------------------------------------------------*/
31
36
37#ifndef ReducedUnsteadyNS_H
38#define ReducedUnsteadyNS_H
39
40#include "fvCFD.H"
41#include "IOmanip.H"
42#include "ReducedSteadyNS.H"
43#include "unsteadyNS.H"
44#include <Eigen/Dense>
45#include <unsupported/Eigen/NonLinearOptimization>
46#include <unsupported/Eigen/NumericalDiff>
47
50{
51 public:
53
54 newton_unsteadyNS_sup(int Nx, int Ny,
55 unsteadyNS& problem): newton_argument<double>(Nx, Ny),
57 Nphi_u(problem.NUmodes + problem.liftfield.size() + problem.NSUPmodes),
58 Nphi_p(problem.NPmodes),
59 N_BC(problem.inletIndex.rows())
60 {}
61
62 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
63 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
64
66 int Nphi_u;
67 int Nphi_p;
68 int N_BC;
69 scalar nu;
70 scalar dt;
71 Eigen::VectorXd y_old;
72 Eigen::VectorXd yOldOld;
73 Eigen::VectorXd BC;
74 Eigen::MatrixXd tauU;
75};
76
77
80{
81 public:
83
84 newton_unsteadyNS_PPE(int Nx, int Ny,
85 unsteadyNS& problem): newton_argument<double>(Nx, Ny),
87 Nphi_u(problem.NUmodes + problem.liftfield.size()),
88 Nphi_p(problem.NPmodes),
89 N_BC(problem.inletIndex.rows())
90 {}
91
92 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
93 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
94
96 int Nphi_u;
97 int Nphi_p;
98 int N_BC;
99 scalar nu;
100 scalar dt;
101 Eigen::VectorXd y_old;
102 Eigen::VectorXd yOldOld;
103 Eigen::VectorXd BC;
104 Eigen::MatrixXd tauU;
105};
106
107
108/*---------------------------------------------------------------------------*\
109 Class reducedProblem Declaration
110\*---------------------------------------------------------------------------*/
111
113
116{
117 private:
118
119 public:
120 // Constructors
128
130
133
136
138 scalar time;
139
141 double dt;
142
144 scalar finalTime;
145
147 scalar tstart;
148
151
154
156 bool startFromZero = false;
157
160
162 Eigen::MatrixXd tauIter;
163
166
169
172
173 // Functions
174
186 Eigen::MatrixXd penalty_PPE(Eigen::MatrixXd& vel_now, Eigen::MatrixXd& tauIter,
187 int startSnap = 0);
188
200 Eigen::MatrixXd penalty_sup(Eigen::MatrixXd& vel_now, Eigen::MatrixXd& tauIter,
201 int startSnap = 0);
202
211 void solveOnline_PPE(Eigen::MatrixXd vel_now, int startSnap = 0);
212
221 void solveOnline_sup(Eigen::MatrixXd vel_now, int startSnap = 0);
222
229 void reconstruct(bool exportFields = false,
230 fileName folder = "./online_rec");
231
239 Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel);
240
241};
242
243
244// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245
246
247
248#endif
249
Header file of the reducedSteadyNS class.
reducedSteadyNS()
Construct Null.
Eigen::MatrixXd vel_now
Online inlet velocity vector.
newton_unsteadyNS_PPE newton_object_PPE
Function object to call the non linear solver PPE approach.
Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel)
Sets the online velocity.
bool startFromZero
A variable for starting solving the reduced system from zero or not.
double exportEvery
A variable for exporting the fields.
reducedUnsteadyNS()
Construct Null.
scalar tolerancePenalty
Tolerance for the residual of the boundary values, there is the same tolerance for velocity and tempe...
scalar finalTime
Scalar to store the final time if the online simulation.
Eigen::MatrixXd penalty_sup(Eigen::MatrixXd &vel_now, Eigen::MatrixXd &tauIter, int startSnap=0)
Method to determine the penalty factors iteratively.
newton_unsteadyNS_sup newton_object_sup
Function object to call the non linear solver sup approach.
int timeStepPenalty
Number of timesteps calculated for the iterative penalty method.
void solveOnline_PPE(Eigen::MatrixXd vel_now, int startSnap=0)
Method to perform an online solve using a PPE stabilisation method.
void solveOnline_sup(Eigen::MatrixXd vel_now, int startSnap=0)
Method to perform an online solve using a supremizer stabilisation method.
scalar tstart
Scalar to store the initial time if the online simulation.
void reconstruct(bool exportFields=false, fileName folder="./online_rec")
Method to reconstruct the solutions from an online solve with a supremizer stabilisation technique.
unsteadyNS * problem
Pointer to the FOM problem.
Eigen::MatrixXd tauIter
Penalty Factor determined with iterative solver.
scalar time
Scalar to store the current time.
scalar maxIterPenalty
Maximum number of iterations to be done for the computation of the penalty factor.
double dt
Scalar to store the time increment.
Eigen::MatrixXd penalty_PPE(Eigen::MatrixXd &vel_now, Eigen::MatrixXd &tauIter, int startSnap=0)
Method to determine the penalty factors iteratively.
double storeEvery
A variable for storing the reduced coefficients.
Implementation of a parametrized full order unsteady NS problem and preparation of the the reduced ...
Definition unsteadyNS.H:62
Newton object for the resolution of the reduced problem using a PPE approach.
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
newton_unsteadyNS_PPE(int Nx, int Ny, unsteadyNS &problem)
Newton object for the resolution of the reduced problem using a supremizer approach.
newton_unsteadyNS_sup(int Nx, int Ny, unsteadyNS &problem)
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
Header file of the unsteadyNS class.