Read or calculate fluxes.
This commit is contained in:
@ -112,11 +112,12 @@ surfaceScalarField phiRec
|
||||
"phiRec",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(URec*voidfractionRec) & mesh.Sf()
|
||||
);
|
||||
phiRec.write();
|
||||
#endif
|
||||
|
||||
singlePhaseTransportModel laminarTransport(URec, phiRec);
|
||||
@ -124,4 +125,4 @@ surfaceScalarField phiRec
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(URec, phiRec, laminarTransport)
|
||||
);
|
||||
);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
voidfractionRec=*(particleCloud.recM().voidfraction());
|
||||
URec=*(particleCloud.recM().U());
|
||||
UsRec=*(particleCloud.recM().Us());
|
||||
phiRec=linearInterpolate(URec*voidfractionRec) & mesh.Sf();
|
||||
phiRec=*(particleCloud.recM().phi());
|
||||
|
||||
@ -142,11 +142,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
virtual void updateRecFields() = 0;
|
||||
virtual void setRecFields() = 0;
|
||||
|
||||
virtual const volScalarField* voidfraction() const = 0;
|
||||
virtual const volVectorField* U() const = 0;
|
||||
virtual const volVectorField* Us() const = 0;
|
||||
virtual const surfaceScalarField* phi() const = 0;
|
||||
virtual const surfaceScalarField* phiS() const = 0;
|
||||
|
||||
virtual tmp<volScalarField> tvoidfraction() const = 0;
|
||||
virtual tmp<volVectorField> tU() const = 0;
|
||||
|
||||
@ -56,18 +56,23 @@ standardRecModel::standardRecModel
|
||||
:
|
||||
recModel(dict,sm),
|
||||
propsDict_(dict.subDict(typeName + "Props")),
|
||||
UFieldName_(propsDict_.lookup("velRecFieldName")),
|
||||
voidfractionFieldName_(propsDict_.lookup("voidfractionRecFieldName")),
|
||||
UFieldName_(propsDict_.lookup("velRecFieldName")),
|
||||
UsFieldName_(propsDict_.lookup("granVelRecFieldName")),
|
||||
flux_(propsDict_.lookupOrDefault<bool>("flux",false)),
|
||||
phiFieldName_(propsDict_.lookup("phiRecFieldName")),
|
||||
phiSFieldName_(propsDict_.lookup("granPhiRecFieldName")),
|
||||
readPhi_(propsDict_.lookupOrDefault<bool>("readPhi",false)),
|
||||
readPhiS_(propsDict_.lookupOrDefault<bool>("readPhiS",false)),
|
||||
voidfractionRecpl(numRecFields),
|
||||
URecpl(numRecFields),
|
||||
UsRecpl(numRecFields),
|
||||
phiRecpl(numRecFields),
|
||||
phiSRecpl(numRecFields),
|
||||
voidfractionRec_(NULL),
|
||||
URec_(NULL),
|
||||
UsRec_(NULL),
|
||||
phiRec_(NULL),
|
||||
phiSRec_(NULL),
|
||||
normType_(propsDict_.lookup("normType")),
|
||||
refVol_(readScalar(propsDict_.lookup("refVol"))),
|
||||
refVel_(1.0)
|
||||
@ -121,9 +126,7 @@ standardRecModel::standardRecModel
|
||||
virtualTimeIndex=sequenceStart;
|
||||
virtualTimeIndexNext=virtualTimeIndex+1;
|
||||
|
||||
voidfractionRec_=voidfractionRecpl(virtualTimeIndex);
|
||||
URec_=URecpl(virtualTimeIndex);
|
||||
UsRec_=UsRecpl(virtualTimeIndex);
|
||||
setRecFields();
|
||||
|
||||
writeRecMatrix();
|
||||
writeRecPath();
|
||||
@ -159,13 +162,18 @@ void standardRecModel::updateRecFields()
|
||||
}
|
||||
if (verbose_)
|
||||
Info << "\nUpdating virtual time index to " << virtualTimeIndex << ".\n" << endl;
|
||||
setRecFields();
|
||||
}
|
||||
|
||||
void standardRecModel::setRecFields()
|
||||
{
|
||||
voidfractionRec_=voidfractionRecpl(virtualTimeIndex);
|
||||
URec_=URecpl(virtualTimeIndex);
|
||||
UsRec_=UsRecpl(virtualTimeIndex);
|
||||
if (flux_)
|
||||
phiRec_=phiRecpl(virtualTimeIndex);
|
||||
phiRec_=phiRecpl(virtualTimeIndex);
|
||||
phiSRec_=phiSRecpl(virtualTimeIndex);
|
||||
if (verbose_)
|
||||
Info << "Recurrence fields reset.\n" << endl;
|
||||
Info << "Recurrence fields set.\n" << endl;
|
||||
}
|
||||
|
||||
const volScalarField* standardRecModel::voidfraction() const
|
||||
@ -188,6 +196,11 @@ const surfaceScalarField* standardRecModel::phi() const
|
||||
return phiRec_;
|
||||
}
|
||||
|
||||
const surfaceScalarField* standardRecModel::phiS() const
|
||||
{
|
||||
return phiSRec_;
|
||||
}
|
||||
|
||||
tmp<volScalarField> standardRecModel::tvoidfraction() const
|
||||
{
|
||||
return voidfractionRecpl[virtualTimeIndex];
|
||||
@ -272,9 +285,28 @@ void standardRecModel::readFieldSeries()
|
||||
particleCloud_.mesh()
|
||||
)
|
||||
);
|
||||
|
||||
if(flux_)
|
||||
|
||||
if (readPhi_)
|
||||
{
|
||||
phiRecpl.set
|
||||
(
|
||||
timeIndexList(recTime.timeName()),
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phiFieldName_,
|
||||
recTime.timePath(),
|
||||
particleCloud_.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
particleCloud_.mesh()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
phiRecpl.set
|
||||
(
|
||||
timeIndexList(recTime.timeName()),
|
||||
@ -282,7 +314,7 @@ void standardRecModel::readFieldSeries()
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiRec",
|
||||
phiFieldName_,
|
||||
recTime.timePath(),
|
||||
particleCloud_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
@ -292,6 +324,46 @@ void standardRecModel::readFieldSeries()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (readPhiS_)
|
||||
{
|
||||
phiSRecpl.set
|
||||
(
|
||||
timeIndexList(recTime.timeName()),
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phiSFieldName_,
|
||||
recTime.timePath(),
|
||||
particleCloud_.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
particleCloud_.mesh()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
phiSRecpl.set
|
||||
(
|
||||
timeIndexList(recTime.timeName()),
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phiSFieldName_,
|
||||
recTime.timePath(),
|
||||
particleCloud_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
linearInterpolate(UsRecpl.last()*(1-voidfractionRecpl.last())) & particleCloud_.mesh().Sf()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Info << "Reading fields done" << endl;
|
||||
@ -405,7 +477,6 @@ scalar standardRecModel::norm(label ti, label tj)
|
||||
voidfractionRecpl[ti]-voidfractionRecpl[tj]
|
||||
)
|
||||
);
|
||||
// diff=sumSqr(voidfractionRecpl[ti].internalField() - voidfractionRecpl[tj].internalField());
|
||||
}
|
||||
else if (normType_=="solidPhaseMomentum")
|
||||
{
|
||||
@ -416,13 +487,7 @@ scalar standardRecModel::norm(label ti, label tj)
|
||||
voidfractionRecpl[ti]*UsRecpl[ti]-voidfractionRecpl[tj]*UsRecpl[tj]
|
||||
)
|
||||
);
|
||||
|
||||
// diff=sum (
|
||||
// magSqr (
|
||||
// voidfractionRecpl[ti].internalField()*UsRecpl[ti].internalField()-
|
||||
// voidfractionRecpl[tj].internalField()*UsRecpl[tj].internalField()
|
||||
// )
|
||||
// );
|
||||
|
||||
tDiff/=(refVel_*refVel_);
|
||||
}
|
||||
else
|
||||
|
||||
@ -68,11 +68,13 @@ public:
|
||||
|
||||
|
||||
void updateRecFields();
|
||||
void setRecFields();
|
||||
|
||||
const volScalarField* voidfraction() const;
|
||||
const volVectorField* U() const;
|
||||
const volVectorField* Us() const;
|
||||
const surfaceScalarField* phi() const;
|
||||
const surfaceScalarField* phiS() const;
|
||||
|
||||
tmp<volScalarField> tvoidfraction() const;
|
||||
tmp<volVectorField> tU() const;
|
||||
@ -82,20 +84,24 @@ private:
|
||||
|
||||
dictionary propsDict_;
|
||||
|
||||
word UFieldName_;
|
||||
word voidfractionFieldName_;
|
||||
word UFieldName_;
|
||||
word UsFieldName_;
|
||||
bool flux_;
|
||||
word phiFieldName_;
|
||||
word phiSFieldName_;
|
||||
bool readPhi_,readPhiS_;
|
||||
|
||||
PtrList<volScalarField> voidfractionRecpl;
|
||||
PtrList<volVectorField> URecpl;
|
||||
PtrList<volVectorField> UsRecpl;
|
||||
PtrList<surfaceScalarField> phiRecpl;
|
||||
PtrList<surfaceScalarField> phiSRecpl;
|
||||
|
||||
const volScalarField *voidfractionRec_;
|
||||
const volVectorField *URec_;
|
||||
const volVectorField *UsRec_;
|
||||
const surfaceScalarField *phiRec_;
|
||||
const surfaceScalarField *phiSRec_;
|
||||
|
||||
word normType_;
|
||||
scalar refVol_;
|
||||
|
||||
Reference in New Issue
Block a user