ENH: waveModel - using class varaiable instead of a static to update the model

This commit is contained in:
Andrew Heather
2016-11-17 10:30:00 +00:00
parent ce7cc3a744
commit 9a10efc6fa
2 changed files with 7 additions and 4 deletions

View File

@ -276,6 +276,7 @@ Foam::waveModel::waveModel
waterDepthRef_(0),
initialDepth_(0),
rampTime_(VSMALL),
currTimeIndex_(-1),
activeAbsorption_(false),
U_(patch.size(), vector::zero),
alpha_(patch.size(), 0)
@ -338,9 +339,7 @@ bool Foam::waveModel::read()
void Foam::waveModel::correct(const scalar t)
{
static label timeIndex = -1;
if (mesh_.time().timeIndex() != timeIndex)
if (mesh_.time().timeIndex() != currTimeIndex_)
{
Info<< "Updating " << type() << " wave model for patch "
<< patch_.name() << endl;
@ -394,7 +393,7 @@ void Foam::waveModel::correct(const scalar t)
// Transform velocity into global co-ordinate system
U_ = Rlg_ & U_;
timeIndex = mesh_.time().timeIndex();
currTimeIndex_ = mesh_.time().timeIndex();
}
}

View File

@ -114,9 +114,13 @@ protected:
//- Ramp time
scalar rampTime_;
//- Time index used for updating
label currTimeIndex_;
//- Active wave absorption switch
bool activeAbsorption_;
// Current values
//- Velocity field