construct field as copy resetting name

This commit is contained in:
danielque
2017-06-14 09:32:50 +02:00
parent 2c05e6e65f
commit ee06cc84cb
3 changed files with 38 additions and 87 deletions

View File

@ -108,32 +108,9 @@ explicitCouple::~explicitCouple()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volVectorField> explicitCouple::expMomSource() const
{
tmp<volVectorField> tsource
(
new volVectorField
(
IOobject
(
"f_explicitCouple",
particleCloud_.mesh().time().timeName(),
particleCloud_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
particleCloud_.mesh(),
dimensionedVector
(
"zero",
dimensionSet(1, -2, -2, 0, 0), // N/m3
vector::zero
),
"zeroGradient"
)
);
scalar tsf = particleCloud_.dataExchangeM().timeStepFraction();
if(1-tsf < 1e-4) //tsf==1
if (1. - tsf < 1e-4) //tsf==1
{
// calc fNext
forAll(fNext_,cellI)
@ -147,12 +124,18 @@ tmp<volVectorField> explicitCouple::expMomSource() const
if (magF > fLimit_[i]) fNext_[cellI][i] *= fLimit_[i]/magF;
}
}
tsource.ref() = fPrev_;
}else
{
tsource.ref() = (1 - tsf) * fPrev_ + tsf * fNext_;
return tmp<volVectorField>
(
new volVectorField("f_explicitCouple", fPrev_)
);
}
else
{
return tmp<volVectorField>
(
new volVectorField("f_explicitCouple", (1. - tsf) * fPrev_ + tsf * fNext_)
);
}
return tsource;
}
void explicitCouple::resetMomSourceField() const

View File

@ -122,40 +122,19 @@ implicitCouple::~implicitCouple()
tmp<volScalarField> implicitCouple::impMomSource() const
{
tmp<volScalarField> tsource
(
new volScalarField
(
IOobject
(
"Ksl_implicitCouple",
particleCloud_.mesh().time().timeName(),
particleCloud_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
particleCloud_.mesh(),
dimensionedScalar
(
"zero",
dimensionSet(1, -3, -1, 0, 0), // N/m3 / m/s
0
)
)
);
scalar tsf = particleCloud_.dataExchangeM().timeStepFraction();
// calc Ksl
scalar Ur;
if(1-tsf < 1e-4) //tsf==1
if (1. - tsf < 1e-4) //tsf==1
{
scalar Ur;
forAll(KslNext_,cellI)
{
Ur = mag(U_[cellI] - Us_[cellI]);
if(Ur > SMALL && alpha_[cellI] < maxAlpha_) //momentum exchange switched off if alpha too big
if (Ur > SMALL && alpha_[cellI] < maxAlpha_) //momentum exchange switched off if alpha too big
{
KslNext_[cellI] = mag(particleCloud_.forceM(0).impParticleForces()[cellI])
/ Ur
@ -166,13 +145,18 @@ tmp<volScalarField> implicitCouple::impMomSource() const
// limiter
if (KslNext_[cellI] > KslLimit_) KslNext_[cellI] = KslLimit_;
}
tsource.ref() = KslPrev_;
}else
{
tsource.ref() = (1 - tsf) * KslPrev_ + tsf * KslNext_;
return tmp<volScalarField>
(
new volScalarField("Ksl_implicitCouple", KslPrev_)
);
}
else
{
return tmp<volScalarField>
(
new volScalarField("Ksl_implicitCouple", (1. - tsf) * KslPrev_ + tsf * KslNext_)
);
}
return tsource;
}
void implicitCouple::resetMomSourceField() const

View File

@ -102,44 +102,28 @@ voidFractionModel::~voidFractionModel()
// * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> voidFractionModel::voidFractionInterp() const
{
tmp<volScalarField> tsource
(
new volScalarField
(
IOobject
(
"alpha_voidFractionModel",
particleCloud_.mesh().time().timeName(),
particleCloud_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
particleCloud_.mesh(),
dimensionedScalar
(
"zero",
dimensionSet(0, 0, 0, 0, 0),
0
)
)
);
scalar tsf = particleCloud_.dataExchangeM().timeStepFraction();
if(1-tsf < 1e-4 && particleCloud_.dataExchangeM().couplingStep() > 1) //tsf==1
if (1. - tsf < 1e-4 && particleCloud_.dataExchangeM().couplingStep() > 1) //tsf==1
{
tsource.ref() = voidfractionPrev_;
return tmp<volScalarField>
(
new volScalarField("alpha_voidFractionModel", voidfractionPrev_)
);
}
else
{
tsource.ref() = (1 - tsf) * voidfractionPrev_ + tsf * voidfractionNext_;
return tmp<volScalarField>
(
new volScalarField("alpha_voidFractionModel", (1. - tsf) * voidfractionPrev_ + tsf * voidfractionNext_)
);
}
return tsource;
}
void voidFractionModel::resetVoidFractions() const
{
voidfractionPrev_.ref() = voidfractionNext_.ref();
voidfractionNext_.ref() = 1;
voidfractionNext_.ref() = 1.;
}
/*void voidFractionModel::undoVoidFractions(double**const& mask) const