Loading...
Searching...
No Matches
NLsolvesteadyNS.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;
31scalar csolve = 0;
32
33// Variable that can be changed
34turbulence->read();
35std::ofstream res_os;
36res_os.open("./ITHACAoutput/Offline/residuals", std::ios_base::app);
37
38#if defined(OFVER) && (OFVER == 6)
39
40while (simple.loop(runTime) && residual > tolerance && csolve < maxIter )
41#else
42while (simple.loop() && residual > tolerance && csolve < maxIter )
43#endif
44{
45 Info << "Time = " << runTime.timeName() << nl << endl;
46 {
47#include "UEqn.H"
48#include "pEqn.H"
49 scalar C = 0;
50
51 for (label i = 0; i < 3; i++)
52 {
53 if (C < uresidual_v[i])
54 {
55 C = uresidual_v[i];
56 }
57 }
58
59 uresidual = C;
61 Info << "\nResidual: " << residual << endl << endl;
62 }
63 laminarTransport.correct();
64 turbulence->correct();
65 csolve = csolve + 1;
66 Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
67 << " ClockTime = " << runTime.elapsedClockTime() << " s"
68 << nl << endl;
69}
70
71res_os << residual << std::endl;
72res_os.close();
73
74runTime.setTime(runTime.startTime(), 0);
75
76
77
78
79
80
81
82
Foam::Time & runTime
Definition createTime.H:33
scalar csolve
std::ofstream res_os
Vector< double > uresidual_v(0, 0, 0)
scalar uresidual
scalar presidual
scalar residual
simpleControl simple(mesh)
turbulence
singlePhaseTransportModel & laminarTransport
label i
Definition pEqn.H:46