Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
36ca836f
Commit
36ca836f
authored
May 20, 2015
by
Henry
Browse files
Time: Correct precision adjustment for user-time
parent
295a357a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/Time/Time.C
View file @
36ca836f
...
...
@@ -1086,7 +1086,7 @@ Foam::Time& Foam::Time::operator++()
deltaTSave_
=
deltaT_
;
// Save old time value and name
const
scalar
oldTimeValue
=
value
();
const
scalar
oldTimeValue
=
timeToUserTime
(
value
()
)
;
const
word
oldTimeName
=
dimensionedScalar
::
name
();
// Increment time
...
...
@@ -1276,19 +1276,22 @@ Foam::Time& Foam::Time::operator++()
// Adjust the precision of the time directory name if necessary
if
(
outputTime_
)
{
// Time value obtained by reading timeName
scalar
timeNameValue
=
-
VGREAT
;
// Tolerance used when testing time equivalence
scalar
timeTol
=
const
scalar
timeTol
=
max
(
min
(
pow
(
10
.
0
,
-
precision_
),
0
.
1
*
deltaT_
),
SMALL
);
// User-time equivalent of deltaT
const
scalar
userDeltaT
=
timeToUserTime
(
deltaT_
);
// Time value obtained by reading timeName
scalar
timeNameValue
=
-
VGREAT
;
// Check that new time representation differs from old one
// reinterpretation of the word
if
(
readScalar
(
dimensionedScalar
::
name
().
c_str
(),
timeNameValue
)
&&
(
mag
(
timeNameValue
-
oldTimeValue
-
d
eltaT
_
)
>
timeTol
)
&&
(
mag
(
timeNameValue
-
oldTimeValue
-
userD
eltaT
)
>
timeTol
)
)
{
int
oldPrecision
=
precision_
;
...
...
@@ -1296,7 +1299,7 @@ Foam::Time& Foam::Time::operator++()
(
precision_
<
maxPrecision_
&&
readScalar
(
dimensionedScalar
::
name
().
c_str
(),
timeNameValue
)
&&
(
mag
(
timeNameValue
-
oldTimeValue
-
d
eltaT
_
)
>
timeTol
)
&&
(
mag
(
timeNameValue
-
oldTimeValue
-
userD
eltaT
)
>
timeTol
)
)
{
precision_
++
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment