From fa7f0e1b67491dbe4c3b0f12fea57e10b6b56e0f Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Dec 2022 16:28:44 +0000 Subject: [PATCH] ENH: pureZoneMixture: different mixture properties according to cellZone --- .../splitMeshRegions/splitMeshRegions.C | 8 +- src/thermophysicalModels/basic/Make/files | 2 + .../pureZoneMixture/pureZoneMixture.C | 164 ++++ .../pureZoneMixture/pureZoneMixture.H | 195 +++++ .../basic/psiThermo/psiZoneThermos.C | 226 ++++++ .../basic/rhoThermo/rhoZoneThermos.C | 717 ++++++++++++++++++ .../solidThermo/Make/files | 3 + .../solidThermo/heZoneSolidThermos.C | 157 ++++ 8 files changed, 1468 insertions(+), 4 deletions(-) create mode 100644 src/thermophysicalModels/basic/mixtures/pureZoneMixture/pureZoneMixture.C create mode 100644 src/thermophysicalModels/basic/mixtures/pureZoneMixture/pureZoneMixture.H create mode 100644 src/thermophysicalModels/basic/psiThermo/psiZoneThermos.C create mode 100644 src/thermophysicalModels/basic/rhoThermo/rhoZoneThermos.C create mode 100644 src/thermophysicalModels/solidThermo/solidThermo/heZoneSolidThermos.C diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 1ad2ab9462..a653517993 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1928,7 +1928,7 @@ int main(int argc, char *argv[]) forAll(regionSizes, regionI) { - Info<< regionI << "\t\t" << regionSizes[regionI] << nl; + Info<< regionI << '\t' << regionSizes[regionI] << nl; } Info<< endl; @@ -1939,7 +1939,7 @@ int main(int argc, char *argv[]) << "------\t----\t----" << endl; forAll(regionToZones, regionI) { - Info<< regionI << "\t\t" << flatOutput(regionToZones[regionI]) + Info<< regionI << '\t' << flatOutput(regionToZones[regionI]) << '\t' << regionNames[regionI] << nl; } @@ -1987,8 +1987,8 @@ int main(int argc, char *argv[]) const edge& e = interfaces[interI]; Info<< interI - << "\t\t\t" << e[0] << "\t\t" << e[1] - << "\t\t" << interfaceSizes[interI] << nl; + << "\t\t" << e[0] << "\t" << e[1] + << "\t" << interfaceSizes[interI] << nl; } Info<< endl; diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 83ee06f8bf..f23011032c 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -3,10 +3,12 @@ fluidThermo/fluidThermo.C psiThermo/psiThermo.C psiThermo/psiThermos.C +psiThermo/psiZoneThermos.C rhoThermo/rhoThermo.C rhoThermo/rhoThermos.C rhoThermo/liquidThermo.C +rhoThermo/rhoZoneThermos.C derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C diff --git a/src/thermophysicalModels/basic/mixtures/pureZoneMixture/pureZoneMixture.C b/src/thermophysicalModels/basic/mixtures/pureZoneMixture/pureZoneMixture.C new file mode 100644 index 0000000000..e01eb41b80 --- /dev/null +++ b/src/thermophysicalModels/basic/mixtures/pureZoneMixture/pureZoneMixture.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021,2022 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "pureZoneMixture.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +const ThermoType& Foam::pureZoneMixture::constructSpeciesData +( + const dictionary& thermoDict +) +{ + const auto& czs = mesh_.cellZones(); + + const auto* dictPtr = thermoDict.findDict("none"); + + speciesData_.setSize(dictPtr ? czs.size()+1 : czs.size()); + forAll(czs, i) + { + speciesData_.set + ( + i, + new ThermoType(thermoDict.subDict(czs[i].name())) + ); + } + + if (dictPtr) + { + speciesData_.set(czs.size(), new ThermoType(*dictPtr)); + } + + return speciesData_[0]; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +template +Foam::pureZoneMixture::pureZoneMixture +( + const dictionary& thermoDict, + const fvMesh& mesh, + const word& phaseName +) +: + basicMixture(thermoDict, mesh, phaseName), + mesh_(mesh), + mixture_("mixture", constructSpeciesData(thermoDict.subDict("mixture"))) +{ + // Cache index per cell. This is the cellZone except for unzoned cells + // which are last + + const auto& czs = mesh_.cellZones(); + zoneID_.setSize(mesh_.nCells(), czs.size()); + for (const auto& cz : czs) + { + UIndirectList