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 newton_unsteadyNS_sup(int Nx, int Ny,
54 unsteadyNS& problem): newton_argument<double>(Nx, Ny),
56 Nphi_u(problem.NUmodes + problem.liftfield.size() + problem.NSUPmodes),
57 Nphi_p(problem.NPmodes),
58 N_BC(problem.inletIndex.rows())
59 {}
60
61 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
62 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
63
65 int Nphi_u;
66 int Nphi_p;
67 int N_BC;
68 scalar nu;
69 scalar dt;
70 Eigen::VectorXd y_old;
71 Eigen::VectorXd yOldOld;
72 Eigen::VectorXd BC;
73 Eigen::MatrixXd tauU;
74};
75
76
79{
80 public:
82 newton_unsteadyNS_PPE(int Nx, int Ny,
83 unsteadyNS& problem): newton_argument<double>(Nx, Ny),
85 Nphi_u(problem.NUmodes + problem.liftfield.size()),
86 Nphi_p(problem.NPmodes),
87 N_BC(problem.inletIndex.rows())
88 {}
89
90 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const;
91 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const;
92
94 int Nphi_u;
95 int Nphi_p;
96 int N_BC;
97 scalar nu;
98 scalar dt;
99 Eigen::VectorXd y_old;
100 Eigen::VectorXd yOldOld;
101 Eigen::VectorXd BC;
102 Eigen::MatrixXd tauU;
103};
104
105
106/*---------------------------------------------------------------------------*\
107 Class reducedProblem Declaration
108\*---------------------------------------------------------------------------*/
109
111
114{
115 private:
116
117 public:
118 // Constructors
126
128
131
134
136 scalar time;
137
139 double dt;
140
142 scalar finalTime;
143
145 scalar tstart;
146
149
152
154 bool startFromZero = false;
155
158
160 Eigen::MatrixXd tauIter;
161
164
167
170
171 // Functions
172
184 Eigen::MatrixXd penalty_PPE(Eigen::MatrixXd& vel_now, Eigen::MatrixXd& tauIter,
185 int startSnap = 0);
186
198 Eigen::MatrixXd penalty_sup(Eigen::MatrixXd& vel_now, Eigen::MatrixXd& tauIter,
199 int startSnap = 0);
200
209 void solveOnline_PPE(Eigen::MatrixXd vel_now, int startSnap = 0);
210
219 void solveOnline_sup(Eigen::MatrixXd vel_now, int startSnap = 0);
220
227 void reconstruct(bool exportFields = false,
228 fileName folder = "./online_rec");
229
237 Eigen::MatrixXd setOnlineVelocity(Eigen::MatrixXd vel);
238
239};
240
241
242// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243
244
245
246#endif
247
Header file of the reducedSteadyNS class.
Template object created to solve non linear problems using the Eigen library.
Class where it is implemented a reduced problem for the steady Navier-stokes problem.
Eigen::MatrixXd vel_now
Online inlet velocity vector.
Class where it is implemented a reduced problem for the unsteady Navier-stokes problem.
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.