diff --git a/src/fieldSources/basicSource/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource/basicSource.C index 355073b33a2a190399d585d66684596d6096cbec..2d218de752afdf67cd63e169d01a2e714924edd3 100644 --- a/src/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/fieldSources/basicSource/basicSource/basicSource.C @@ -167,8 +167,10 @@ void Foam::basicSource::setCellSet() Info<< indent << "- selecting inter region mapping" << endl; const fvMesh& secondaryMesh = mesh_.time().lookupObject<fvMesh>(mapRegionName_); - const boundBox primaryBB = mesh_.bounds(); - const boundBox secondaryBB = secondaryMesh.bounds(); + + boundBox primaryBB(mesh_.points(), false); + boundBox secondaryBB(secondaryMesh.points(), false); + if (secondaryBB.overlaps(primaryBB)) { // Dummy patches diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C index 24c0f612dd0b93dd45a6ca0438b541723ce90c88..772f26094a701c8b125cd1f9c6f36f178bfecb6b 100644 --- a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C @@ -137,100 +137,103 @@ void Foam::interRegionHeatTransferModel::addSup const label fieldI ) { - if (firstIter_) + if (secondaryToPrimaryInterpPtr_.valid()) { - check(); - firstIter_ = false; - } + if (firstIter_) + { + check(); + firstIter_ = false; + } - const volScalarField& h = eEqn.psi(); + const volScalarField& h = eEqn.psi(); - tmp<volScalarField> tTmapped - ( - new volScalarField + tmp<volScalarField> tTmapped ( - IOobject + new volScalarField ( - "Tmapped" + mesh_.name(), - mesh_.time().timeName(), + IOobject + ( + "Tmapped" + mesh_.name(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar("T", dimTemperature, 0.0) - ) - ); - - volScalarField& Tmapped = tTmapped(); + dimensionedScalar("T", dimTemperature, 0.0) + ) + ); - const fvMesh& secondaryMesh = - mesh_.time().lookupObject<fvMesh>(mapRegionName_); + volScalarField& Tmapped = tTmapped(); - const volScalarField& Tsecondary = - secondaryMesh.lookupObject<volScalarField>("T"); + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName_); - secondaryToPrimaryInterpPtr_->interpolateInternalField - ( - Tmapped, - Tsecondary, - meshToMesh::MAP, - eqOp<scalar>() - ); + const volScalarField& Tsecondary = + secondaryMesh.lookupObject<volScalarField>("T"); - if (!master_) - { secondaryToPrimaryInterpPtr_->interpolateInternalField ( - htc_, - secIrht_->calculateHtc(), - meshToMesh::CELL_VOLUME_WEIGHT, + Tmapped, + Tsecondary, + meshToMesh::MAP, eqOp<scalar>() ); - } - - if (debug) - { - Info<< " Volumetric integral of htc : " - << fvc::domainIntegrate(htc_).value() - << endl; - } - - //SAF: temporarily output - if (mesh_.time().outputTime()) - { - Tmapped.write(); - htc_.write(); - } - - if (h.dimensions() == dimEnergy/dimMass) - { - const basicThermo& primaryThermo = - mesh_.lookupObject<basicThermo>("thermophysicalProperties"); - eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h); + if (!master_) + { + secondaryToPrimaryInterpPtr_->interpolateInternalField + ( + htc_, + secIrht_->calculateHtc(), + meshToMesh::CELL_VOLUME_WEIGHT, + eqOp<scalar>() + ); + } if (debug) { - Info<< " Energy exchange from region " << secondaryMesh.name() - << " To " << mesh_.name() << " : " - << fvc::domainIntegrate - ( - htc_*(h/primaryThermo.Cp() - Tmapped) - ).value() + Info<< " Volumetric integral of htc : " + << fvc::domainIntegrate(htc_).value() << endl; } - } - else if(h.dimensions() == dimTemperature) - { - eEqn += htc_*Tmapped - fvm::Sp(htc_, h); - if (debug) + //SAF: temporarily output + if (mesh_.time().outputTime()) { - Info<< " Enegy exchange from region " << secondaryMesh.name() - << " To " << mesh_.name() << " : " - << fvc::domainIntegrate(htc_*(h - Tmapped)).value() - << endl; + Tmapped.write(); + htc_.write(); + } + + if (h.dimensions() == dimEnergy/dimMass) + { + const basicThermo& primaryThermo = + mesh_.lookupObject<basicThermo>("thermophysicalProperties"); + + eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h); + + if (debug) + { + Info<< " Energy exchange from region " << secondaryMesh.name() + << " To " << mesh_.name() << " : " + << fvc::domainIntegrate + ( + htc_*(h/primaryThermo.Cp() - Tmapped) + ).value() + << endl; + } + } + else if(h.dimensions() == dimTemperature) + { + eEqn += htc_*Tmapped - fvm::Sp(htc_, h); + + if (debug) + { + Info<< " Enegy exchange from region " << secondaryMesh.name() + << " To " << mesh_.name() << " : " + << fvc::domainIntegrate(htc_*(h - Tmapped)).value() + << endl; + } } } } diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C index cf339acd54d1273eebc7aa9cfdbb520db70dc17a..082f6ae5d1018fcdd7769fa8990567b51279cb82 100644 --- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C @@ -107,6 +107,11 @@ temperatureThermoBaffleFvPatchScalarField << exit(FatalError); } + const directMappedPatchBase& mpp = + refCast<const directMappedPatchBase>(patch().patch()); + + const word nbrMesh = mpp.sampleRegion(); + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle; @@ -114,14 +119,15 @@ temperatureThermoBaffleFvPatchScalarField if ( thisMesh.name() == polyMesh::defaultRegion - && !thisMesh.foundObject<baffle>("thermoBaffle") + && !thisMesh.foundObject<baffle>(nbrMesh) && !owner_ ) { - Info << "Creating thermal baffle..." << endl; + Info << "Creating thermal baffle..." << nbrMesh << endl; baffle_.reset(baffle::New(thisMesh, dict).ptr()); owner_ = true; dict.lookup("thermoType") >> solidThermoType_; + baffle_->rename(nbrMesh); } }