37 namespace regionModels
39 namespace surfaceFilmModels
49 VoFPatchTransfer::VoFPatchTransfer
51 surfaceFilmRegionModel& film,
52 const dictionary&
dict 58 coeffDict_.getOrDefault<scalar>(
"deltaFactorToVoF", 1.0)
62 coeffDict_.getOrDefault<scalar>(
"deltaFactorToFilm", 0.5)
66 coeffDict_.getOrDefault<scalar>(
"alphaToVoF", 0.5)
70 coeffDict_.getOrDefault<scalar>(
"alphaToFilm", 0.1)
74 coeffDict_.getOrDefault<scalar>(
"transferRateCoeff", 0.1)
77 patchTransferredMasses_()
79 const polyBoundaryMesh&
pbm = film.regionMesh().boundaryMesh();
83 pbm.size() - film.regionMesh().globalData().processorPatches().size()
87 if (coeffDict_.readIfPresent(
"patches",
patchNames))
92 Info<<
" applying to " << patchIDs_.size() <<
" patches:" <<
nl;
94 for (
const label patchi : patchIDs_)
101 Info<<
" applying to all patches" <<
endl;
106 patchTransferredMasses_.resize(patchIDs_.size(),
Zero);
108 if (patchIDs_.empty())
111 <<
"No patches selected" 119 VoFPatchTransfer::~VoFPatchTransfer()
143 if (!patchIDs_.size())
return;
149 const polyBoundaryMesh&
pbm = film().regionMesh().boundaryMesh();
152 const twoPhaseMixtureThermo&
thermo 154 film().primaryMesh().lookupObject<twoPhaseMixtureThermo>
168 const label patchi = patchIDs_[pidi];
169 label primaryPatchi = -1;
171 forAll(film().intCoupledPatchIDs(), i)
173 const label filmPatchi = film().intCoupledPatchIDs()[i];
175 if (filmPatchi == patchi)
177 primaryPatchi = film().primaryPatchIDs()[i];
181 if (primaryPatchi != -1)
185 film().primaryMesh().
boundary()[primaryPatchi].deltaCoeffs()
187 film().toRegion(patchi, deltaCoeffs);
189 scalarField hp(heVoF.boundaryField()[primaryPatchi]);
190 film().toRegion(patchi, hp);
192 scalarField Tp(TVoF.boundaryField()[primaryPatchi]);
193 film().toRegion(patchi, Tp);
195 scalarField Cpp(CpVoF.boundaryField()[primaryPatchi]);
196 film().toRegion(patchi, Cpp);
198 scalarField rhop(rhoVoF.boundaryField()[primaryPatchi]);
199 film().toRegion(patchi, rhop);
201 scalarField alphap(alphaVoF.boundaryField()[primaryPatchi]);
202 film().toRegion(patchi, alphap);
206 film().primaryMesh().
boundary()[primaryPatchi]
207 .patchInternalField(film().primaryMesh().V())
209 film().toRegion(patchi, Vp);
211 const polyPatch&
pp =
pbm[patchi];
215 scalar dMassPatch = 0;
219 const label celli = faceCells[facei];
225 delta[celli] > 2*deltaFactorToVoF_/deltaCoeffs[facei]
226 || alphap[facei] > alphaToVoF_
230 transferRateCoeff_*
delta[celli]*
rho[celli]*magSf[celli];
232 massToTransfer[celli] += dMass;
233 energyToTransfer[celli] += dMass*film().hs()[celli];
240 &&
delta[celli] < 2*deltaFactorToFilm_/deltaCoeffs[facei]
241 && alphap[facei] < alphaToFilm_
245 -transferRateCoeff_*alphap[facei]*rhop[facei]*Vp[facei];
247 massToTransfer[celli] += dMass;
248 energyToTransfer[celli] += dMass*hp[facei];
251 availableMass[celli] -= dMass;
255 patchTransferredMasses_[pidi] += dMassPatch;
256 addToTransferredMass(dMassPatch);
266 getModelProperty<scalarField>
268 "patchTransferredMasses",
273 scalarField patchTransferredMassTotals(patchTransferredMasses_);
274 Pstream::listCombineGather
276 patchTransferredMassTotals,
279 patchTransferredMasses0 += patchTransferredMassTotals;
281 setModelProperty<scalarField>
283 "patchTransferredMasses",
284 patchTransferredMasses0
287 patchTransferredMasses_ = 0;
292 void VoFPatchTransfer::patchTransferredMassTotals
298 if (!patchIDs_.size())
return;
302 getModelProperty<scalarField>
304 "patchTransferredMasses",
309 scalarField patchTransferredMassTotals(patchTransferredMasses_);
310 Pstream::listCombineGather(patchTransferredMassTotals, plusEqOp<scalar>());
314 const label patchi = patchIDs_[pidi];
315 patchMasses[patchi] +=
316 patchTransferredMasses[pidi] + patchTransferredMassTotals[pidi];
const polyBoundaryMesh & pbm
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
const word dictName("faMeshDefinition")
Ostream & endl(Ostream &os)
Add newline and flush stream.
addToRunTimeSelectionTable(surfaceFilmRegionModel, kinematicSingleLayer, mesh)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
psiReactionThermo & thermo
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList patchNames(nPatches)
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/chef2/andy/OpenFOAM/release/v2312/OpenFOAM-v2312/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{});alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
defineTypeNameAndDebug(kinematicSingleLayer, 0)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)