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>
163 const tmp<volScalarField> trhoVoF(
thermo.thermo1().rho());
169 const label patchi = patchIDs_[pidi];
170 label primaryPatchi = -1;
172 forAll(film().intCoupledPatchIDs(), i)
174 const label filmPatchi = film().intCoupledPatchIDs()[i];
176 if (filmPatchi == patchi)
178 primaryPatchi = film().primaryPatchIDs()[i];
182 if (primaryPatchi != -1)
186 film().primaryMesh().
boundary()[primaryPatchi].deltaCoeffs()
188 film().toRegion(patchi, deltaCoeffs);
190 scalarField hp(heVoF.boundaryField()[primaryPatchi]);
191 film().toRegion(patchi, hp);
193 scalarField Tp(TVoF.boundaryField()[primaryPatchi]);
194 film().toRegion(patchi, Tp);
196 scalarField Cpp(CpVoF.boundaryField()[primaryPatchi]);
197 film().toRegion(patchi, Cpp);
199 scalarField rhop(rhoVoF.boundaryField()[primaryPatchi]);
200 film().toRegion(patchi, rhop);
202 scalarField alphap(alphaVoF.boundaryField()[primaryPatchi]);
203 film().toRegion(patchi, alphap);
207 film().primaryMesh().
boundary()[primaryPatchi]
208 .patchInternalField(film().primaryMesh().V())
210 film().toRegion(patchi, Vp);
212 const polyPatch&
pp =
pbm[patchi];
216 scalar dMassPatch = 0;
220 const label celli = faceCells[facei];
226 delta[celli] > 2*deltaFactorToVoF_/deltaCoeffs[facei]
227 || alphap[facei] > alphaToVoF_
231 transferRateCoeff_*
delta[celli]*
rho[celli]*magSf[celli];
233 massToTransfer[celli] += dMass;
234 energyToTransfer[celli] += dMass*film().hs()[celli];
241 &&
delta[celli] < 2*deltaFactorToFilm_/deltaCoeffs[facei]
242 && alphap[facei] < alphaToFilm_
246 -transferRateCoeff_*alphap[facei]*rhop[facei]*Vp[facei];
248 massToTransfer[celli] += dMass;
249 energyToTransfer[celli] += dMass*hp[facei];
252 availableMass[celli] -= dMass;
256 patchTransferredMasses_[pidi] += dMassPatch;
257 addToTransferredMass(dMassPatch);
267 getModelProperty<scalarField>
269 "patchTransferredMasses",
274 scalarField patchTransferredMassTotals(patchTransferredMasses_);
275 Pstream::listCombineGather
277 patchTransferredMassTotals,
280 patchTransferredMasses0 += patchTransferredMassTotals;
282 setModelProperty<scalarField>
284 "patchTransferredMasses",
285 patchTransferredMasses0
288 patchTransferredMasses_ = 0;
293 void VoFPatchTransfer::patchTransferredMassTotals
299 if (!patchIDs_.size())
return;
303 getModelProperty<scalarField>
305 "patchTransferredMasses",
310 scalarField patchTransferredMassTotals(patchTransferredMasses_);
311 Pstream::listCombineGather(patchTransferredMassTotals, plusEqOp<scalar>());
315 const label patchi = patchIDs_[pidi];
316 patchMasses[patchi] +=
317 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/v2406/OpenFOAM-v2406/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)