ITHACA-FV
2023.1
Loading...
Searching...
No Matches
tutorials
CFD
06POD_RBF
NLsolveSteadyNSTurb.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
-------------------------------------------------------------------------------
12
License
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/>.
24
\*---------------------------------------------------------------------------*/
25
26
scalar
residual
= 1;
27
scalar
uresidual
= 1;
28
Vector<double>
uresidual_v
(0, 0, 0);
29
30
scalar
presidual
= 1;
31
32
scalar
csolve
= 0;
33
34
35
// Variable that can be changed
36
turbulence
->read();
37
std::ofstream
res_os
;
38
res_os
.open(
"./ITHACAoutput/Offline/residuals"
, std::ios_base::app);
39
40
#if defined(OFVER) && (OFVER == 6)
41
42
while
(
simple
.loop(
runTime
) &&
residual
> tolerance &&
csolve
< maxIter )
43
#else
44
while
(
simple
.loop() &&
residual
> tolerance &&
csolve
< maxIter )
45
#endif
46
{
47
Info <<
"Time = "
<<
runTime
.timeName() << nl << endl;
48
// --- Pressure-velocity SIMPLE corrector
49
{
50
#include "
UEqn.H
"
51
#include "
pEqn.H
"
52
scalar C = 0;
53
54
for
(label
i
= 0;
i
< 3;
i
++)
55
{
56
if
(C <
uresidual_v
[
i
])
57
{
58
C =
uresidual_v
[
i
];
59
}
60
}
61
62
uresidual
= C;
63
residual
= max(
presidual
,
uresidual
);
64
Info <<
"\nResidual: "
<<
residual
<< endl << endl;
65
//Info << "Residual U: " << solve(UEqn() == -fvc::grad(p)).initialResidual() << endl;
66
}
67
laminarTransport
.correct();
68
turbulence
->correct();
69
csolve
=
csolve
+ 1;
70
Info <<
"ExecutionTime = "
<<
runTime
.elapsedCpuTime() <<
" s"
71
<<
" ClockTime = "
<<
runTime
.elapsedClockTime() <<
" s"
72
<< nl << endl;
73
}
74
75
res_os
<<
residual
<< std::endl;
76
res_os
.close();
77
runTime
.setTime(
runTime
.startTime(), 0);
78
79
80
81
82
83
84
85
runTime
Foam::Time & runTime
Definition
createTime.H:33
simple
simpleControl simple(mesh)
csolve
scalar csolve
Definition
NLsolveSteadyNSTurb.H:32
res_os
std::ofstream res_os
Definition
NLsolveSteadyNSTurb.H:37
uresidual_v
Vector< double > uresidual_v(0, 0, 0)
uresidual
scalar uresidual
Definition
NLsolveSteadyNSTurb.H:27
presidual
scalar presidual
Definition
NLsolveSteadyNSTurb.H:30
residual
scalar residual
Definition
NLsolveSteadyNSTurb.H:26
turbulence
turbulence
Definition
createFields.H:88
laminarTransport
singlePhaseTransportModel & laminarTransport
Definition
createFields.H:86
i
label i
Definition
pEqn.H:46
UEqn.H
pEqn.H
Generated by
1.11.0