Loading...
Searching...
No Matches
UnsteadyProblem.C
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
13 License
14 This file is part of ITHACA-FV
15
16 ITHACA-FV is free software: you can redistribute it and/or modify
17 it under the terms of the GNU Lesser General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 ITHACA-FV is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU Lesser General Public License for more details.
25
26 You should have received a copy of the GNU Lesser General Public License
27 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
28
29\*---------------------------------------------------------------------------*/
30
31#include "UnsteadyProblem.H"
32
36
37bool UnsteadyProblem::checkWrite(Time& timeObject)
38{
39 scalar diffnow = mag(nextWrite - atof(timeObject.timeName().c_str()));
40 scalar diffnext = mag(nextWrite - atof(timeObject.timeName().c_str()) -
41 timeObject.deltaTValue());
42
43 if ( diffnow < diffnext)
44 {
45 return true;
46 }
47 else
48 {
49 return false;
50 }
51}
52
53void UnsteadyProblem::setTimes(Time& timeObject)
54{
56 startTime = para->ITHACAdict->lookupOrDefault<scalar>("startTime",
57 timeObject.startTime().value());
58 finalTime = para->ITHACAdict->lookupOrDefault<scalar>("finalTime",
59 timeObject.endTime().value());
60 timeStep = para->ITHACAdict->lookupOrDefault<scalar>("timeStep",
61 timeObject.deltaT().value());
62 writeEvery = para->ITHACAdict->lookupOrDefault<scalar>("writeEvery", timeStep);
64 "The finalTime needs to be bigger than the startTime");
66 "The timeStep needs to be bigger than the entire simulation Time");
68 "The writeEvery needs to larger or equal to the timeStep");
69 timeObject.setEndTime(finalTime);
70 timeObject.setDeltaT(timeStep);
71}
#define M_Assert(Expr, Msg)
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
IOdictionary * ITHACAdict
Dictionary for input objects from file.
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
bool checkWrite(Time &timeObject)
Function to check if the solution must be exported.
scalar startTime
Start Time (initial time to start storing the snapshots)
void setTimes(Time &timeObject)
scalar writeEvery
Time step of the writing procedure.
scalar timeStep
Time step of the simulation.
scalar nextWrite
Auxiliary variable to store the next writing instant.
scalar finalTime
Final time (final time of the simulation and consequently of the acquisition of the snapshots)