diff --git a/applications/solvers/combustion/XiFoam/Make/options b/applications/solvers/combustion/XiFoam/Make/options index 62f86b7118..674d20c37b 100644 --- a/applications/solvers/combustion/XiFoam/Make/options +++ b/applications/solvers/combustion/XiFoam/Make/options @@ -17,7 +17,7 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ - -lfluidThermophysicalModels \ + -lcoupledThermophysicalTransportModels \ -lmulticomponentThermophysicalModels \ -lspecie \ -llaminarFlameSpeedModels \ diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/Make/options b/applications/solvers/combustion/XiFoam/PDRFoam/Make/options index 8c9188d3cd..ebe9e5779b 100644 --- a/applications/solvers/combustion/XiFoam/PDRFoam/Make/options +++ b/applications/solvers/combustion/XiFoam/PDRFoam/Make/options @@ -41,7 +41,7 @@ EXE_LIBS = \ -lspecie \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -llaminarFlameSpeedModels \ -lfiniteVolume \ -lfvModels \ diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/options b/applications/solvers/compressible/rhoCentralFoam/Make/options index d6d9fb4db5..aff36bf1ad 100644 --- a/applications/solvers/compressible/rhoCentralFoam/Make/options +++ b/applications/solvers/compressible/rhoCentralFoam/Make/options @@ -18,5 +18,5 @@ EXE_LIBS = \ -lrhoCentralFoam \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -lmeshTools diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options index c02a5b9cd4..c8c0b1835a 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options @@ -16,7 +16,7 @@ EXE_LIBS = \ -lspecie \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -lfiniteVolume \ -lsampling \ -lmeshTools \ diff --git a/applications/solvers/heatTransfer/thermoFoam/Make/options b/applications/solvers/heatTransfer/thermoFoam/Make/options index ccc800aa8f..b271026172 100644 --- a/applications/solvers/heatTransfer/thermoFoam/Make/options +++ b/applications/solvers/heatTransfer/thermoFoam/Make/options @@ -18,4 +18,4 @@ EXE_LIBS = \ -lspecie \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels + -lcoupledThermophysicalTransportModels diff --git a/applications/solvers/modules/fluid/fluid/Make/options b/applications/solvers/modules/fluid/fluid/Make/options index e4ad796db1..57be1aadc9 100644 --- a/applications/solvers/modules/fluid/fluid/Make/options +++ b/applications/solvers/modules/fluid/fluid/Make/options @@ -17,7 +17,7 @@ LIB_LIBS = \ -lfluidThermophysicalModels \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -lfiniteVolume \ -lmeshTools \ -lsampling \ diff --git a/applications/solvers/modules/fluid/multicomponentFluid/Make/options b/applications/solvers/modules/fluid/multicomponentFluid/Make/options index 51abc6d5ce..0f1a74e6f7 100644 --- a/applications/solvers/modules/fluid/multicomponentFluid/Make/options +++ b/applications/solvers/modules/fluid/multicomponentFluid/Make/options @@ -28,7 +28,7 @@ LIB_LIBS = \ -lmulticomponentThermophysicalModels \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -lfluidMulticomponentThermophysicalTransportModels \ -lfiniteVolume \ -lfvModels \ diff --git a/applications/solvers/modules/solid/solid/Make/options b/applications/solvers/modules/solid/solid/Make/options index c6a1c40496..3279afa2e6 100644 --- a/applications/solvers/modules/solid/solid/Make/options +++ b/applications/solvers/modules/solid/solid/Make/options @@ -2,13 +2,14 @@ EXE_INC = \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude LIB_LIBS = \ -lsolidThermo \ + -lsolidThermophysicalTransportModels \ -lspecie \ -lfiniteVolume \ -lmeshTools \ diff --git a/applications/solvers/modules/solid/solid/solid.C b/applications/solvers/modules/solid/solid/solid.C index 1724c65d10..af8e6a4c75 100644 --- a/applications/solvers/modules/solid/solid/solid.C +++ b/applications/solvers/modules/solid/solid/solid.C @@ -76,9 +76,6 @@ void Foam::solvers::solid::correctDiNum() } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::solvers::solid::solid(fvMesh& mesh) @@ -90,6 +87,8 @@ Foam::solvers::solid::solid(fvMesh& mesh) T(thermo.T()), + thermophysicalTransport(solidThermophysicalTransportModel::New(thermo)), + DiNum(0) { // Read the controls @@ -174,7 +173,7 @@ void Foam::solvers::solid::thermophysicalPredictor() fvScalarMatrix eEqn ( fvm::ddt(rho, e) - + thermo.divq(e) + + thermophysicalTransport->divq(e) == fvModels().source(rho, e) ); diff --git a/applications/solvers/modules/solid/solid/solid.H b/applications/solvers/modules/solid/solid/solid.H index 24d7fbf81e..d4e62fc925 100644 --- a/applications/solvers/modules/solid/solid/solid.H +++ b/applications/solvers/modules/solid/solid/solid.H @@ -38,7 +38,7 @@ SourceFiles #define solid_H #include "solver.H" -#include "solidThermo.H" +#include "solidThermophysicalTransportModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -74,6 +74,12 @@ protected: volScalarField& T; + // Thermophysical transport + + //- Pointer to the solid thermophysical transport model + autoPtr thermophysicalTransport; + + // Time-step controls scalar DiNum; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 38abb051a4..6c631750c0 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -349,7 +349,7 @@ public: // Transport - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/Make/options b/applications/solvers/stressAnalysis/solidDisplacementFoam/Make/options index dd688b483f..4508f6ef4f 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/Make/options +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/Make/options @@ -6,13 +6,15 @@ EXE_INC = \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lfiniteVolume \ -lsolidThermo \ -lsolidDisplacementThermo \ + -lsolidThermophysicalTransportModels \ + -lfiniteVolume \ + -lmeshTools \ -lfvModels \ - -lfvConstraints \ - -lmeshTools + -lfvConstraints diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermophysicalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermophysicalProperties.H index ad54d6d6cf..7d7e56dcd0 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermophysicalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermophysicalProperties.H @@ -2,6 +2,13 @@ Info<< "Reading thermophysical properties\n" << endl; solidDisplacementThermo thermo(mesh); +autoPtr thermophysicalTransport; + +if (thermo.thermalStress()) +{ + thermophysicalTransport = solidThermophysicalTransportModel::New(thermo); +} + const volScalarField& E(thermo.E()); const volScalarField& nu(thermo.nu()); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C index a2cdd62d6d..01fe8eae3c 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ Description #include "fvCFD.H" #include "solidDisplacementThermo.H" +#include "solidThermophysicalTransportModel.H" #include "fvModels.H" #include "fvConstraints.H" @@ -76,7 +77,7 @@ int main(int argc, char *argv[]) fvScalarMatrix TEqn ( fvm::ddt(rho, Cp, T) - + thermo.divq(T) + + thermophysicalTransport->divq(T) == fvModels.source(rho*Cp, T) ); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H index 663e5c2554..08b0bdd431 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H @@ -61,7 +61,7 @@ class solidDisplacementThermo //- Heat capacity at constant pressure [J/kg/K] volScalarField Cp_; - //- Thermal diffusivity for temperature [W/m/K] + //- Thermal conductivity [W/m/K] volScalarField kappa_; //- Youngs modulus [Pa] @@ -176,7 +176,7 @@ public: // Access to transport state variables - //- Thermal diffusivity for temperature of mixture [W/m/K] + //- Thermal conductivity of mixture [W/m/K] virtual const volScalarField& kappa() const; @@ -314,7 +314,7 @@ public: //- Thermal diffusivity for energy of mixture for patch [kg/m/s] virtual tmp alphahe(const label patchi) const; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff ( @@ -327,7 +327,7 @@ public: const volScalarField& alphat ) const; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff ( diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/Make/options b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/Make/options index 3da3ce0c71..7090b8cc82 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/Make/options +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/Make/options @@ -6,6 +6,7 @@ EXE_INC = \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -13,4 +14,5 @@ EXE_LIBS = \ -lfiniteVolume \ -lsolidThermo \ -lsolidDisplacementThermo \ + -lsolidThermophysicalTransportModels \ -lmeshTools diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C index dee314999a..8d9a5a306f 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,8 +26,7 @@ Application Description Steady-state segregated finite-volume solver of linear-elastic, - small-strain deformation of a solid body, with optional thermal - diffusion and thermal stresses. + small-strain deformation of a solid body. Simple linear elasticity structural analysis code. Solves for the displacement vector field D, also generating the @@ -37,6 +36,7 @@ Description #include "fvCFD.H" #include "solidDisplacementThermo.H" +#include "solidThermophysicalTransportModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index 1f74ea29b3..bdd2c8c9aa 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -307,7 +307,7 @@ protected: //- Is the mesh moving bool moving_; - //- Is the mesh topology changing + //- Has the mesh topology changed bool topoChanged_; @@ -528,7 +528,7 @@ public: return moving_; } - //- Is mesh topology changing + //- Has the mesh topology changed bool topoChanged() const { return topoChanged_; diff --git a/src/ThermophysicalTransportModels/Allwmake b/src/ThermophysicalTransportModels/Allwmake index 300b88abca..0f32d8f28d 100755 --- a/src/ThermophysicalTransportModels/Allwmake +++ b/src/ThermophysicalTransportModels/Allwmake @@ -8,5 +8,7 @@ wmake $targetType wmake $targetType fluidMulticomponentThermo wmake $targetType phaseFluidThermo wmake $targetType phaseFluidMulticomponentThermo +wmake $targetType solidThermophysicalTransportModels +wmake $targetType coupledThermophysicalTransportModels #------------------------------------------------------------------------------ diff --git a/src/ThermophysicalTransportModels/Make/files b/src/ThermophysicalTransportModels/Make/files index e1872f25a2..d1c73eb2be 100644 --- a/src/ThermophysicalTransportModels/Make/files +++ b/src/ThermophysicalTransportModels/Make/files @@ -1,9 +1,6 @@ thermophysicalTransportModel/thermophysicalTransportModel.C BCs = derivedFvPatchFields -$(BCs)/externalTemperature/externalTemperatureFvPatchScalarField.C -$(BCs)/temperatureCoupledBase/temperatureCoupledBase.C -$(BCs)/coupledTemperature/coupledTemperatureFvPatchScalarField.C $(BCs)/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C $(BCs)/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C $(BCs)/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C diff --git a/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/files b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/files new file mode 100644 index 0000000000..c1a581775e --- /dev/null +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/files @@ -0,0 +1,5 @@ +externalTemperature/externalTemperatureFvPatchScalarField.C +patchKappa/patchKappa.C +coupledTemperature/coupledTemperatureFvPatchScalarField.C + +LIB = $(FOAM_LIBBIN)/libcoupledThermophysicalTransportModels diff --git a/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/options b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/options new file mode 100644 index 0000000000..54c2abbb85 --- /dev/null +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/Make/options @@ -0,0 +1,19 @@ +EXE_INC = \ + -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +LIB_LIBS = \ + -lfluidThermophysicalModels \ + -lsolidThermo \ + -lthermophysicalTransportModels \ + -lmomentumTransportModels \ + -lsolidThermophysicalTransportModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.C b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.C similarity index 96% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.C rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.C index b996063081..fd232c9dd5 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.C @@ -24,10 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "coupledTemperatureFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" +#include "patchKappa.H" #include "volFields.H" +#include "fvPatchFieldMapper.H" #include "mappedPatchBase.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -39,7 +40,6 @@ coupledTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch()), TnbrName_("undefined-Tnbr"), qrNbrName_("undefined-qrNbr"), qrName_("undefined-qr"), @@ -63,7 +63,6 @@ coupledTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), dict), TnbrName_(dict.lookupOrDefault("Tnbr", "T")), qrNbrName_(dict.lookupOrDefault("qrNbr", "none")), qrName_(dict.lookupOrDefault("qr", "none")), @@ -147,7 +146,6 @@ coupledTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(psf, p, iF, mapper), - temperatureCoupledBase(patch(), psf), TnbrName_(psf.TnbrName_), qrNbrName_(psf.qrNbrName_), qrName_(psf.qrName_), @@ -166,7 +164,6 @@ coupledTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(psf, iF), - temperatureCoupledBase(patch(), psf), TnbrName_(psf.TnbrName_), qrNbrName_(psf.qrNbrName_), qrName_(psf.qrName_), @@ -225,12 +222,14 @@ void Foam::coupledTemperatureFvPatchScalarField::updateCoeffs() : mpp.distribute(coupledTemperatureNbr) ); - const scalarField KDelta(kappa(*this)*patch().deltaCoeffs()); + const scalarField kappa(patchKappa(patch()).kappa()); + + const scalarField KDelta(kappa*patch().deltaCoeffs()); const scalarField KDeltaNbr ( contactRes_ == 0 - ? mpp.distribute(coupledTemperatureNbr.kappa(coupledTemperatureNbr) + ? mpp.distribute(patchKappa(patchNbr).kappa() *patchNbr.deltaCoeffs()) : tmp(new scalarField(size(), contactRes_)) ); @@ -272,13 +271,13 @@ void Foam::coupledTemperatureFvPatchScalarField::updateCoeffs() this->valueFraction() = KDeltaNbr/(KDeltaNbr + KDelta); this->refValue() = TcNbr; - this->refGrad() = (qs_ + qr + qrNbr)/kappa(*this); + this->refGrad() = (qs_ + qr + qrNbr)/kappa; mixedFvPatchScalarField::updateCoeffs(); if (debug) { - scalar Q = gSum(kappa(*this)*patch().magSf()*snGrad()); + scalar Q = gSum(kappa*patch().magSf()*snGrad()); Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' @@ -310,8 +309,6 @@ void Foam::coupledTemperatureFvPatchScalarField::write writeEntry(os, "qr", qrName_); writeEntry(os, "thicknessLayers", thicknessLayers_); writeEntry(os, "kappaLayers", kappaLayers_); - - temperatureCoupledBase::write(os); } diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.H b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.H similarity index 96% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.H rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.H index b45f51a584..139a45577c 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/coupledTemperature/coupledTemperatureFvPatchScalarField.H +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/coupledTemperature/coupledTemperatureFvPatchScalarField.H @@ -39,7 +39,7 @@ Description and qs is the optional source heat flux. The thermal conductivity \c kappa can either be retrieved from various - possible sources, as detailed in the class temperatureCoupledBase. + possible sources, as detailed in the class patchKappa. Usage \table @@ -72,7 +72,7 @@ Usage should be specified, not both. See also - Foam::temperatureCoupledBase + Foam::patchKappa SourceFiles coupledTemperatureFvPatchScalarField.C @@ -83,7 +83,6 @@ SourceFiles #define coupledTemperatureFvPatchScalarField_H #include "mixedFvPatchFields.H" -#include "temperatureCoupledBase.H" #include "scalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -97,8 +96,7 @@ namespace Foam class coupledTemperatureFvPatchScalarField : - public mixedFvPatchScalarField, - public temperatureCoupledBase + public mixedFvPatchScalarField { // Private Data diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.C b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.C similarity index 97% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.C rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.C index 9e36bc5d64..60f7ee5caf 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.C @@ -24,13 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "externalTemperatureFvPatchScalarField.H" +#include "patchKappa.H" #include "volFields.H" #include "physicoChemicalConstants.H" #include "addToRunTimeSelectionTable.H" using Foam::constant::physicoChemical::sigma; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::externalTemperatureFvPatchScalarField:: @@ -41,7 +41,6 @@ externalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch()), haveQ_(false), Q_(NaN), haveq_(false), @@ -72,7 +71,6 @@ externalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), dict), haveQ_(dict.found("Q")), Q_(haveQ_ ? dict.lookup("Q") : NaN), haveq_(dict.found("q")), @@ -146,7 +144,6 @@ externalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(ptf, p, iF, mapper), - temperatureCoupledBase(patch(), ptf), haveQ_(ptf.haveQ_), Q_(ptf.Q_), haveq_(ptf.haveq_), @@ -177,7 +174,6 @@ externalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(tppsf, iF), - temperatureCoupledBase(patch(), tppsf), haveQ_(tppsf.haveQ_), Q_(tppsf.Q_), haveq_(tppsf.haveq_), @@ -311,10 +307,12 @@ void Foam::externalTemperatureFvPatchScalarField::updateCoeffs() qTot += q_; } + const scalarField kappa(patchKappa(patch()).kappa()); + // Evaluate if (!haveh_) { - refGrad() = qTot/kappa(*this); + refGrad() = qTot/kappa; refValue() = Tp; valueFraction() = 0; } @@ -356,7 +354,7 @@ void Foam::externalTemperatureFvPatchScalarField::updateCoeffs() const scalarField kappaDeltaCoeffs ( - this->kappa(*this)*patch().deltaCoeffs() + kappa*patch().deltaCoeffs() ); refGrad() = 0; @@ -386,7 +384,7 @@ void Foam::externalTemperatureFvPatchScalarField::updateCoeffs() if (debug) { - const scalar Q = gSum(kappa(*this)*patch().magSf()*snGrad()); + const scalar Q = gSum(kappa*patch().magSf()*snGrad()); Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' @@ -408,8 +406,6 @@ void Foam::externalTemperatureFvPatchScalarField::write { fvPatchScalarField::write(os); - temperatureCoupledBase::write(os); - if (haveQ_) { writeEntry(os, "Q", Q_); diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.H b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.H similarity index 96% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.H rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.H index f50bf46fb3..d42f7f4e86 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalTemperature/externalTemperatureFvPatchScalarField.H +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/externalTemperature/externalTemperatureFvPatchScalarField.H @@ -46,8 +46,9 @@ Description resistances can be specified through thicknessLayers and kappaLayers entries. - The thermal conductivity \c kappa can either be retrieved from various - possible sources, as detailed in the class temperatureCoupledBase. + The patch thermal conductivity \c kappa is obtained from the + Foam::patchKappa base class so that this boundary condition can be applied + directly to either fluid or solid regions. The ambient temperature Ta is specified as a Foam::Function1 of time but uniform is space. @@ -83,7 +84,7 @@ Usage \endverbatim See also - Foam::temperatureCoupledBase + Foam::patchKappa Foam::mixedFvPatchScalarField SourceFiles @@ -95,7 +96,6 @@ SourceFiles #define externalTemperatureFvPatchScalarField_H #include "mixedFvPatchFields.H" -#include "temperatureCoupledBase.H" #include "Function1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -109,8 +109,7 @@ namespace Foam class externalTemperatureFvPatchScalarField : - public mixedFvPatchScalarField, - public temperatureCoupledBase + public mixedFvPatchScalarField { // Private Data diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.C similarity index 57% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.C index a61fd077dc..74a2e34de7 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,37 +23,13 @@ License \*---------------------------------------------------------------------------*/ -#include "temperatureCoupledBase.H" -#include "fluidThermo.H" -#include "solidThermo.H" +#include "patchKappa.H" #include "thermophysicalTransportModel.H" +#include "solidThermophysicalTransportModel.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::temperatureCoupledBase::temperatureCoupledBase -( - const fvPatch& patch -) -: - patch_(patch) -{} - - -Foam::temperatureCoupledBase::temperatureCoupledBase -( - const fvPatch& patch, - const dictionary& dict -) -: - patch_(patch) -{} - - -Foam::temperatureCoupledBase::temperatureCoupledBase -( - const fvPatch& patch, - const temperatureCoupledBase& base -) +Foam::patchKappa::patchKappa(const fvPatch& patch) : patch_(patch) {} @@ -61,53 +37,58 @@ Foam::temperatureCoupledBase::temperatureCoupledBase // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp Foam::temperatureCoupledBase::kappa -( - const fvPatchScalarField& Tp -) const +Foam::tmp Foam::patchKappa::kappa() const { const fvMesh& mesh = patch_.boundaryMesh().mesh(); const label patchi = patch_.index(); - const word& phase(Tp.internalField().group()); - - const word ttmName + if ( - IOobject::groupName + mesh.foundObject ( - thermophysicalTransportModel::typeName, - phase + thermophysicalTransportModel::typeName ) - ); - - if (mesh.foundObject(ttmName)) + ) { const thermophysicalTransportModel& ttm = - mesh.lookupObject(ttmName); + mesh.lookupObject + ( + thermophysicalTransportModel::typeName + ); return ttm.kappaEff(patchi); } - else if (mesh.foundObject(physicalProperties::typeName)) + else if + ( + mesh.foundObject + ( + solidThermophysicalTransportModel::typeName + ) + ) { - const solidThermo& thermo = - mesh.lookupObject(physicalProperties::typeName); + const solidThermophysicalTransportModel& sttm = + mesh.lookupObject + ( + solidThermophysicalTransportModel::typeName + ); - if (!thermo.isotropic()) + if (!sttm.thermo().isotropic()) { - const symmTensorField kappa(thermo.KappaLocal(patchi)); + const symmTensorField kappa(sttm.Kappa(patchi)); const vectorField n(patch_.nf()); return n & kappa & n; } else { - return thermo.kappa().boundaryField()[patchi]; + return sttm.kappa(patchi); } } else { FatalErrorInFunction - << "Cannot find a fluidThermo or solidThermo instance" + << "Cannot find a thermophysicalTransportModel " + "or solidThermophysicalTransportModel instance" << exit(FatalError); return scalarField::null(); @@ -115,8 +96,4 @@ Foam::tmp Foam::temperatureCoupledBase::kappa } -void Foam::temperatureCoupledBase::write(Ostream& os) const -{} - - // ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.H similarity index 54% rename from src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H rename to src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.H index c5c2c39a84..a789b4d39c 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H +++ b/src/ThermophysicalTransportModels/coupledThermophysicalTransportModels/patchKappa/patchKappa.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,36 +22,24 @@ License along with OpenFOAM. If not, see . Class - Foam::temperatureCoupledBase + Foam::patchKappa Description - Common functions used in temperature coupled boundaries. + Provides the patch thermal conductivity \c kappa for the fluid or solid + region an appropriate. - The thermal conductivity \c kappa is obtained from the region fluidThermo - or solidThermo as appropriate. - - For turbulent fluid regions \c kappa is obtained from the - thermophysicalTransportModel \c kappaEff. - - For solid regions kappa may be obtained from the anisotropic alpha field - by specifying the optional \c alphaAni field name. - - \par Keywords provided by this class: - \table - Property | Description | Required | Default value - alphaAni | Name of the non-isotropic alpha | no | - \endtable + For fluid regions \c kappaEff is obtained from the + Foam::thermophysicalTransportModel and for solid regions + \c kappa is obtained from the Foam::solidThermophysicalTransportModel. SourceFiles - temperatureCoupledBase.C + patchKappa.C \*---------------------------------------------------------------------------*/ -#ifndef temperatureCoupledBase_H -#define temperatureCoupledBase_H +#ifndef patchKappa_H +#define patchKappa_H -#include "scalarField.H" -#include "NamedEnum.H" #include "fvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,14 +48,14 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class temperatureCoupledBase Declaration + Class patchKappa Declaration \*---------------------------------------------------------------------------*/ -class temperatureCoupledBase +class patchKappa { // Private data - //- Underlying patch + //- Reference to the region patch const fvPatch& patch_; @@ -76,33 +64,16 @@ public: // Constructors //- Construct from patch - temperatureCoupledBase + patchKappa ( const fvPatch& patch ); - //- Construct from patch and dictionary - temperatureCoupledBase - ( - const fvPatch& patch, - const dictionary& dict - ); - - //- Construct from patch and temperatureCoupledBase - temperatureCoupledBase - ( - const fvPatch& patch, - const temperatureCoupledBase& base - ); - // Member Functions - //- Given patch temperature calculate corresponding K field - tmp kappa(const fvPatchScalarField& Tp) const; - - //- Write - void write(Ostream&) const; + //- Thermal conductivity for patch [W/m/K] + tmp kappa() const; }; diff --git a/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C index ceb1dd5628..c9b03b5fb9 100644 --- a/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C +++ b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,6 +51,8 @@ FickianFourier { read(); this->correct(); + + this->printCoeffs(typeName); } diff --git a/src/ThermophysicalTransportModels/laminar/MaxwellStefanFourier/MaxwellStefanFourier.C b/src/ThermophysicalTransportModels/laminar/MaxwellStefanFourier/MaxwellStefanFourier.C index 168fb1dfcf..d44cbaabe6 100644 --- a/src/ThermophysicalTransportModels/laminar/MaxwellStefanFourier/MaxwellStefanFourier.C +++ b/src/ThermophysicalTransportModels/laminar/MaxwellStefanFourier/MaxwellStefanFourier.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,6 +51,8 @@ MaxwellStefanFourier { read(); this->correct(); + + this->printCoeffs(typeName); } diff --git a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C index 14c8508ec3..c6d459773e 100644 --- a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C +++ b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,9 +32,7 @@ template void Foam::laminarThermophysicalTransportModel < BasicThermophysicalTransportModel ->::printCoeffs -( - const word& type) +>::printCoeffs(const word& type) { if (printCoeffs_) { diff --git a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.H index 393a4805c0..493abda3da 100644 --- a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.H @@ -146,7 +146,7 @@ public: return coeffDict_; } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const { @@ -157,7 +157,7 @@ public: ); } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const { diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/files b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/files new file mode 100644 index 0000000000..6a31886011 --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/files @@ -0,0 +1,5 @@ +solidThermophysicalTransportModel/solidThermophysicalTransportModel.C +isotropic/isotropic.C +anisotropic/anisotropic.C + +LIB = $(FOAM_LIBBIN)/libsolidThermophysicalTransportModels diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/options b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/options new file mode 100644 index 0000000000..23d5bae59f --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/Make/options @@ -0,0 +1,13 @@ +EXE_INC = \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +LIB_LIBS = \ + -lsolidThermo \ + -lspecie \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.C b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.C new file mode 100644 index 0000000000..30c1ab8b29 --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.C @@ -0,0 +1,342 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "anisotropic.H" +#include "fvmLaplacian.H" +#include "fvcLaplacian.H" +#include "fvcSnGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidThermophysicalTransportModels +{ + defineTypeNameAndDebug(anisotropic, 0); + addToRunTimeSelectionTable + ( + solidThermophysicalTransportModel, + anisotropic, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solidThermophysicalTransportModels::anisotropic:: +setZonesPatchFaces() const +{ + // Find all the patch faces adjacent to zones + + const fvMesh& mesh = thermo().mesh(); + const fvBoundaryMesh& patches = mesh.boundary(); + const labelList& own = mesh.faceOwner(); + + zonesPatchFaces_.setSize(zoneCoordinateSystems_.size()); + label zonei = 0; + + forAllConstIter + ( + PtrDictionary, + zoneCoordinateSystems_, + iter + ) + { + zonesPatchFaces_[zonei].setSize(patches.size()); + + const labelList& zoneCells = mesh.cellZones()[iter().name()]; + + // Cell in zone + boolList cellInZone(mesh.nCells(), false); + + forAll(zoneCells, i) + { + cellInZone[zoneCells[i]] = true; + } + + forAll(patches, patchi) + { + const fvPatch& pp = patches[patchi]; + + zonesPatchFaces_[zonei][patchi].setSize(pp.size()); + + label nZonePatchFaces = 0; + + forAll(pp, patchFacei) + { + const label facei = pp.start() + patchFacei; + + if (cellInZone[own[facei]]) + { + zonesPatchFaces_[zonei][patchi][nZonePatchFaces++] = + patchFacei; + } + } + + zonesPatchFaces_[zonei][patchi].setSize(nZonePatchFaces); + } + + zonei++; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidThermophysicalTransportModels::anisotropic::anisotropic +( + const solidThermo& thermo +) +: + solidThermophysicalTransportModel(typeName, thermo), + coordinateSystem_(coordinateSystem::New(thermo.mesh(), coeffDict())) +{ + if (coeffDict().found("zones")) + { + const dictionary& zonesDict(coeffDict().subDict("zones")); + + Info<< " Reading coordinate system for zones:" << endl; + + forAllConstIter(dictionary, zonesDict, iter) + { + if (iter().isDict()) + { + const word& name = iter().keyword(); + const dictionary& dict = iter().dict(); + + Info<< " " << name << endl; + + zoneCoordinateSystems_.insert + ( + name, + coordinateSystem::New(name, dict).ptr() + ); + } + } + + // Find all the patch faces adjacent to zones + setZonesPatchFaces(); + + Info << endl; + } + + this->printCoeffs(typeName); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::solidThermophysicalTransportModels::anisotropic::read() +{ + return true; +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::anisotropic::Kappa() const +{ + const solidThermo& thermo = this->thermo(); + const fvMesh& mesh = thermo.mesh(); + + if (zoneCoordinateSystems_.size() && mesh.topoChanged()) + { + setZonesPatchFaces(); + } + + const tmp tmaterialKappa(thermo.Kappa()); + const volVectorField& materialKappa = tmaterialKappa(); + + tmp tKappa + ( + volSymmTensorField::New + ( + "Kappa", + mesh, + dimensionedSymmTensor(materialKappa.dimensions(), Zero) + ) + ); + volSymmTensorField& Kappa = tKappa.ref(); + + Kappa.primitiveFieldRef() = + coordinateSystem_.R(mesh.C()).transformDiagTensor(materialKappa); + + forAll(Kappa.boundaryField(), patchi) + { + Kappa.boundaryFieldRef()[patchi] = + coordinateSystem_.R(mesh.boundary()[patchi].Cf()) + .transformDiagTensor(materialKappa.boundaryField()[patchi]); + } + + label zonei = 0; + + forAllConstIter + ( + PtrDictionary, + zoneCoordinateSystems_, + iter + ) + { + const labelList& zoneCells = mesh.cellZones()[iter().name()]; + const coordinateSystem& cs = iter(); + + forAll(zoneCells, i) + { + const label celli = zoneCells[i]; + + Kappa[celli] = + cs.R().transformDiagTensor + ( + mesh.C()[celli], + materialKappa[celli] + ); + } + + forAll(zonesPatchFaces_[zonei], patchi) + { + symmTensorField& KappaPf = Kappa.boundaryFieldRef()[patchi]; + + const vectorField& materialKappaPf = + materialKappa.boundaryField()[patchi]; + + const vectorField& CPf = mesh.boundary()[patchi].Cf(); + + forAll(zonesPatchFaces_[zonei][patchi], zonePatchFacei) + { + const label patchFacei = + zonesPatchFaces_[zonei][patchi][zonePatchFacei]; + + KappaPf[patchFacei] = + cs.R().transformDiagTensor + ( + CPf[patchFacei], + materialKappaPf[patchFacei] + ); + } + } + + zonei++; + } + + return tKappa; +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::anisotropic::Kappa +( + const label patchi +) const +{ + const solidThermo& thermo = this->thermo(); + const vectorField& CPf = thermo.mesh().boundary()[patchi].Cf(); + + const vectorField materialKappaPf(thermo.Kappa(patchi)); + + tmp tKappa + ( + coordinateSystem_.R(CPf).transformDiagTensor(materialKappaPf) + ); + symmTensorField& KappaPf = tKappa.ref(); + + label zonei = 0; + + forAllConstIter + ( + PtrDictionary, + zoneCoordinateSystems_, + iter + ) + { + const coordinateSystem& cs = iter(); + + forAll(zonesPatchFaces_[zonei][patchi], zonePatchFacei) + { + const label patchFacei = + zonesPatchFaces_[zonei][patchi][zonePatchFacei]; + + KappaPf[patchFacei] = + cs.R().transformDiagTensor + ( + CPf[patchFacei], + materialKappaPf[patchFacei] + ); + } + + zonei++; + } + + return tKappa; +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::anisotropic::q() const +{ + const solidThermo& thermo = this->thermo(); + const fvMesh& mesh = thermo.mesh(); + + return surfaceScalarField::New + ( + "q", + -fvm::laplacian(Kappa(), thermo.T())().flux()/mesh.magSf() + ); +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::anisotropic::divq +( + volScalarField& e +) const +{ + const solidThermo& thermo = this->thermo(); + const volSymmTensorField Kappa(this->Kappa()); + + // Return heat flux source as an implicit energy correction + // to the temperature gradient flux + return + -fvc::laplacian(Kappa, thermo.T()) + -correction + ( + fvm::laplacian + ( + Kappa/thermo.Cv(), + e, + "laplacian(alphae,e)" + ) + ); +} + + +void Foam::solidThermophysicalTransportModels::anisotropic::correct() +{ + solidThermophysicalTransportModel::correct(); +} + + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.H b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.H new file mode 100644 index 0000000000..d4798765ad --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/anisotropic/anisotropic.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +Class + Foam::solidThermophysicalTransportModels::anisotropic + +Description + Solid thermophysical transport model for anisotropic thermal conductivity + + The anisotropic thermal conductivity field is evaluated from the solid + material anisotropic kappa specified in the physicalProperties dictionary + transformed into the global coordinate system using default + coordinate system and optionally additional coordinate systems specified + per-zone in the thermophysicalProperties dictionary. + +Usage + Example of the anisotropic thermal conductivity specification in + thermophysicalProperties with two zone-based coordinate systems in + addition to the default: + + \verbatim + model anisotropic; + + // Default coordinate system + coordinateSystem + { + type cartesian; + origin (0 0 0); + coordinateRotation + { + type cylindrical; + e3 (1 0 0); + } + } + + // Optional zone coordinate systems + zones + { + coil1 + { + type cartesian; + origin (0.1 0.2 0.7); + coordinateRotation + { + type cylindrical; + e3 (0.5 0.866 0); + } + } + + coil2 + { + type cartesian; + origin (0.4 0.5 1); + coordinateRotation + { + type cylindrical; + e3 (0.866 0.5 0); + } + } + } + \endverbatim + +SourceFiles + anisotropic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef anisotropic_H +#define anisotropic_H + +#include "solidThermophysicalTransportModel.H" +#include "coordinateSystem.H" +#include "PtrDictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidThermophysicalTransportModels +{ + +/*---------------------------------------------------------------------------*\ + Class anisotropic Declaration +\*---------------------------------------------------------------------------*/ + +class anisotropic +: + public solidThermophysicalTransportModel +{ + // Private member data + + coordinateSystem coordinateSystem_; + + //- Optional zone coordinate systems + PtrDictionary zoneCoordinateSystems_; + + // List of patch faces adjacent to coordinate zones + mutable labelListListList zonesPatchFaces_; + + //- Find all the patch faces adjacent to zones + void setZonesPatchFaces() const; + + +public: + + //- Runtime type information + TypeName("anisotropic"); + + + // Constructors + + //- Construct from solid thermophysical properties + anisotropic(const solidThermo& thermo); + + + //- Destructor + virtual ~anisotropic() + {} + + + // Member Functions + + //- Read thermophysicalTransport dictionary + virtual bool read(); + + //- Thermal conductivity [W/m/K] + virtual tmp Kappa() const; + + //- Thermal conductivity for patch [W/m/K] + virtual tmp Kappa(const label patchi) const; + + //- Return the heat flux [W/m^2] + virtual tmp q() const; + + //- Return the source term for the energy equation + virtual tmp divq(volScalarField& he) const; + + //- Correct the anisotropic viscosity + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidThermophysicalTransportModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.C b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.C new file mode 100644 index 0000000000..da9944eb5c --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "isotropic.H" +#include "fvmLaplacian.H" +#include "fvcLaplacian.H" +#include "fvcSnGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidThermophysicalTransportModels +{ + defineTypeNameAndDebug(isotropic, 0); + addToRunTimeSelectionTable + ( + solidThermophysicalTransportModel, + isotropic, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidThermophysicalTransportModels::isotropic::isotropic +( + const solidThermo& thermo +) +: + solidThermophysicalTransportModel(typeName, thermo) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::dictionary& +Foam::solidThermophysicalTransportModels::isotropic::coeffDict() const +{ + return dictionary::null; +} + + +bool Foam::solidThermophysicalTransportModels::isotropic::read() +{ + return true; +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::isotropic::Kappa() const +{ + NotImplemented; + return volSymmTensorField::null(); +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::isotropic::Kappa +( + const label patchi +) const +{ + NotImplemented; + return symmTensorField::null(); +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::isotropic::q() const +{ + return surfaceScalarField::New + ( + "q", + -fvc::interpolate(kappa())*fvc::snGrad(thermo().T()) + ); +} + + +Foam::tmp +Foam::solidThermophysicalTransportModels::isotropic::divq +( + volScalarField& e +) const +{ + const solidThermo& thermo = this->thermo(); + + // Return heat flux source as an implicit energy correction + // to the temperature gradient flux + return + -fvc::laplacian(kappa(), thermo.T()) + -correction + ( + fvm::laplacian + ( + kappa()/thermo.Cv(), + e, + "laplacian(alphae,e)" + ) + ); +} + + +void Foam::solidThermophysicalTransportModels::isotropic::correct() +{ + solidThermophysicalTransportModel::correct(); +} + + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.H b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.H new file mode 100644 index 0000000000..356a5a3e31 --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/isotropic/isotropic.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +Class + Foam::solidThermophysicalTransportModels::isotropic + +Description + Solid thermophysical transport model for isotropic thermal conductivity + + This is the default transport model for solids and selected automatically if + the thermophysicalTransport dictionary is not present in the constant or + region directory. + +SourceFiles + isotropic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef isotropic_H +#define isotropic_H + +#include "solidThermophysicalTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidThermophysicalTransportModels +{ + +/*---------------------------------------------------------------------------*\ + Class isotropic Declaration +\*---------------------------------------------------------------------------*/ + +class isotropic +: + public solidThermophysicalTransportModel +{ + +public: + + //- Runtime type information + TypeName("isotropic"); + + + // Constructors + + //- Construct from solid thermophysical properties + isotropic(const solidThermo& thermo); + + + //- Destructor + virtual ~isotropic() + {} + + + // Member Functions + + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const; + + //- Read thermophysicalTransport dictionary + virtual bool read(); + + //- Thermal conductivity [W/m/K] + virtual tmp Kappa() const; + + //- Thermal conductivity for patch [W/m/K] + virtual tmp Kappa(const label patchi) const; + + //- Return the heat flux [W/m^2] + virtual tmp q() const; + + //- Return the source term for the energy equation + virtual tmp divq(volScalarField& he) const; + + //- Correct the isotropic viscosity + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidThermophysicalTransportModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.C b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.C new file mode 100644 index 0000000000..8a284b0394 --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "solidThermophysicalTransportModel.H" +#include "isotropic.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(solidThermophysicalTransportModel, 0); + defineRunTimeSelectionTable(solidThermophysicalTransportModel, dictionary); +} + + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::solidThermophysicalTransportModel::printCoeffs +(const word& type) +{ + if (printCoeffs_) + { + Info<< coeffDict_.dictName() << coeffDict_ << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidThermophysicalTransportModel::solidThermophysicalTransportModel +( + const word& type, + const solidThermo& thermo +) +: + IOdictionary + ( + IOobject + ( + typeName, + thermo.mesh().time().constant(), + thermo.mesh(), + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ) + ), + + thermo_(thermo), + printCoeffs_(lookupOrDefault("printCoeffs", false)), + coeffDict_(optionalSubDict(type + "Coeffs")) +{ + // Add run-time re-reading of thermophysicalTransport dictionary + // after construction to avoid problems if the dictionary is not present + readOpt() = IOobject::MUST_READ_IF_MODIFIED; + addWatch(); +} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::solidThermophysicalTransportModel::New(const solidThermo& thermo) +{ + typeIOobject header + ( + solidThermophysicalTransportModel::typeName, + thermo.mesh().time().constant(), + thermo.mesh(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + if (header.headerOk()) + { + const word modelType(IOdictionary(header).lookup("model")); + + Info<< "Selecting solid thermophysical transport model " + << modelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown solid thermophysical transport model " + << modelType << nl << nl + << "Available models:" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter()(thermo) + ); + } + else + { + Info<< "Selecting default solid thermophysical transport model " + << solidThermophysicalTransportModels::isotropic::typeName + << endl; + + return autoPtr + ( + new solidThermophysicalTransportModels::isotropic(thermo) + ); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::solidThermophysicalTransportModel::kappa() const +{ + return thermo().kappa(); +} + + +Foam::tmp +Foam::solidThermophysicalTransportModel::kappa +( + const label patchi +) const +{ + return thermo().kappa().boundaryField()[patchi]; +} + + +bool Foam::solidThermophysicalTransportModel::read() +{ + if (regIOobject::read()) + { + coeffDict_ <<= optionalSubDict(type() + "Coeffs"); + return true; + } + else + { + return false; + } +} + + +void Foam::solidThermophysicalTransportModel::correct() +{} + + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.H new file mode 100644 index 0000000000..00fbda6b75 --- /dev/null +++ b/src/ThermophysicalTransportModels/solidThermophysicalTransportModels/solidThermophysicalTransportModel/solidThermophysicalTransportModel.H @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +Class + Foam::solidThermophysicalTransportModel + +Description + Abstract base class for thermophysical transport models + (RAS, LES and laminar). + +SourceFiles + solidThermophysicalTransportModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solidThermophysicalTransportModel_H +#define solidThermophysicalTransportModel_H + +#include "solidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class solidThermophysicalTransportModel Declaration +\*---------------------------------------------------------------------------*/ + +class solidThermophysicalTransportModel +: + public IOdictionary +{ +protected: + + // Protected data + + //- Reference to the solid thermophysical properties + const solidThermo& thermo_; + + //- Flag to print the model coeffs at run-time + Switch printCoeffs_; + + //- Model coefficients dictionary + dictionary coeffDict_; + + + // Protected Member Functions + + //- Print model coefficients + virtual void printCoeffs(const word& type); + + +public: + + //- Runtime type information + TypeName("thermophysicalTransport"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + solidThermophysicalTransportModel, + dictionary, + ( + const solidThermo& thermo + ), + (thermo) + ); + + + // Constructors + + //- Construct from solid thermophysical properties + solidThermophysicalTransportModel + ( + const word& type, + const solidThermo& thermo + ); + + //- Disallow default bitwise copy construction + solidThermophysicalTransportModel + ( + const solidThermophysicalTransportModel& + ) = delete; + + + // Selectors + + //- Return a reference to the selected thermophysical transport model + static autoPtr New + ( + const solidThermo& thermo + ); + + + //- Destructor + virtual ~solidThermophysicalTransportModel() + {} + + + // Member Functions + + //- Read model coefficients if they have changed + virtual bool read() = 0; + + //- Access function to solid thermophysical properties + virtual const solidThermo& thermo() const + { + return thermo_; + } + + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const + { + return coeffDict_; + } + + //- Thermal conductivity [W/m/K] + virtual tmp kappa() const; + + //- Thermal conductivity for patch [W/m/K] + virtual tmp kappa(const label patchi) const; + + //- Thermal conductivity [W/m/K] + virtual tmp Kappa() const = 0; + + //- Thermal conductivity for patch [W/m/K] + virtual tmp Kappa(const label patchi) const = 0; + + //- Return the heat flux [W/m^2] + virtual tmp q() const = 0; + + //- Return the source term for the energy equation + virtual tmp divq(volScalarField& he) const = 0; + + //- Solve the thermophysical transport model equations + // and correct the transport coefficients + virtual void correct() = 0; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const solidThermophysicalTransportModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/thermophysicalTransportModel/thermophysicalTransportModel.H b/src/ThermophysicalTransportModels/thermophysicalTransportModel/thermophysicalTransportModel.H index bd01ba6f08..2f92b1bb6c 100644 --- a/src/ThermophysicalTransportModels/thermophysicalTransportModel/thermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/thermophysicalTransportModel/thermophysicalTransportModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -90,22 +90,23 @@ public: //- Read model coefficients if they have changed virtual bool read() = 0; + //- Access function to momentum transport model const compressibleMomentumTransportModel& momentumTransport() const { return momentumTransportModel_; } - //- Access function to incompressible transport model + //- Access function to fluid thermophysical properties virtual const fluidThermo& thermo() const = 0; //- Const access to the coefficients dictionary virtual const dictionary& coeffDict() const = 0; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const = 0; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; diff --git a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C index dd2ad07f46..f28cb0575c 100644 --- a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,6 +53,8 @@ FickianEddyDiffusivity { read(); this->correct(); + + this->printCoeffs(typeName); } diff --git a/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H index bbb201d32e..4e7ed9451f 100644 --- a/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,11 +146,11 @@ public: return coeffDict_; } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const = 0; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; diff --git a/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H index 9f0783e473..7fbe5a5c06 100644 --- a/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,11 +146,11 @@ public: return coeffDict_; } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const = 0; - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; diff --git a/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H index d5a7826665..25e174511f 100644 --- a/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H @@ -135,14 +135,14 @@ public: return alphat()().boundaryField()[patchi]; } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const { return this->thermo().kappa() + this->thermo().Cp()*alphat(); } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const { diff --git a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C index 7f25e52b64..b3e9b7a802 100644 --- a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C @@ -56,7 +56,9 @@ nonUnityLewisEddyDiffusivity ), Sct_("Sct", dimless, this->coeffDict_) -{} +{ + this->printCoeffs(typeName); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C index c29c7a012e..64509c12c3 100644 --- a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,9 @@ unityLewisEddyDiffusivity thermo, false ) -{} +{ + this->printCoeffs(typeName); +} template @@ -116,7 +118,12 @@ unityLewisEddyDiffusivity ), momentumTransport.mesh() ) -{} +{ + if (type == typeName) + { + this->printCoeffs(type); + } +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H index a46488a38d..ac59babe8a 100644 --- a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H @@ -143,14 +143,14 @@ public: return alphat()().boundaryField()[patchi]; } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture [W/m/K] virtual tmp kappaEff() const { return this->thermo().kappa() + this->thermo().Cp()*alphat(); } - //- Effective thermal turbulent diffusivity for temperature + //- Effective thermal turbulent conductivity // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const { diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C index f39a343929..3e9c5530b8 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C @@ -89,7 +89,7 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData() D_[zoneI][0].yy() = dXYZ_.value().y(); D_[zoneI][0].zz() = dXYZ_.value().z(); - D_[zoneI][0] = coordSys_.R().transformTensor(D_[zoneI][0]); + D_[zoneI][0] = coordSys_.R().transform(Zero, D_[zoneI][0]); // leading 0.5 is from 1/2*rho F_[zoneI][0] = Zero; @@ -97,7 +97,7 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData() F_[zoneI][0].yy() = 0.5*fXYZ_.value().y(); F_[zoneI][0].zz() = 0.5*fXYZ_.value().z(); - F_[zoneI][0] = coordSys_.R().transformTensor(F_[zoneI][0]); + F_[zoneI][0] = coordSys_.R().transform(Zero, F_[zoneI][0]); } } else @@ -128,8 +128,8 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData() UIndirectList(mesh_.C(), cells)() ); - D_[zoneI] = R.transformTensor(D_[zoneI]); - F_[zoneI] = R.transformTensor(F_[zoneI]); + D_[zoneI] = R.transform(D_[zoneI]); + F_[zoneI] = R.transform(F_[zoneI]); } } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C index 45303cea85..3705514ee9 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -144,13 +144,13 @@ void Foam::porosityModels::fixedCoeff::calcTransformModelData() alpha_[zoneI][0].xx() = alphaXYZ_.value().x(); alpha_[zoneI][0].yy() = alphaXYZ_.value().y(); alpha_[zoneI][0].zz() = alphaXYZ_.value().z(); - alpha_[zoneI][0] = coordSys_.R().transformTensor(alpha_[zoneI][0]); + alpha_[zoneI][0] = coordSys_.R().transform(Zero, alpha_[zoneI][0]); beta_[zoneI][0] = Zero; beta_[zoneI][0].xx() = betaXYZ_.value().x(); beta_[zoneI][0].yy() = betaXYZ_.value().y(); beta_[zoneI][0].zz() = betaXYZ_.value().z(); - beta_[zoneI][0] = coordSys_.R().transformTensor(beta_[zoneI][0]); + beta_[zoneI][0] = coordSys_.R().transform(Zero, beta_[zoneI][0]); } } else @@ -180,8 +180,8 @@ void Foam::porosityModels::fixedCoeff::calcTransformModelData() UIndirectList(mesh_.C(), cells)() ); - alpha_[zoneI] = R.transformTensor(alpha_[zoneI]); - beta_[zoneI] = R.transformTensor(beta_[zoneI]); + alpha_[zoneI] = R.transform(alpha_[zoneI]); + beta_[zoneI] = R.transform(beta_[zoneI]); } } } diff --git a/src/functionObjects/field/Lambda2/Lambda2.H b/src/functionObjects/field/Lambda2/Lambda2.H index 7233f4cd7a..236c781b9f 100644 --- a/src/functionObjects/field/Lambda2/Lambda2.H +++ b/src/functionObjects/field/Lambda2/Lambda2.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Class Description Calculates and outputs the second largest eigenvalue of the sum of the - square of the symmetrical and anti-symmetrical parts of the velocity + square of the symmetric and anti-symmetric parts of the velocity gradient tensor. See also diff --git a/src/functionObjects/field/Make/options b/src/functionObjects/field/Make/options index 2da53455af..c3b96e52ca 100644 --- a/src/functionObjects/field/Make/options +++ b/src/functionObjects/field/Make/options @@ -12,7 +12,8 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude + -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -23,6 +24,7 @@ LIB_LIBS = \ -lincompressibleMomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ + -lsolidThermophysicalTransportModels \ -lmeshTools \ -lsurfMesh \ -llagrangian \ diff --git a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C index 35c5a6c34f..0ca72f5856 100644 --- a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C +++ b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C @@ -25,6 +25,7 @@ License #include "wallHeatFlux.H" #include "thermophysicalTransportModel.H" +#include "solidThermophysicalTransportModel.H" #include "solidThermo.H" #include "surfaceInterpolate.H" #include "fvcGrad.H" @@ -219,12 +220,21 @@ bool Foam::functionObjects::wallHeatFlux::execute() return store(fieldName, calcWallHeatFlux(ttm.q())); } - else if (foundObject(physicalProperties::typeName)) + else if + ( + foundObject + ( + solidThermophysicalTransportModel::typeName + ) + ) { - const solidThermo& thermo = - lookupObject(physicalProperties::typeName); + const solidThermophysicalTransportModel& sttm = + lookupObject + ( + solidThermophysicalTransportModel::typeName + ); - return store(fieldName, calcWallHeatFlux(thermo.q())); + return store(fieldName, calcWallHeatFlux(sttm.q())); } else { diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index 43f612ae71..de5cce4e9f 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,24 +125,21 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::vector Foam::EulerCoordinateRotation::transform(const vector& st) const +Foam::vector Foam::EulerCoordinateRotation::transform(const vector& v) const { - return (R_ & st); + return (R_ & v); } -Foam::vector Foam::EulerCoordinateRotation::invTransform -( - const vector& st -) const +Foam::vector Foam::EulerCoordinateRotation::invTransform(const vector& v) const { - return (Rtr_ & st); + return (Rtr_ & v); } Foam::tmp Foam::EulerCoordinateRotation::transform ( - const vectorField& st + const vectorField& vf ) const { NotImplemented; @@ -152,7 +149,7 @@ Foam::tmp Foam::EulerCoordinateRotation::transform Foam::tmp Foam::EulerCoordinateRotation::invTransform ( - const vectorField& st + const vectorField& vf ) const { NotImplemented; @@ -160,9 +157,9 @@ Foam::tmp Foam::EulerCoordinateRotation::invTransform } -Foam::tmp Foam::EulerCoordinateRotation::transformTensor +Foam::tmp Foam::EulerCoordinateRotation::transform ( - const tensorField& st + const tensorField& volSymmTensorField ) const { NotImplemented; @@ -170,38 +167,40 @@ Foam::tmp Foam::EulerCoordinateRotation::transformTensor } -Foam::tensor Foam::EulerCoordinateRotation::transformTensor +Foam::tensor Foam::EulerCoordinateRotation::transform ( - const tensor& st + const vector& p, + const tensor& t ) const { - return (R_ & st & Rtr_); + return (R_ & t & Rtr_); } Foam::tmp Foam::EulerCoordinateRotation:: -transformVector +transformDiagTensor ( - const vectorField& st + const vectorField& vf ) const { - tmp tfld(new symmTensorField(st.size())); + tmp tfld(new symmTensorField(vf.size())); symmTensorField& fld = tfld.ref(); forAll(fld, i) { - fld[i] = transformPrincipal(R_, st[i]); + fld[i] = transformVectorDiagTensor(R_, vf[i]); } return tfld; } -Foam::symmTensor Foam::EulerCoordinateRotation::transformVector +Foam::symmTensor Foam::EulerCoordinateRotation::transformDiagTensor ( - const vector& st + const vector& p, + const vector& v ) const { - return transformPrincipal(R_, st); + return transformVectorDiagTensor(R_, v); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H index c911255f79..f30dc338c2 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -145,33 +145,37 @@ public: } //- Transform vectorField using transformation tensor field - virtual tmp transform(const vectorField& st) const; + virtual tmp transform(const vectorField& vf) const; //- Transform vector using transformation tensor - virtual vector transform(const vector& st) const; + virtual vector transform(const vector& v) const; //- Inverse transform vectorField using transformation tensor field - virtual tmp invTransform(const vectorField& st) const; + virtual tmp invTransform(const vectorField& vf) const; //- Inverse transform vector using transformation tensor - virtual vector invTransform(const vector& st) const; + virtual vector invTransform(const vector& v) const; //- Transform tensor field using transformation tensorField - virtual tmp transformTensor(const tensorField& st) const; + virtual tmp transform(const tensorField& tf) const; //- Transform tensor using transformation tensorField - virtual tensor transformTensor(const tensor& st) const; + virtual tensor transform(const vector& p, const tensor& t) const; - //- Transform vectorField using transformation tensorField and return - // symmetrical tensorField - virtual tmp transformVector + //- Transform diagTensor masquerading as a vector using transformation + // tensor and return symmTensor + virtual symmTensor transformDiagTensor ( - const vectorField& st + const vector& p, + const vector& v ) const; - //- Transform vector using transformation tensor and return - // symmetrical tensor - virtual symmTensor transformVector(const vector& st) const; + //- Transform diagTensorField masquerading as a vectorField + // using transformation tensorField and return symmTensorField + virtual tmp transformDiagTensor + ( + const vectorField& vf + ) const; // Write diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index ed8c61d25c..f475a14910 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,24 +125,21 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::vector Foam::STARCDCoordinateRotation::transform(const vector& st) const +Foam::vector Foam::STARCDCoordinateRotation::transform(const vector& v) const { - return (R_ & st); + return (R_ & v); } -Foam::vector Foam::STARCDCoordinateRotation::invTransform -( - const vector& st -) const +Foam::vector Foam::STARCDCoordinateRotation::invTransform(const vector& v) const { - return (Rtr_ & st); + return (Rtr_ & v); } Foam::tmp Foam::STARCDCoordinateRotation::transform ( - const vectorField& st + const vectorField& vf ) const { NotImplemented; @@ -152,7 +149,7 @@ Foam::tmp Foam::STARCDCoordinateRotation::transform Foam::tmp Foam::STARCDCoordinateRotation::invTransform ( - const vectorField& st + const vectorField& vf ) const { NotImplemented; @@ -160,48 +157,50 @@ Foam::tmp Foam::STARCDCoordinateRotation::invTransform } -Foam::tmp Foam::STARCDCoordinateRotation::transformTensor +Foam::tmp Foam::STARCDCoordinateRotation::transform ( - const tensorField& st + const tensorField& tf ) const { - NotImplemented; + NotImplemented; return tmp(nullptr); } -Foam::tensor Foam::STARCDCoordinateRotation::transformTensor +Foam::tensor Foam::STARCDCoordinateRotation::transform ( - const tensor& st + const vector& p, + const tensor& t ) const { - return (R_ & st & Rtr_); + return (R_ & t & Rtr_); } Foam::tmp Foam::STARCDCoordinateRotation:: -transformVector +transformDiagTensor ( - const vectorField& st + const vectorField& vf ) const { - tmp tfld(new symmTensorField(st.size())); + tmp tfld(new symmTensorField(vf.size())); symmTensorField& fld = tfld.ref(); forAll(fld, i) { - fld[i] = transformPrincipal(R_, st[i]); + fld[i] = transformVectorDiagTensor(R_, vf[i]); } return tfld; } -Foam::symmTensor Foam::STARCDCoordinateRotation::transformVector +Foam::symmTensor Foam::STARCDCoordinateRotation::transformDiagTensor ( - const vector& st + const vector& p, + const vector& v ) const { - return transformPrincipal(R_, st); + return transformVectorDiagTensor(R_, v); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H index b57ca4a8f0..46bd53569a 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,33 +146,37 @@ public: } //- Transform vectorField using transformation tensor field - virtual tmp transform(const vectorField& st) const; + virtual tmp transform(const vectorField& vf) const; //- Transform vector using transformation tensor - virtual vector transform(const vector& st) const; + virtual vector transform(const vector& v) const; //- Inverse transform vectorField using transformation tensor field - virtual tmp invTransform(const vectorField& st) const; + virtual tmp invTransform(const vectorField& vf) const; //- Inverse transform vector using transformation tensor - virtual vector invTransform(const vector& st) const; + virtual vector invTransform(const vector& v) const; //- Transform tensor field using transformation tensorField - virtual tmp transformTensor(const tensorField& st) const; + virtual tmp transform(const tensorField& tf) const; //- Transform tensor using transformation tensorField - virtual tensor transformTensor(const tensor& st) const; + virtual tensor transform(const vector& p, const tensor& t) const; - //- Transform vectorField using transformation tensorField and return - // symmetrical tensorField - virtual tmp transformVector + //- Transform diagTensor masquerading as a vector using transformation + // tensor and return symmTensor + virtual symmTensor transformDiagTensor ( - const vectorField& st + const vector& p, + const vector& v ) const; - //- Transform vector using transformation tensor and return - // symmetrical tensor - virtual symmTensor transformVector(const vector& st) const; + //- Transform diagTensorField masquerading as a vectorField + // using transformation tensorField and return symmTensorField + virtual tmp transformDiagTensor + ( + const vectorField& vf + ) const; // Write diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C index 92670d7ab5..f5da82e86a 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,37 +146,37 @@ Foam::axesRotation::axesRotation Foam::tmp Foam::axesRotation::transform ( - const vectorField& st + const vectorField& vf ) const { - return (R_ & st); + return (R_ & vf); } -Foam::vector Foam::axesRotation::transform(const vector& st) const +Foam::vector Foam::axesRotation::transform(const vector& v) const { - return (R_ & st); + return (R_ & v); } Foam::tmp Foam::axesRotation::invTransform ( - const vectorField& st + const vectorField& vf ) const { - return (Rtr_ & st); + return (Rtr_ & vf); } -Foam::vector Foam::axesRotation::invTransform(const vector& st) const +Foam::vector Foam::axesRotation::invTransform(const vector& v) const { - return (Rtr_ & st); + return (Rtr_ & v); } -Foam::tmp Foam::axesRotation::transformTensor +Foam::tmp Foam::axesRotation::transform ( - const tensorField& st + const tensorField& tf ) const { NotImplemented; @@ -184,37 +184,39 @@ Foam::tmp Foam::axesRotation::transformTensor } -Foam::tensor Foam::axesRotation::transformTensor +Foam::tensor Foam::axesRotation::transform ( - const tensor& st + const vector& p, + const tensor& t ) const { - return (R_ & st & Rtr_); + return (R_ & t & Rtr_); } -Foam::tmp Foam::axesRotation::transformVector +Foam::tmp Foam::axesRotation::transformDiagTensor ( - const vectorField& st + const vectorField& vf ) const { - tmp tfld(new symmTensorField(st.size())); + tmp tfld(new symmTensorField(vf.size())); symmTensorField& fld = tfld.ref(); forAll(fld, i) { - fld[i] = transformPrincipal(R_, st[i]); + fld[i] = transformVectorDiagTensor(R_, vf[i]); } return tfld; } -Foam::symmTensor Foam::axesRotation::transformVector +Foam::symmTensor Foam::axesRotation::transformDiagTensor ( - const vector& st + const vector& p, + const vector& v ) const { - return transformPrincipal(R_, st); + return transformVectorDiagTensor(R_, v); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H index 4a673b4687..336849dae2 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,34 +154,38 @@ public: return Rtr_.z(); } - //- Transform vectorField using transformation tensor field - virtual tmp transform(const vectorField& st) const; - //- Transform vector using transformation tensor - virtual vector transform(const vector& st) const; + virtual vector transform(const vector& v) const; - //- Inverse transform vectorField using transformation tensor field - virtual tmp invTransform(const vectorField& st) const; + //- Transform vectorField using transformation tensor field + virtual tmp transform(const vectorField& tf) const; //- Inverse transform vector using transformation tensor - virtual vector invTransform(const vector& st) const; + virtual vector invTransform(const vector& v) const; - //- Transform tensor field using transformation tensorField - virtual tmp transformTensor(const tensorField& st) const; + //- Inverse transform vectorField using transformation tensor field + virtual tmp invTransform(const vectorField& vf) const; //- Transform tensor using transformation tensorField - virtual tensor transformTensor(const tensor& st) const; + virtual tensor transform(const vector& p, const tensor& t) const; - //- Transform vectorField using transformation tensorField and return - // symmetric tensorField - virtual tmp transformVector + //- Transform tensor field using transformation tensorField + virtual tmp transform(const tensorField& tf) const; + + //- Transform diagTensor masquerading as a vector using transformation + // tensor and return symmTensor + virtual symmTensor transformDiagTensor ( - const vectorField& st + const vector& p, + const vector& v ) const; - //- Transform vector using transformation tensor and return - // symmetric tensor - virtual symmTensor transformVector(const vector& st) const; + //- Transform diagTensorField masquerading as a vectorField + // using transformation tensorField and return symmTensorField + virtual tmp transformDiagTensor + ( + const vectorField& vf + ) const; // Member Operators diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C index 429f58947a..251f254884 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ namespace Foam // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::symmTensor Foam::coordinateRotation::transformPrincipal +Foam::symmTensor Foam::coordinateRotation::transformVectorDiagTensor ( const tensor& tt, const vector& st diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index ae91005e22..c2306a0fac 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,8 +74,12 @@ protected: // Protected member functions - //- Transform principal - symmTensor transformPrincipal(const tensor&, const vector&) const; + //- Transform the vector as if it is a diagonal tensor + symmTensor transformVectorDiagTensor + ( + const tensor&, + const vector& + ) const; public: @@ -162,35 +166,43 @@ public: } //- Transform vector using transformation tensor - virtual vector transform(const vector& st) const = 0; + virtual vector transform(const vector& v) const = 0; //- Transform vectorField using transformation tensor field - virtual tmp transform(const vectorField& st) const = 0; + virtual tmp transform(const vectorField& vf) const = 0; //- Inverse transform vector using transformation tensor - virtual vector invTransform(const vector& st) const = 0; + virtual vector invTransform(const vector& v) const = 0; //- Inverse transform vectorField using transformation tensor field - virtual tmp invTransform(const vectorField& st) const = 0; + virtual tmp invTransform(const vectorField& vf) const = 0; //- Transform tensor using transformation tensorField - virtual tensor transformTensor(const tensor& st) const = 0; - - //- Transform tensor field using transformation tensorField - virtual tmp transformTensor + virtual tensor transform ( - const tensorField& st + const vector& p, + const tensor& t ) const = 0; - //- Transform vector using transformation tensor and return - // symmetrical tensor - virtual symmTensor transformVector(const vector& st) const = 0; - - //- Transform vectorField using transformation tensorField and return - // symmetrical tensorField - virtual tmp transformVector + //- Transform tensor field using transformation tensorField + virtual tmp transform ( - const vectorField& st + const tensorField& tf + ) const = 0; + + //- Transform diagTensor masquerading as a vector using transformation + // tensor and return symmTensor + virtual symmTensor transformDiagTensor + ( + const vector& p, + const vector& v + ) const = 0; + + //- Transform diagTensorField masquerading as a vectorField + // using transformation tensorField and return symmTensorField + virtual tmp transformDiagTensor + ( + const vectorField& vf ) const = 0; diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C index f235b665e0..3630a8db98 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,7 +204,7 @@ Foam::vector Foam::cylindrical::invTransform } -Foam::tmp Foam::cylindrical::transformTensor +Foam::tmp Foam::cylindrical::transform ( const tensorField& tf ) const @@ -219,17 +219,18 @@ Foam::tmp Foam::cylindrical::transformTensor } -Foam::tensor Foam::cylindrical::transformTensor +Foam::tensor Foam::cylindrical::transform ( + const vector& p, const tensor& t ) const { - NotImplemented; - return Zero; + const tensor R(this->R(p)); + return (R & t & R.T()); } -Foam::tmp Foam::cylindrical::transformVector +Foam::tmp Foam::cylindrical::transformDiagTensor ( const vectorField& vf ) const @@ -247,19 +248,19 @@ Foam::tmp Foam::cylindrical::transformVector const tensorField& R = Rptr_(); forAll(fld, i) { - fld[i] = transformPrincipal(R[i], vf[i]); + fld[i] = transformVectorDiagTensor(R[i], vf[i]); } return tfld; } -Foam::symmTensor Foam::cylindrical::transformVector +Foam::symmTensor Foam::cylindrical::transformDiagTensor ( + const vector& p, const vector& v ) const { - NotImplemented; - return Zero; + return transformVectorDiagTensor(R(p), v); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H index 695d90f51b..38765e8816 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -185,18 +185,22 @@ public: virtual vector invTransform(const vector& v, const label cmptI) const; //- Transform tensor using transformation tensorField - virtual tensor transformTensor(const tensor& t) const; + virtual tensor transform(const vector& p, const tensor& t) const; //- Transform tensor field using transformation tensorField - virtual tmp transformTensor(const tensorField& tf) const; + virtual tmp transform(const tensorField& tf) const; - //- Transform vector using transformation tensor and return - // symmetrical tensor - virtual symmTensor transformVector(const vector& v) const; + //- Transform diagTensor masquerading as a vector using transformation + // tensor and return symmTensor + virtual symmTensor transformDiagTensor + ( + const vector& p, + const vector& v + ) const; - //- Transform vectorField using transformation tensorField and return - // symmetrical tensorField - virtual tmp transformVector + //- Transform diagTensorField masquerading as a vectorField + // using transformation tensorField and return symmTensorField + virtual tmp transformDiagTensor ( const vectorField& vf ) const; diff --git a/src/regionModels/thermalBaffle/Make/options b/src/regionModels/thermalBaffle/Make/options index 59c460b25d..ef905fc528 100644 --- a/src/regionModels/thermalBaffle/Make/options +++ b/src/regionModels/thermalBaffle/Make/options @@ -5,8 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/radiationModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/solidThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/mesh/extrudeModel/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ @@ -16,8 +16,8 @@ LIB_LIBS = \ -lregionModels \ -lsolidThermo \ -lmomentumTransportModels \ - -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ + -lsolidThermophysicalTransportModels \ + -lcoupledThermophysicalTransportModels \ -lradiationModels \ -ldynamicMesh \ -lfiniteVolume \ diff --git a/src/regionModels/thermalBaffle/thermalBaffle/thermalBaffle.C b/src/regionModels/thermalBaffle/thermalBaffle/thermalBaffle.C index e37a6eb263..c433515773 100644 --- a/src/regionModels/thermalBaffle/thermalBaffle/thermalBaffle.C +++ b/src/regionModels/thermalBaffle/thermalBaffle/thermalBaffle.C @@ -47,7 +47,7 @@ defineTypeNameAndDebug(thermalBaffle, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -tmp thermalBaffle::calcDelta() const +tmp thermalBaffle::calcThickness() const { if (intCoupledPatchIDs_.size() != 2) { @@ -131,7 +131,7 @@ tmp thermalBaffle::calcDelta() const ); // Unpack distances into a dimensioned field and return - tmp tDelta + tmp tThickness ( new volScalarField::Internal ( @@ -148,7 +148,7 @@ tmp thermalBaffle::calcDelta() const dimLength ) ); - volScalarField::Internal& delta = tDelta.ref(); + volScalarField::Internal& thickness = tThickness.ref(); forAll(cellInfoDeltas, celli) { @@ -162,10 +162,10 @@ tmp thermalBaffle::calcDelta() const << exit(FatalError); } - delta[celli] = cellInfoDeltas[celli].data(); + thickness[celli] = cellInfoDeltas[celli].data(); } - return tDelta; + return tThickness; } @@ -189,40 +189,17 @@ void thermalBaffle::solveEnergy() { DebugInFunction << endl; - // Modify thermo density and diffusivity to take into account the thickness - volScalarField dByT - ( - volScalarField::New - ( - "dByT", - regionMesh(), - dimless, - extrapolatedCalculatedFvPatchField::typeName - ) - ); - dByT.ref() = delta_/thickness_; - dByT.correctBoundaryConditions(); - const volScalarField rho("rho", thermo_->rho()*dByT); - const volScalarField alphahe("alphahe", thermo_->alphahe()*dByT); + volScalarField& e = thermo_->he(); + const volScalarField& rho = thermo_->rho(); fvScalarMatrix hEqn ( - fvm::ddt(rho, he_) - - fvm::laplacian(alphahe, he_) + fvm::ddt(rho, e) + + thermophysicalTransport_->divq(e) == Q_ + Qs_/thickness_ ); - if (regionMesh().moving()) - { - surfaceScalarField phiMesh - ( - fvc::interpolate(rho*he_)*regionMesh().phi() - ); - - hEqn -= fvc::div(phiMesh); - } - hEqn.relax(); hEqn.solve(); @@ -243,22 +220,10 @@ thermalBaffle::thermalBaffle ) : regionModel(mesh, "thermalBaffle", modelType, dict, true), - delta_(calcDelta()), - thickness_ - ( - IOobject - ( - "thickness", - regionMesh().pointsInstance(), - regionMesh(), - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ), - delta_ - ), + thickness_(calcThickness()), nNonOrthCorr_(solution().lookup