Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
f3590edf
Commit
f3590edf
authored
13 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Time: restart with non-standard Time (e.g. engineTime) compared values instead of names.
parent
f9262f75
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/OpenFOAM/db/Time/Time.C
+35
-12
35 additions, 12 deletions
src/OpenFOAM/db/Time/Time.C
src/OpenFOAM/db/Time/TimeIO.C
+6
-3
6 additions, 3 deletions
src/OpenFOAM/db/Time/TimeIO.C
src/engine/engineTime/engineTime.C
+5
-4
5 additions, 4 deletions
src/engine/engineTime/engineTime.C
with
46 additions
and
19 deletions
src/OpenFOAM/db/Time/Time.C
+
35
−
12
View file @
f3590edf
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -221,20 +221,43 @@ void Foam::Time::setControls()
timeIndex_
=
startTimeIndex_
;
}
scalar
timeValue
;
if
(
timeDict
.
readIfPresent
(
"value"
,
timeValue
))
// Check if values stored in time dictionary are consistent
// 1. Based on time name
bool
checkValue
=
true
;
string
storedTimeName
;
if
(
timeDict
.
readIfPresent
(
"name"
,
storedTimeName
))
{
word
storedTimeName
(
timeName
(
timeValue
));
if
(
storedTimeName
==
timeName
())
{
// Same time. No need to check stored value
checkValue
=
false
;
}
}
if
(
storedTimeName
!=
timeName
())
// 2. Based on time value
// (consistent up to the current time writing precision so it won't
// trigger if we just change the write precision)
if
(
checkValue
)
{
scalar
storedTimeValue
;
if
(
timeDict
.
readIfPresent
(
"value"
,
storedTimeValue
))
{
IOWarningIn
(
"Time::setControls()"
,
timeDict
)
<<
"Time read from time dictionary "
<<
storedTimeName
<<
" differs from actual time "
<<
timeName
()
<<
'.'
<<
nl
<<
" This may cause unexpected database behaviour."
<<
" If you are not interested"
<<
nl
<<
" in preserving time state delete the time dictionary."
<<
endl
;
word
storedTimeName
(
timeName
(
storedTimeValue
));
if
(
storedTimeName
!=
timeName
())
{
IOWarningIn
(
"Time::setControls()"
,
timeDict
)
<<
"Time read from time dictionary "
<<
storedTimeName
<<
" differs from actual time "
<<
timeName
()
<<
'.'
<<
nl
<<
" This may cause unexpected database behaviour."
<<
" If you are not interested"
<<
nl
<<
" in preserving time state delete"
<<
" the time dictionary."
<<
endl
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/db/Time/TimeIO.C
+
6
−
3
View file @
f3590edf
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -293,12 +293,14 @@ bool Foam::Time::writeObject
{
if
(
outputTime
())
{
const
word
tmName
(
timeName
());
IOdictionary
timeDict
(
IOobject
(
"time"
,
t
ime
Name
()
,
t
m
Name
,
"uniform"
,
*
this
,
IOobject
::
NO_READ
,
...
...
@@ -308,6 +310,7 @@ bool Foam::Time::writeObject
);
timeDict
.
add
(
"value"
,
value
());
timeDict
.
add
(
"name"
,
string
(
tmName
));
timeDict
.
add
(
"index"
,
timeIndex_
);
timeDict
.
add
(
"deltaT"
,
deltaT_
);
timeDict
.
add
(
"deltaT0"
,
deltaT0_
);
...
...
@@ -317,7 +320,7 @@ bool Foam::Time::writeObject
if
(
writeOK
&&
purgeWrite_
)
{
previousOutputTimes_
.
push
(
t
ime
Name
()
);
previousOutputTimes_
.
push
(
t
m
Name
);
while
(
previousOutputTimes_
.
size
()
>
purgeWrite_
)
{
...
...
This diff is collapsed.
Click to expand it.
src/engine/engineTime/engineTime.C
+
5
−
4
View file @
f3590edf
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -91,9 +91,10 @@ Foam::engineTime::engineTime
timeAdjustment
();
startTime_
=
degToTime
(
startTime_
);
value
()
=
degToTime
(
value
());
deltaT0_
=
deltaT_
;
startTime_
=
degToTime
(
startTime_
);
value
()
=
degToTime
(
value
());
deltaTSave_
=
deltaT_
;
deltaT0_
=
deltaT_
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment