Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2012-10-19 16:36:23 +01:00
7 changed files with 65 additions and 23 deletions

View File

@ -100,10 +100,10 @@ echo "run $args" > $PWD/gdbCommands
echo "where" >> $PWD/gdbCommands echo "where" >> $PWD/gdbCommands
echo "Constructed gdb initialization file $PWD/gdbCommands" echo "Constructed gdb initialization file $PWD/gdbCommands"
$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" $ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind 6)gperftools(callgrind): \c"
read method read method
case "$method" in case "$method" in
0 | 1 | 2 | 3 | 4 | 5 ) 0 | 1 | 2 | 3 | 4 | 5 | 6)
# okay # okay
;; ;;
*) *)
@ -199,6 +199,11 @@ do
echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile
echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema
;; ;;
6)
echo "$sourceFoam; cd $PWD; CPUPROFILE=log.profiler_$proc $exec $args; \
pprof --callgrind $exec log.profiler_$proc > log.profiler_$proc.callgrind;" >> $procCmdFile
echo "${node}$procCmdFile" >> $PWD/mpirun.schema
;;
esac esac
chmod +x $procCmdFile chmod +x $procCmdFile

View File

@ -79,21 +79,35 @@ Foam::word Foam::Time::controlDictName("controlDict");
void Foam::Time::adjustDeltaT() void Foam::Time::adjustDeltaT()
{ {
bool adjustTime = false;
scalar timeToNextWrite = VGREAT;
if (writeControl_ == wcAdjustableRunTime) if (writeControl_ == wcAdjustableRunTime)
{ {
scalar interval = writeInterval_; adjustTime = true;
if (secondaryWriteControl_ == wcAdjustableRunTime) timeToNextWrite = max
{
interval = min(interval, secondaryWriteInterval_);
}
scalar timeToNextWrite = max
( (
0.0, 0.0,
(outputTimeIndex_ + 1)*interval - (value() - startTime_) (outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_)
); );
}
if (secondaryWriteControl_ == wcAdjustableRunTime)
{
adjustTime = true;
timeToNextWrite = max
(
0.0,
min
(
timeToNextWrite,
(secondaryOutputTimeIndex_ + 1)*secondaryWriteInterval_
- (value() - startTime_)
)
);
}
if (adjustTime)
{
scalar nSteps = timeToNextWrite/deltaT_ - SMALL; scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
// For tiny deltaT the label can overflow! // For tiny deltaT the label can overflow!
@ -1130,10 +1144,10 @@ Foam::Time& Foam::Time::operator++()
/ secondaryWriteInterval_ / secondaryWriteInterval_
); );
if (outputIndex > outputTimeIndex_) if (outputIndex > secondaryOutputTimeIndex_)
{ {
outputTime_ = true; outputTime_ = true;
outputTimeIndex_ = outputIndex; secondaryOutputTimeIndex_ = outputIndex;
} }
} }
break; break;
@ -1145,10 +1159,10 @@ Foam::Time& Foam::Time::operator++()
returnReduce(elapsedCpuTime(), maxOp<double>()) returnReduce(elapsedCpuTime(), maxOp<double>())
/ secondaryWriteInterval_ / secondaryWriteInterval_
); );
if (outputIndex > outputTimeIndex_) if (outputIndex > secondaryOutputTimeIndex_)
{ {
outputTime_ = true; outputTime_ = true;
outputTimeIndex_ = outputIndex; secondaryOutputTimeIndex_ = outputIndex;
} }
} }
break; break;
@ -1160,10 +1174,10 @@ Foam::Time& Foam::Time::operator++()
returnReduce(label(elapsedClockTime()), maxOp<label>()) returnReduce(label(elapsedClockTime()), maxOp<label>())
/ secondaryWriteInterval_ / secondaryWriteInterval_
); );
if (outputIndex > outputTimeIndex_) if (outputIndex > secondaryOutputTimeIndex_)
{ {
outputTime_ = true; outputTime_ = true;
outputTimeIndex_ = outputIndex; secondaryOutputTimeIndex_ = outputIndex;
} }
} }
break; break;

View File

@ -51,6 +51,8 @@ void Foam::Time::readDict()
} }
scalar oldWriteInterval = writeInterval_; scalar oldWriteInterval = writeInterval_;
scalar oldSecondaryWriteInterval = secondaryWriteInterval_;
if (controlDict_.readIfPresent("writeInterval", writeInterval_)) if (controlDict_.readIfPresent("writeInterval", writeInterval_))
{ {
if (writeControl_ == wcTimeStep && label(writeInterval_) < 1) if (writeControl_ == wcTimeStep && label(writeInterval_) < 1)
@ -124,6 +126,26 @@ void Foam::Time::readDict()
break; break;
} }
} }
if (oldSecondaryWriteInterval != secondaryWriteInterval_)
{
switch (secondaryWriteControl_)
{
case wcRunTime:
case wcAdjustableRunTime:
// Recalculate secondaryOutputTimeIndex_ to be in units of
// current writeInterval.
secondaryOutputTimeIndex_ = label
(
secondaryOutputTimeIndex_
* oldSecondaryWriteInterval
/ secondaryWriteInterval_
);
break;
default:
break;
}
}
if (controlDict_.readIfPresent("purgeWrite", purgeWrite_)) if (controlDict_.readIfPresent("purgeWrite", purgeWrite_))
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,6 +37,7 @@ Foam::TimeState::TimeState()
deltaT0_(0), deltaT0_(0),
deltaTchanged_(false), deltaTchanged_(false),
outputTimeIndex_(0), outputTimeIndex_(0),
secondaryOutputTimeIndex_(0),
outputTime_(false) outputTime_(false)
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -61,9 +61,9 @@ protected:
bool deltaTchanged_; bool deltaTchanged_;
label outputTimeIndex_; label outputTimeIndex_;
label secondaryOutputTimeIndex_;
bool outputTime_; bool outputTime_;
public: public:
// Constructors // Constructors

View File

@ -398,6 +398,8 @@ Foam::string& Foam::stringOps::inplaceExpand
begVar - stringStart + 1, begVar - stringStart + 1,
varValue varValue
); );
begVar = stringStart+varValue.size();
} }
else else
{ {
@ -744,8 +746,7 @@ Foam::string& Foam::stringOps::inplaceExpand
FatalErrorIn FatalErrorIn
( (
"stringOps::inplaceExpand(string&, const bool)" "stringOps::inplaceExpand(string&, const bool)"
) ) << "Unknown variable name '" << varName << "'"
<< "Unknown variable name '" << varName << "'"
<< exit(FatalError); << exit(FatalError);
} }
} }

View File

@ -2655,7 +2655,6 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
} }
// Remove any meshed faces // Remove any meshed faces
PackedBoolList ppFaces(mesh.nFaces());
forAll(pp.addressing(), i) forAll(pp.addressing(), i)
{ {
label meshFaceI = pp.addressing()[i]; label meshFaceI = pp.addressing()[i];