From 034455842e7e56307ad7cdcf01502622d22e9f60 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 10 Jan 2011 10:40:59 +0000 Subject: [PATCH] ENH: Updated enthalpy transfer terms for reacting parcels --- .../ReactingMultiphaseParcel.C | 51 ++++++++++--------- .../Templates/ReactingParcel/ReactingParcel.C | 16 +++--- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index b0a7497211..60b02a7cfa 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -205,6 +205,9 @@ void Foam::ReactingMultiphaseParcel::calc const label cellI ) { + typedef typename ReactingParcel::trackData::cloudType cloudType; + const CompositionModel& composition = td.cloud().composition(); + // Define local properties at beginning of timestep // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const scalar np0 = this->nParticle_; @@ -218,9 +221,9 @@ void Foam::ReactingMultiphaseParcel::calc const scalar pc = this->pc_; const scalarField& YMix = this->Y_; - const label idG = td.cloud().composition().idGas(); - const label idL = td.cloud().composition().idLiquid(); - const label idS = td.cloud().composition().idSolid(); + const label idG = composition.idGas(); + const label idL = composition.idLiquid(); + const label idS = composition.idSolid(); // Calc surface values @@ -262,7 +265,7 @@ void Foam::ReactingMultiphaseParcel::calc scalar NCpW = 0.0; // Surface concentrations of emitted species - scalarField Cs(td.cloud().composition().carrier().species().size(), 0.0); + scalarField Cs(composition.carrier().species().size(), 0.0); // Calc mass and enthalpy transfer due to phase change this->calcPhaseChange @@ -323,12 +326,7 @@ void Foam::ReactingMultiphaseParcel::calc scalarField dMassSRGas(YGas_.size(), 0.0); scalarField dMassSRLiquid(YLiquid_.size(), 0.0); scalarField dMassSRSolid(YSolid_.size(), 0.0); - scalarField - dMassSRCarrier - ( - td.cloud().composition().carrier().species().size(), - 0.0 - ); + scalarField dMassSRCarrier(composition.carrier().species().size(), 0.0); // Clac mass and enthalpy transfer due to surface reactions calcSurfaceReactions @@ -423,25 +421,33 @@ void Foam::ReactingMultiphaseParcel::calc // Transfer mass lost from particle to carrier mass source forAll(YGas_, i) { - label gid = td.cloud().composition().localToGlobalCarrierId(GAS, i); + label gid = composition.localToGlobalCarrierId(GAS, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassGas[i]; + td.cloud().hsTrans()[cellI] += + np0*dMassGas[i]*composition.carrier().Hs(gid, T0); } forAll(YLiquid_, i) { - label gid = td.cloud().composition().localToGlobalCarrierId(LIQ, i); + label gid = composition.localToGlobalCarrierId(LIQ, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassLiquid[i]; + td.cloud().hsTrans()[cellI] += + np0*dMassLiquid[i]*composition.carrier().Hs(gid, T0); } /* // No mapping between solid components and carrier phase forAll(YSolid_, i) { - label gid = td.cloud().composition().localToGlobalCarrierId(SLD, i); + label gid = composition.localToGlobalCarrierId(SLD, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassSolid[i]; + td.cloud().hsTrans()[cellI] += + np0*dMassSolid[i]*composition.carrier().Hs(gid, T0); } */ forAll(dMassSRCarrier, i) { td.cloud().rhoTrans(i)[cellI] += np0*dMassSRCarrier[i]; + td.cloud().hsTrans()[cellI] += + np0*dMassSRCarrier[i]*composition.carrier().Hs(i, T0); } // Update momentum transfer @@ -470,14 +476,12 @@ void Foam::ReactingMultiphaseParcel::calc // Absorb parcel into carrier phase forAll(YGas_, i) { - label gid = - td.cloud().composition().localToGlobalCarrierId(GAS, i); + label gid = composition.localToGlobalCarrierId(GAS, i); td.cloud().rhoTrans(gid)[cellI] += np0*mass1*YMix[GAS]*YGas_[i]; } forAll(YLiquid_, i) { - label gid = - td.cloud().composition().localToGlobalCarrierId(LIQ, i); + label gid = composition.localToGlobalCarrierId(LIQ, i); td.cloud().rhoTrans(gid)[cellI] += np0*mass1*YMix[LIQ]*YLiquid_[i]; } @@ -485,8 +489,7 @@ void Foam::ReactingMultiphaseParcel::calc // No mapping between solid components and carrier phase forAll(YSolid_, i) { - label gid = - td.cloud().composition().localToGlobalCarrierId(SLD, i); + label gid = composition.localToGlobalCarrierId(SLD, i); td.cloud().rhoTrans(gid)[cellI] += np0*mass1*YMix[SLD]*YSolid_[i]; } @@ -551,6 +554,9 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation return; } + typedef typename ReactingParcel::trackData::cloudType cloudType; + const CompositionModel& composition = td.cloud().composition(); + // Total mass of volatiles evolved td.cloud().devolatilisation().calculate ( @@ -578,10 +584,9 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation // Note: hardcoded gaseous diffusivities for now // TODO: add to carrier thermo const scalar beta = sqr(cbrt(15.0) + cbrt(15.0)); - const label id = - td.cloud().composition().localToGlobalCarrierId(GAS, i); - const scalar Cp = td.cloud().thermo().carrier().Cp(id, Ts); - const scalar W = td.cloud().thermo().carrier().W(id); + const label id = composition.localToGlobalCarrierId(GAS, i); + const scalar Cp = composition.carrier().Cp(id, Ts); + const scalar W = composition.carrier().W(id); const scalar Ni = dMassDV[i]/(this->areaS(d)*dt*W); // Dab calc'd using API vapour mass diffusivity function diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 926c7dcf94..552d4f616a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -236,6 +236,9 @@ void Foam::ReactingParcel::calc const label cellI ) { + typedef typename ReactingParcel::trackData::cloudType cloudType; + const CompositionModel& composition = td.cloud().composition(); + // Define local properties at beginning of time step // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const scalar np0 = this->nParticle_; @@ -285,7 +288,7 @@ void Foam::ReactingParcel::calc scalar NCpW = 0.0; // Surface concentrations of emitted species - scalarField Cs(td.cloud().composition().carrier().species().size(), 0.0); + scalarField Cs(composition.carrier().species().size(), 0.0); // Calc mass and enthalpy transfer due to phase change calcPhaseChange @@ -372,8 +375,10 @@ void Foam::ReactingParcel::calc // Transfer mass lost from particle to carrier mass source forAll(dMassPC, i) { - label gid = td.cloud().composition().localToGlobalCarrierId(0, i); + label gid = composition.localToGlobalCarrierId(0, i); td.cloud().rhoTrans(gid)[cellI] += np0*dMassPC[i]; + td.cloud().hsTrans()[cellI] += + np0*dMassPC[i]*composition.carrier().Hs(gid, T0); } // Update momentum transfer @@ -401,13 +406,12 @@ void Foam::ReactingParcel::calc // Absorb parcel into carrier phase forAll(Y_, i) { - label gid = - td.cloud().composition().localToGlobalCarrierId(0, i); + label gid = composition.localToGlobalCarrierId(0, i); td.cloud().rhoTrans(gid)[cellI] += np0*mass1*Y_[i]; } td.cloud().UTrans()[cellI] += np0*mass1*U1; td.cloud().hsTrans()[cellI] += - np0*mass1*td.cloud().composition().H(0, Y_, pc_, T1); + np0*mass1*composition.H(0, Y_, pc_, T1); } } @@ -417,7 +421,7 @@ void Foam::ReactingParcel::calc else { - this->Cp_ = td.cloud().composition().Cp(0, Y_, pc_, T1); + this->Cp_ = composition.Cp(0, Y_, pc_, T1); this->T_ = T1; this->U_ = U1;