Loading...
Searching...
No Matches
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
26scalar residual = 1;
27scalar uresidual = 1;
28Vector<double> uresidual_v(0, 0, 0);
29
30scalar presidual = 1;
31
32scalar csolve = 0;
33
34
35// Variable that can be changed
36turbulence->read();
37std::ofstream res_os;
38res_os.open("./ITHACAoutput/Offline/residuals", std::ios_base::app);
39
40#if defined(OFVER) && (OFVER == 6)
41
42while (simple.loop(runTime) && residual > tolerance && csolve < maxIter )
43#else
44while (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;
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
75res_os << residual << std::endl;
76res_os.close();
77runTime.setTime(runTime.startTime(), 0);
78
79
80
81
82
83
84
85
Foam::Time & runTime
Definition createTime.H:33
simpleControl simple(mesh)
scalar csolve
std::ofstream res_os
Vector< double > uresidual_v(0, 0, 0)
scalar uresidual
scalar presidual
scalar residual
turbulence
singlePhaseTransportModel & laminarTransport
label i
Definition pEqn.H:46