Merge before going on
--HG-- branch : bgschaid/minorAdditionsBranch
This commit is contained in:
commit
6b15791cc7
232 changed files with 15727 additions and 534 deletions
41
ThirdParty/rpmBuild/SOURCES/ParaView-3.14.1.patch_2
vendored
Normal file
41
ThirdParty/rpmBuild/SOURCES/ParaView-3.14.1.patch_2
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
From 1d6745888bcc34b260410a3cdbba49ecf0084ba2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Utkarsh Ayachit <utkarsh.ayachit@kitware.com>
|
||||||
|
Date: Tue, 17 Apr 2012 14:54:05 -0400
|
||||||
|
Subject: [PATCH] BUG #13101. STL ascii reader was report failures prematurely.
|
||||||
|
|
||||||
|
STL ascii reader was reporting error when eof was reached at an expected
|
||||||
|
location. This was causing the reader to fail for the STL file attached with the
|
||||||
|
bug report.
|
||||||
|
|
||||||
|
Change-Id: I734d2c8d8c85854df3d2a63bae6ba23bccf7a9c2
|
||||||
|
---
|
||||||
|
IO/vtkSTLReader.cxx | 13 ++++++++-----
|
||||||
|
1 files changed, 8 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/IO/vtkSTLReader.cxx b/IO/vtkSTLReader.cxx
|
||||||
|
index 189ea1b..34ee3e0 100644
|
||||||
|
--- a/VTK/IO/vtkSTLReader.cxx
|
||||||
|
+++ b/VTK/IO/vtkSTLReader.cxx
|
||||||
|
@@ -442,12 +442,15 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
|
||||||
|
{
|
||||||
|
if (!fgets(line, 255, fp))
|
||||||
|
{
|
||||||
|
- vtkErrorMacro ("STLReader error reading file: " << this->FileName
|
||||||
|
- << " Premature EOF while reading end solid.");
|
||||||
|
- fclose(fp);
|
||||||
|
- return 0;
|
||||||
|
+ done = feof(fp);
|
||||||
|
+ if (!done)
|
||||||
|
+ {
|
||||||
|
+ vtkErrorMacro ("STLReader error reading file: " << this->FileName
|
||||||
|
+ << " Premature EOF while reading end solid.");
|
||||||
|
+ fclose(fp);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
-
|
||||||
|
done = feof(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.7.4.1
|
|
@ -25,9 +25,9 @@ diff -ruN scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_mac_darwin10.shlib
|
||||||
+RANLIB = ranlib
|
+RANLIB = ranlib
|
||||||
+YACC = bison -y
|
+YACC = bison -y
|
||||||
diff -ruN scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib scotch_5.1.10b/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib
|
diff -ruN scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib scotch_5.1.10b/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib
|
||||||
--- scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib 2010-08-07 03:02:42.000000000 -0400
|
--- scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib 2010-08-07 00:02:42.000000000 -0700
|
||||||
+++ scotch_5.1.10b/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib 2010-10-31 15:50:53.000000000 -0400
|
+++ scotch_5.1.10b/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib 2013-07-19 17:15:56.638402200 -0700
|
||||||
@@ -4,13 +4,13 @@
|
@@ -4,14 +4,14 @@
|
||||||
|
|
||||||
MAKE = make
|
MAKE = make
|
||||||
AR = gcc
|
AR = gcc
|
||||||
|
@ -39,9 +39,11 @@ diff -ruN scotch_5.1.10b_orig/src/Make.inc/Makefile.inc.i686_pc_linux2.shlib sco
|
||||||
-CCD = gcc
|
-CCD = gcc
|
||||||
-CFLAGS = -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -Drestrict=__restrict
|
-CFLAGS = -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -Drestrict=__restrict
|
||||||
-CLIBFLAGS = -shared -fPIC
|
-CLIBFLAGS = -shared -fPIC
|
||||||
|
-LDFLAGS = -lz -lm -lrt
|
||||||
+CCD = mpicc -I$(MPI_HOME)/include
|
+CCD = mpicc -I$(MPI_HOME)/include
|
||||||
+CFLAGS = -O3 -fPIC -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -Drestrict=__restrict
|
+CFLAGS = -O3 -fPIC -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -Drestrict=__restrict
|
||||||
+CLIBFLAGS = -shared
|
+CLIBFLAGS = -shared
|
||||||
LDFLAGS = -lz -lm -lrt
|
+LDFLAGS = -lpthread -lz -lm -lrt
|
||||||
CP = cp
|
CP = cp
|
||||||
LEX = flex -Pscotchyy -olex.yy.c
|
LEX = flex -Pscotchyy -olex.yy.c
|
||||||
|
LN = ln
|
||||||
|
|
|
@ -79,7 +79,8 @@ Prefix: %{_prefix}
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
Patch0: ParaView-3.14.1.patch_0_ParaView.git_0f43430
|
Patch0: ParaView-3.14.1.patch_0_ParaView.git_0f43430
|
||||||
Patch1: ParaView-3.14.1.patch_1
|
Patch1: ParaView-3.14.1.patch_1
|
||||||
Patch2: ParaView-3.14.1.patch_darwin
|
Patch2: ParaView-3.14.1.patch_2
|
||||||
|
Patch3: ParaView-3.14.1.patch_darwin
|
||||||
|
|
||||||
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
|
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
|
||||||
|
|
||||||
|
@ -114,9 +115,12 @@ Patch2: ParaView-3.14.1.patch_darwin
|
||||||
# Correction to BUG #13065.
|
# Correction to BUG #13065.
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
|
||||||
|
# Correction to BUG #13101.
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
%ifos darwin
|
%ifos darwin
|
||||||
# Patch for proper install of paraview binary under Mac OS X
|
# Patch for proper install of paraview binary under Mac OS X
|
||||||
%patch2 -p1
|
%patch3 -p1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
8
applications/solvers/coupled/conjugateHeatFoam/Allwmake
Executable file
8
applications/solvers/coupled/conjugateHeatFoam/Allwmake
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
|
set -x
|
||||||
|
|
||||||
|
wmake libso conjugateHeatTransfer
|
||||||
|
wmake
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------- end-of-file
|
|
@ -1,9 +1,22 @@
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-IconjugateHeatTransfer/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
-I$(LIB_SRC)/coupledMatrix/lnInclude \
|
-I$(LIB_SRC)/coupledMatrix/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
-lincompressibleTurbulenceModel \
|
||||||
|
-lincompressibleRASModels \
|
||||||
|
-lincompressibleTransportModels \
|
||||||
-lcoupledLduMatrix \
|
-lcoupledLduMatrix \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-llduSolvers
|
-lradiation \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lconjugateHeatTransfer
|
||||||
|
|
26
applications/solvers/coupled/conjugateHeatFoam/UEqn.H
Normal file
26
applications/solvers/coupled/conjugateHeatFoam/UEqn.H
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Solve the momentum equation
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(U)
|
||||||
|
+ fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevReff(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
if (momentumPredictor)
|
||||||
|
{
|
||||||
|
solve
|
||||||
|
(
|
||||||
|
UEqn
|
||||||
|
==
|
||||||
|
fvc::reconstruct
|
||||||
|
(
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rhok)
|
||||||
|
- fvc::snGrad(p_rgh)
|
||||||
|
)*mesh.magSf()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
|
@ -14,5 +14,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force recalculation of weights
|
// Force recalculation of weights
|
||||||
mesh.surfaceInterpolation::movePoints();
|
mesh.surfaceInterpolation::movePoints();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright held by original author
|
\\ / A nd | Copyright (C) 2008-2011 H. Jasak & H. Rusche
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | All rights reserved
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
|
@ -25,45 +25,92 @@ License
|
||||||
Application
|
Application
|
||||||
conjugateHeatFoam
|
conjugateHeatFoam
|
||||||
|
|
||||||
Author
|
|
||||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transient solver for incompressible, laminar flow of Newtonian fluids
|
Transient solver for buoyancy-driven turbulent flow of incompressible
|
||||||
with conjugate heat transfer
|
Newtonian fluids with conjugate heat transfer, complex heat conduction
|
||||||
|
and radiation
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "coupledFvMatrices.H"
|
#include "coupledFvMatrices.H"
|
||||||
#include "regionCouplePolyPatch.H"
|
#include "regionCouplePolyPatch.H"
|
||||||
|
#include "radiationModel.H"
|
||||||
|
#include "thermalModel.H"
|
||||||
|
#include "singlePhaseTransportModel.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createFluidMesh.H"
|
# include "createFluidMesh.H"
|
||||||
# include "attachPatches.H"
|
|
||||||
# include "createSolidMesh.H"
|
# include "createSolidMesh.H"
|
||||||
|
# include "readGravitationalAcceleration.H"
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "createSolidFields.H"
|
# include "createSolidFields.H"
|
||||||
|
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
|
# include "readTimeControls.H"
|
||||||
|
# include "CourantNo.H"
|
||||||
|
# include "setInitialDeltaT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "solveFluid.H"
|
# include "readTimeControls.H"
|
||||||
|
# include "readPISOControls.H"
|
||||||
|
# include "CourantNo.H"
|
||||||
|
# include "setDeltaT.H"
|
||||||
|
|
||||||
|
// Detach patches
|
||||||
|
# include "detachPatches.H"
|
||||||
|
|
||||||
|
# include "UEqn.H"
|
||||||
|
|
||||||
|
p_rgh.storePrevIter();
|
||||||
|
|
||||||
|
for (int corr = 0; corr < nCorr; corr++)
|
||||||
|
{
|
||||||
|
# include "pEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update turbulent quantities
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
radiation->correct();
|
||||||
|
|
||||||
|
// Update thermal conductivity in the fluid
|
||||||
|
kappaEff = rho*Cp*(turbulence->nu()/Pr + turbulence->nut()/Prt);
|
||||||
|
|
||||||
|
// Update thermal conductivity in the solid
|
||||||
|
solidThermo.correct();
|
||||||
|
ksolid = solidThermo.k();
|
||||||
|
|
||||||
|
rhoCpsolid.oldTime();
|
||||||
|
rhoCpsolid = solidThermo.rho()*solidThermo.C();
|
||||||
|
|
||||||
|
// Coupled patches
|
||||||
|
# include "attachPatches.H"
|
||||||
|
|
||||||
|
kappaEff.correctBoundaryConditions();
|
||||||
|
ksolid.correctBoundaryConditions();
|
||||||
|
|
||||||
|
// Interpolate to the faces and add thermal resistance
|
||||||
|
surfaceScalarField ksolidf = fvc::interpolate(ksolid);
|
||||||
|
solidThermo.modifyResistance(ksolidf);
|
||||||
|
|
||||||
# include "solveEnergy.H"
|
# include "solveEnergy.H"
|
||||||
|
|
||||||
|
// Update density according to Boussinesq approximation
|
||||||
|
rhok = 1.0 - beta*(T - TRef);
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
Info<< "ExecutionTime = "
|
Info<< "ExecutionTime = "
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
thermalModel/thermalModel.C
|
||||||
|
thermalLaws = thermalModel/thermalLaws
|
||||||
|
|
||||||
|
$(thermalLaws)/thermalLaw/thermalLaw.C
|
||||||
|
$(thermalLaws)/thermalLaw/newThermalLaw.C
|
||||||
|
$(thermalLaws)/constantThermal/constantThermal.C
|
||||||
|
$(thermalLaws)/multiMaterialThermal/multiMaterialThermal.C
|
||||||
|
$(thermalLaws)/multiMaterialZonesThermal/multiMaterialZonesThermal.C
|
||||||
|
|
||||||
|
thermalGaps = thermalModel/thermalGaps
|
||||||
|
|
||||||
|
$(thermalGaps)/thermalGap/thermalGap.C
|
||||||
|
$(thermalGaps)/thermalGap/newThermalGap.C
|
||||||
|
$(thermalGaps)/constantThermalGap/constantThermalGap.C
|
||||||
|
$(thermalGaps)/constantResistanceThermalGap/constantResistanceThermalGap.C
|
||||||
|
|
||||||
|
thermalSource = thermalModel/thermalSource
|
||||||
|
|
||||||
|
$(thermalSource)/thermalSource/thermalSource.C
|
||||||
|
$(thermalSource)/thermalSource/newThermalSource.C
|
||||||
|
$(thermalSource)/constantThermalSource/constantThermalSource.C
|
||||||
|
|
||||||
|
BCs = fvPatchFields
|
||||||
|
|
||||||
|
$(BCs)/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
|
$(BCs)/chtRegionCoupleBase/chtRegionCoupleBase.C
|
||||||
|
$(BCs)/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C
|
||||||
|
$(BCs)/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C
|
||||||
|
$(BCs)/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C
|
||||||
|
$(BCs)/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C
|
||||||
|
|
||||||
|
$(BCs)/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C
|
||||||
|
|
||||||
|
$(BCs)/externalRadiation/externalRadiationSource/externalRadiationSource.C
|
||||||
|
$(BCs)/externalRadiation/externalRadiationSource/newExternalRadiationSource.C
|
||||||
|
$(BCs)/externalRadiation/ersConstantFlux/ersConstantFlux.C
|
||||||
|
$(BCs)/externalRadiation/ersViewFactor/ersViewFactor.C
|
||||||
|
$(BCs)/externalRadiation/ersPlaneToCylinder/ersPlaneToCylinder.C
|
||||||
|
$(BCs)/externalRadiation/ersPointSource/ersPointSource.C
|
||||||
|
$(BCs)/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
|
||||||
|
$(BCs)/adiabatic/adiabaticFvPatchScalarField.C
|
||||||
|
|
||||||
|
FOs = functionObjects
|
||||||
|
|
||||||
|
$(FOs)/heatFlux/heatFlux/heatFlux.C
|
||||||
|
$(FOs)/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libconjugateHeatTransfer
|
|
@ -0,0 +1,13 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/VectorN/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lspecie \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lradiation \
|
||||||
|
-lVectorN
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fieldAverageItem.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::fieldAverageItem::baseType,
|
||||||
|
2
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"iteration",
|
||||||
|
"time"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
|
||||||
|
Foam::fieldAverageItem::baseTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldAverageItem::fieldAverageItem()
|
||||||
|
:
|
||||||
|
fieldName_("unknown"),
|
||||||
|
mean_(0),
|
||||||
|
prime2Mean_(0),
|
||||||
|
base_(ITER)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
|
||||||
|
:
|
||||||
|
fieldName_(faItem.fieldName_),
|
||||||
|
mean_(faItem.mean_),
|
||||||
|
prime2Mean_(faItem.prime2Mean_),
|
||||||
|
base_(faItem.base_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldAverageItem::~fieldAverageItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||||
|
{
|
||||||
|
// Check for assignment to self
|
||||||
|
if (this == &rhs)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::fieldAverageItem::operator=(const Foam::fieldAverageItem&)"
|
||||||
|
) << "Attempted assignment to self" << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set updated values
|
||||||
|
fieldName_ = rhs.fieldName_;
|
||||||
|
mean_ = rhs.mean_;
|
||||||
|
prime2Mean_ = rhs.prime2Mean_;
|
||||||
|
base_ = rhs.base_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,208 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fieldAverageItem
|
||||||
|
|
||||||
|
Description
|
||||||
|
Helper class to describe what form of averaging to apply. A set will be
|
||||||
|
applied to each base field in Foam::fieldAverage, of the form:
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
{
|
||||||
|
mean on;
|
||||||
|
prime2Mean on;
|
||||||
|
base time; // iteration
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fieldAverageItem.C
|
||||||
|
fieldAverageItemIO.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fieldAverageItem_H
|
||||||
|
#define fieldAverageItem_H
|
||||||
|
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
class fieldAverageItem;
|
||||||
|
Istream& operator>>(Istream&, fieldAverageItem&);
|
||||||
|
Ostream& operator<<(Ostream&, const fieldAverageItem&);
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fieldAverageItem Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class fieldAverageItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public data
|
||||||
|
|
||||||
|
//- Enumeration defining the averaging base type
|
||||||
|
enum baseType
|
||||||
|
{
|
||||||
|
ITER,
|
||||||
|
TIME
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Field name
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- Compute mean flag
|
||||||
|
Switch mean_;
|
||||||
|
|
||||||
|
//- Compute prime-squared mean flag
|
||||||
|
Switch prime2Mean_;
|
||||||
|
|
||||||
|
//- Averaging base type names
|
||||||
|
static const NamedEnum<baseType, 2> baseTypeNames_;
|
||||||
|
|
||||||
|
//- Averaging base type
|
||||||
|
baseType base_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
fieldAverageItem();
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
fieldAverageItem(Istream&);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
fieldAverageItem(const fieldAverageItem&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~fieldAverageItem();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return const access to the field name
|
||||||
|
const word& fieldName() const
|
||||||
|
{
|
||||||
|
return fieldName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return const access to the mean flag
|
||||||
|
const Switch& mean() const
|
||||||
|
{
|
||||||
|
return mean_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return const access to the prime-squared mean flag
|
||||||
|
const Switch& prime2Mean() const
|
||||||
|
{
|
||||||
|
return prime2Mean_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return averaging base type name
|
||||||
|
const word base() const
|
||||||
|
{
|
||||||
|
return baseTypeNames_[base_];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return true if base is ITER
|
||||||
|
Switch ITERBase() const
|
||||||
|
{
|
||||||
|
return base_ == ITER;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return true if base is time
|
||||||
|
Switch timeBase() const
|
||||||
|
{
|
||||||
|
return base_ == TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
void operator=(const fieldAverageItem&);
|
||||||
|
|
||||||
|
|
||||||
|
// Friend Operators
|
||||||
|
|
||||||
|
friend bool operator==
|
||||||
|
(
|
||||||
|
const fieldAverageItem& a,
|
||||||
|
const fieldAverageItem& b
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
a.fieldName_ == b.fieldName_
|
||||||
|
&& a.mean_ == b.mean_
|
||||||
|
&& a.prime2Mean_ == b.prime2Mean_
|
||||||
|
&& a.base_ == b.base_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator!=
|
||||||
|
(
|
||||||
|
const fieldAverageItem& a,
|
||||||
|
const fieldAverageItem& b
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
friend Istream& operator>>(Istream&, fieldAverageItem&);
|
||||||
|
friend Ostream& operator<<(Ostream&, const fieldAverageItem&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fieldAverageItem.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "dictionaryEntry.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||||
|
:
|
||||||
|
fieldName_("unknown"),
|
||||||
|
mean_(0),
|
||||||
|
prime2Mean_(0)
|
||||||
|
{
|
||||||
|
is.check("Foam::fieldAverageItem::fieldAverageItem(Foam::Istream&)");
|
||||||
|
|
||||||
|
const dictionaryEntry entry(dictionary::null, is);
|
||||||
|
|
||||||
|
fieldName_ = entry.keyword();
|
||||||
|
entry.lookup("mean") >> mean_;
|
||||||
|
entry.lookup("prime2Mean") >> prime2Mean_;
|
||||||
|
base_ = baseTypeNames_[entry.lookup("base")];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||||
|
{
|
||||||
|
is.check
|
||||||
|
(
|
||||||
|
"Foam::Istream& Foam::operator>>"
|
||||||
|
"(Foam::Istream&, Foam::fieldAverageItem&)"
|
||||||
|
);
|
||||||
|
|
||||||
|
const dictionaryEntry entry(dictionary::null, is);
|
||||||
|
|
||||||
|
faItem.fieldName_ = entry.keyword();
|
||||||
|
entry.lookup("mean") >> faItem.mean_;
|
||||||
|
entry.lookup("prime2Mean") >> faItem.prime2Mean_;
|
||||||
|
faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")];
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
||||||
|
{
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Foam::Ostream& Foam::operator<<"
|
||||||
|
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||||
|
);
|
||||||
|
|
||||||
|
os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
|
||||||
|
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("prime2Mean") << faItem.mean_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
|
||||||
|
<< token::END_STATEMENT << nl << token::END_BLOCK << nl;
|
||||||
|
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Foam::Ostream& Foam::operator<<"
|
||||||
|
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||||
|
);
|
||||||
|
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::IOfieldAverage
|
||||||
|
|
||||||
|
Description
|
||||||
|
Instance of the generic IOOutputFilter for fieldAverage.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOfieldAverage_H
|
||||||
|
#define IOfieldAverage_H
|
||||||
|
|
||||||
|
#include "fieldAverage.H"
|
||||||
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOOutputFilter<fieldAverage> IOFieldAverage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
const polyPatchList& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Detach it here
|
||||||
|
rcp.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
mesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
|
@ -0,0 +1,241 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "heatFlux.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
#include "chtRcTemperatureFvPatchScalarField.H"
|
||||||
|
#include "processorFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(Foam::heatFlux, 0);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::heatFlux::heatFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
Kfluid_(dict.lookup("K")),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true)
|
||||||
|
{
|
||||||
|
// Only active if a fvMesh is available
|
||||||
|
if (isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"heatFlux::heatFlux\n"
|
||||||
|
"(\n"
|
||||||
|
"const word&,\n"
|
||||||
|
"const objectRegistry&,\n"
|
||||||
|
"const dictionary&,\n"
|
||||||
|
"const bool\n"
|
||||||
|
")"
|
||||||
|
) << "No fvMesh available, deactivating."
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::heatFlux::~heatFlux()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::heatFlux::calcAndPrint()
|
||||||
|
{
|
||||||
|
const volScalarField& T =
|
||||||
|
obr_.lookupObject<volScalarField>("T");
|
||||||
|
const volScalarField& kappaEff =
|
||||||
|
obr_.lookupObject<volScalarField>(Kfluid_);
|
||||||
|
//const surfaceScalarField& kappaEff =
|
||||||
|
// obr_.lookupObject<surfaceScalarField>(Kfluid_);
|
||||||
|
|
||||||
|
scalar rho = 1.2;
|
||||||
|
scalar Cp = 1000;
|
||||||
|
|
||||||
|
const fvMesh& mesh = T.mesh();
|
||||||
|
|
||||||
|
surfaceScalarField heatFluxD =
|
||||||
|
-fvc::interpolate(kappaEff)*fvc::snGrad(T);
|
||||||
|
// -kappaEff*fvc::snGrad(T);
|
||||||
|
|
||||||
|
const surfaceScalarField::GeometricBoundaryField& patchHeatFluxD =
|
||||||
|
heatFluxD.boundaryField();
|
||||||
|
//const surfaceScalarField::GeometricBoundaryField& patchHeatFluxD =
|
||||||
|
// heatFluxC.boundaryField();
|
||||||
|
|
||||||
|
//surfaceScalarField::GeometricBoundaryField patchHeatFluxC =
|
||||||
|
|
||||||
|
scalar sumConduction = 0.0;
|
||||||
|
scalar sumConvection = 0.0;
|
||||||
|
scalar sumRadiation = 0.0;
|
||||||
|
|
||||||
|
Info<< "\nWall heat fluxes [W]" << endl;
|
||||||
|
forAll(patchHeatFluxD, patchi)
|
||||||
|
{
|
||||||
|
if(isA<processorFvPatchScalarField>(T.boundaryField()[patchi]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar conduction = gSum
|
||||||
|
(
|
||||||
|
mesh.magSf().boundaryField()[patchi]
|
||||||
|
*heatFluxD.boundaryField()[patchi]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Account for heat sources at region couple BCs
|
||||||
|
if(isA<chtRcTemperatureFvPatchScalarField>(T.boundaryField()[patchi]))
|
||||||
|
{
|
||||||
|
const chtRcTemperatureFvPatchScalarField& pT =
|
||||||
|
dynamic_cast<const chtRcTemperatureFvPatchScalarField&>
|
||||||
|
(
|
||||||
|
T.boundaryField()[patchi]
|
||||||
|
);
|
||||||
|
|
||||||
|
conduction -= gSum
|
||||||
|
(
|
||||||
|
pT.source()*mesh.magSf().boundaryField()[patchi]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar convection = 0.0;
|
||||||
|
scalar radiation = 0.0;
|
||||||
|
|
||||||
|
if(obr_.foundObject<surfaceScalarField>("phi"))
|
||||||
|
{
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
obr_.lookupObject<surfaceScalarField>("phi");
|
||||||
|
|
||||||
|
convection = gSum
|
||||||
|
(
|
||||||
|
rho*Cp*T.boundaryField()[patchi]
|
||||||
|
*phi.boundaryField()[patchi]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(obr_.foundObject<volScalarField>("Qr"))
|
||||||
|
{
|
||||||
|
const volScalarField& Qr =
|
||||||
|
obr_.lookupObject<volScalarField>("Qr");
|
||||||
|
|
||||||
|
radiation = gSum
|
||||||
|
(
|
||||||
|
Qr.boundaryField()[patchi]
|
||||||
|
*mesh.magSf().boundaryField()[patchi]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< mesh.boundary()[patchi].name()
|
||||||
|
<< " "
|
||||||
|
<< conduction
|
||||||
|
<< " "
|
||||||
|
<< convection
|
||||||
|
<< " "
|
||||||
|
<< radiation
|
||||||
|
<< " "
|
||||||
|
<< conduction + convection + radiation
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
sumConduction += conduction;
|
||||||
|
sumConvection += convection;
|
||||||
|
sumRadiation += radiation;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "sum "
|
||||||
|
<< sumConduction
|
||||||
|
<< " "
|
||||||
|
<< sumConvection
|
||||||
|
<< " "
|
||||||
|
<< sumRadiation
|
||||||
|
<< " "
|
||||||
|
<< sumConduction + sumConvection + sumRadiation
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Foam::heatFlux::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::heatFlux::execute()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
calcAndPrint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::heatFlux::end()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
calcAndPrint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::heatFlux::write()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::heatFlux::updateMesh(const mapPolyMesh&)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::heatFlux::movePoints(const pointField&)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::heatFlux
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
heatFlux.C
|
||||||
|
heatFluxTemplates.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef heatFlux_H
|
||||||
|
#define heatFlux_H
|
||||||
|
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "pointFieldFwd.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class heatFluxItem;
|
||||||
|
class OFstream;
|
||||||
|
template<class Type>
|
||||||
|
class List;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class heatFlux Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class heatFlux
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of this set of heat flux check
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
//- name of fluid thermal diffusivity
|
||||||
|
word Kfluid_;
|
||||||
|
|
||||||
|
//- Database this class is registered to
|
||||||
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- On/off switch
|
||||||
|
bool active_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
// Calculation functions
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void calcAndPrint();
|
||||||
|
|
||||||
|
// Functions to be over-ridden from IOoutputFilter class
|
||||||
|
|
||||||
|
//- Update mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh&);
|
||||||
|
|
||||||
|
//- Move points
|
||||||
|
virtual void movePoints(const Field<point>&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
heatFlux(const heatFlux&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const heatFlux&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("heatFlux");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
heatFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~heatFlux();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name of the set of field averages
|
||||||
|
virtual const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the field average data
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Execute the averaging
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute the averaging at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
//- Calculate the field average data and write
|
||||||
|
virtual void write();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,286 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "heatFluxItem.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::heatFlux::addMeanField
|
||||||
|
(
|
||||||
|
const label fieldI,
|
||||||
|
wordList& meanFieldList
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (faItems_[fieldI].mean())
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
|
|
||||||
|
const word meanFieldName = fieldName + EXT_MEAN;
|
||||||
|
|
||||||
|
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||||
|
|
||||||
|
if (obr_.foundObject<fieldType>(meanFieldName))
|
||||||
|
{
|
||||||
|
meanFieldList[fieldI] = meanFieldName;
|
||||||
|
}
|
||||||
|
else if (obr_.found(meanFieldName))
|
||||||
|
{
|
||||||
|
Info<< "Cannot allocate average field " << meanFieldName
|
||||||
|
<< " since an object with that name already exists."
|
||||||
|
<< " Disabling averaging." << nl << endl;
|
||||||
|
meanFieldList[fieldI] = word::null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fieldType& baseField =
|
||||||
|
obr_.lookupObject<fieldType>(fieldName);
|
||||||
|
|
||||||
|
// Store on registry
|
||||||
|
obr_.store
|
||||||
|
(
|
||||||
|
new fieldType
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
meanFieldName,
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
1*baseField
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
meanFieldList[fieldI] = meanFieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type1, class Type2>
|
||||||
|
void Foam::heatFlux::addPrime2MeanField
|
||||||
|
(
|
||||||
|
const label fieldI,
|
||||||
|
const wordList& meanFieldList,
|
||||||
|
wordList& prime2MeanFieldList
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (faItems_[fieldI].mean() && meanFieldList[fieldI].size())
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||||
|
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||||
|
|
||||||
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
|
|
||||||
|
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
||||||
|
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||||
|
|
||||||
|
if (obr_.foundObject<fieldType2>(meanFieldName))
|
||||||
|
{
|
||||||
|
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||||
|
}
|
||||||
|
else if (obr_.found(meanFieldName))
|
||||||
|
{
|
||||||
|
Info<< "Cannot allocate average field " << meanFieldName
|
||||||
|
<< " since an object with that name already exists."
|
||||||
|
<< " Disabling averaging." << nl << endl;
|
||||||
|
prime2MeanFieldList[fieldI] = word::null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fieldType1& baseField =
|
||||||
|
obr_.lookupObject<fieldType1>(fieldName);
|
||||||
|
const fieldType1& meanField =
|
||||||
|
obr_.lookupObject<fieldType1>(meanFieldList[fieldI]);
|
||||||
|
|
||||||
|
obr_.store
|
||||||
|
(
|
||||||
|
new fieldType2
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
meanFieldName,
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
sqr(baseField) - sqr(meanField)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::heatFlux::calculateMeanFields(const wordList& meanFieldList)
|
||||||
|
const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const scalar dt = obr_.time().deltaTValue();
|
||||||
|
|
||||||
|
forAll(faItems_, i)
|
||||||
|
{
|
||||||
|
if (faItems_[i].mean() && meanFieldList[i].size())
|
||||||
|
{
|
||||||
|
const word& fieldName = faItems_[i].fieldName();
|
||||||
|
const fieldType& baseField =
|
||||||
|
obr_.lookupObject<fieldType>(fieldName);
|
||||||
|
fieldType& meanField = const_cast<fieldType&>
|
||||||
|
(
|
||||||
|
obr_.lookupObject<fieldType>(meanFieldList[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar alpha = 0.0;
|
||||||
|
scalar beta = 0.0;
|
||||||
|
if (faItems_[i].timeBase())
|
||||||
|
{
|
||||||
|
alpha = (totalTime_[i] - dt)/totalTime_[i];
|
||||||
|
beta = dt/totalTime_[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]);
|
||||||
|
beta = 1.0/scalar(totalIter_[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
meanField = alpha*meanField + beta*baseField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type1, class Type2>
|
||||||
|
void Foam::heatFlux::calculatePrime2MeanFields
|
||||||
|
(
|
||||||
|
const wordList& meanFieldList,
|
||||||
|
const wordList& prime2MeanFieldList
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||||
|
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||||
|
|
||||||
|
const scalar dt = obr_.time().deltaTValue();
|
||||||
|
|
||||||
|
forAll(faItems_, i)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
faItems_[i].prime2Mean()
|
||||||
|
&& meanFieldList[i].size()
|
||||||
|
&& prime2MeanFieldList[i].size()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word& fieldName = faItems_[i].fieldName();
|
||||||
|
const fieldType1& baseField =
|
||||||
|
obr_.lookupObject<fieldType1>(fieldName);
|
||||||
|
const fieldType1& meanField =
|
||||||
|
obr_.lookupObject<fieldType1>(meanFieldList[i]);
|
||||||
|
fieldType2& prime2MeanField = const_cast<fieldType2&>
|
||||||
|
(
|
||||||
|
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar alpha = 0.0;
|
||||||
|
scalar beta = 0.0;
|
||||||
|
if (faItems_[i].timeBase())
|
||||||
|
{
|
||||||
|
alpha = (totalTime_[i] - dt)/totalTime_[i];
|
||||||
|
beta = dt/totalTime_[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]);
|
||||||
|
beta = 1.0/scalar(totalIter_[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
prime2MeanField =
|
||||||
|
alpha*prime2MeanField
|
||||||
|
+ beta*sqr(baseField)
|
||||||
|
- sqr(meanField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type1, class Type2>
|
||||||
|
void Foam::heatFlux::addMeanSqrToPrime2Mean
|
||||||
|
(
|
||||||
|
const wordList& meanFieldList,
|
||||||
|
const wordList& prime2MeanFieldList
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||||
|
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||||
|
|
||||||
|
forAll(faItems_, i)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
faItems_[i].prime2Mean()
|
||||||
|
&& meanFieldList[i].size()
|
||||||
|
&& prime2MeanFieldList[i].size()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fieldType1& meanField =
|
||||||
|
obr_.lookupObject<fieldType1>(meanFieldList[i]);
|
||||||
|
fieldType2& prime2MeanField = const_cast<fieldType2&>
|
||||||
|
(
|
||||||
|
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
prime2MeanField += sqr(meanField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::heatFlux::writeFieldList(const wordList& fieldList) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
forAll(fieldList, i)
|
||||||
|
{
|
||||||
|
if (fieldList[i].size())
|
||||||
|
{
|
||||||
|
const fieldType& f = obr_.lookupObject<fieldType>(fieldList[i]);
|
||||||
|
f.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "heatFluxFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineNamedTemplateTypeNameAndDebug(heatFluxFunctionObject, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
heatFluxFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::heatFluxFunctionObject
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject wrapper around fieldAverage to allow them to be created
|
||||||
|
via the functions entry within controlDict.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
heatFluxFunctionObject.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef heatFluxFunctionObject_H
|
||||||
|
#define heatFluxFunctionObject_H
|
||||||
|
|
||||||
|
#include "heatFlux.H"
|
||||||
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef OutputFilterFunctionObject<heatFlux>
|
||||||
|
heatFluxFunctionObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "adiabaticFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "radiationConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::adiabaticFvPatchScalarField::
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
KName_("undefined-K")
|
||||||
|
{
|
||||||
|
refValue() = 0.0;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::adiabaticFvPatchScalarField::
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
KName_(ptf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::adiabaticFvPatchScalarField::
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
KName_(dict.lookup("K"))
|
||||||
|
{
|
||||||
|
refValue() = 0.0;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::adiabaticFvPatchScalarField::
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf),
|
||||||
|
KName_(tppsf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::adiabaticFvPatchScalarField::
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf, iF),
|
||||||
|
KName_(tppsf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::adiabaticFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalarField& Tp = *this;
|
||||||
|
|
||||||
|
const scalarField& Kw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||||
|
|
||||||
|
const scalarField& Qr =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
|
||||||
|
scalarField fourQro = 4.0*radiation::sigmaSB.value()*pow4(Tp);
|
||||||
|
|
||||||
|
refGrad() = (Qr + fourQro)/Kw;
|
||||||
|
valueFraction() = fourQro/(fourQro + Kw*patch().deltaCoeffs()*Tp);
|
||||||
|
|
||||||
|
mixedFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::adiabaticFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
adiabatic boundary (with radiation)
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
myWallPatch
|
||||||
|
{
|
||||||
|
type adiabatic;
|
||||||
|
K K; // Name of K field
|
||||||
|
value 300.0; // Initial temperature / [K]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
adiabaticFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef adiabaticFvPatchScalarField_H
|
||||||
|
#define adiabaticFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class adiabaticFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class adiabaticFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of thermal conductivity field
|
||||||
|
word KName_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("adiabatic");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// adiabaticFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new adiabaticFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
adiabaticFvPatchScalarField
|
||||||
|
(
|
||||||
|
const adiabaticFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new adiabaticFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,215 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "chtRcTemperatureFvPatchScalarField.H"
|
||||||
|
#include "chtRegionCoupleBase.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
#include "magLongDelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(p, iF),
|
||||||
|
kName_("none"),
|
||||||
|
radiation_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(p, iF, dict),
|
||||||
|
kName_(dict.lookup("K")),
|
||||||
|
radiation_(readBool(dict.lookup("radiation")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcTemperatureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
kName_(ptf.kName_),
|
||||||
|
radiation_(ptf.radiation_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcTemperatureFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(ptf, iF),
|
||||||
|
kName_(ptf.kName_),
|
||||||
|
radiation_(ptf.radiation_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// Return a named shadow patch field
|
||||||
|
const chtRcTemperatureFvPatchScalarField&
|
||||||
|
chtRcTemperatureFvPatchScalarField::shadowPatchField() const
|
||||||
|
{
|
||||||
|
return dynamic_cast
|
||||||
|
<
|
||||||
|
const chtRcTemperatureFvPatchScalarField&
|
||||||
|
>
|
||||||
|
(
|
||||||
|
regionCouplingFvPatchScalarField::shadowPatchField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcTemperatureFvPatchScalarField::initEvaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const chtRegionCoupleBase& K =
|
||||||
|
dynamic_cast<const chtRegionCoupleBase&>
|
||||||
|
(
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(kName_)
|
||||||
|
);
|
||||||
|
|
||||||
|
K.calcTemperature(*this, shadowPatchField(), K);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcTemperatureFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatchScalarField::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<scalarField> chtRcTemperatureFvPatchScalarField::source() const
|
||||||
|
{
|
||||||
|
const fvPatch& p = patch();
|
||||||
|
const magLongDelta& mld = magLongDelta::New(p.boundaryMesh().mesh());
|
||||||
|
|
||||||
|
const scalarField TcOwn = patchInternalField();
|
||||||
|
const scalarField TcNei = patchNeighbourField();
|
||||||
|
const scalarField& Tw = *this;
|
||||||
|
|
||||||
|
const chtRegionCoupleBase& K =
|
||||||
|
dynamic_cast<const chtRegionCoupleBase&>
|
||||||
|
(
|
||||||
|
p.lookupPatchField<volScalarField, scalar>(kName_)
|
||||||
|
);
|
||||||
|
|
||||||
|
const scalarField k = K*p.deltaCoeffs();
|
||||||
|
|
||||||
|
const scalarField kOwn =
|
||||||
|
K.originalPatchField()/(1 - p.weights())/mld.magDelta(p.index());
|
||||||
|
|
||||||
|
return kOwn*(Tw - TcOwn) - k*(TcNei - TcOwn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcTemperatureFvPatchScalarField::manipulateMatrix
|
||||||
|
(
|
||||||
|
fvScalarMatrix& matrix
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fvPatch& p = patch();
|
||||||
|
const scalarField& magSf = p.magSf();
|
||||||
|
const labelList& cellLabels = p.faceCells();
|
||||||
|
scalarField& source = matrix.source();
|
||||||
|
|
||||||
|
scalarField s = this->source();
|
||||||
|
|
||||||
|
//Info << "s = " << s << " Sum s = " << sum(s*p.magSf()) << endl;
|
||||||
|
//Info << "Sum s = " << sum(s*p.magSf()) << endl;
|
||||||
|
|
||||||
|
forAll(cellLabels, i)
|
||||||
|
{
|
||||||
|
source[cellLabels[i]] += s[i]*magSf[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcTemperatureFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("K") << kName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("radiation") << radiation_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("remoteField")
|
||||||
|
<< remoteFieldName() << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,174 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field taking radiation into account
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
chtRcTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef chtRcTemperatureFvPatchScalarField_H
|
||||||
|
#define chtRcTemperatureFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "regionCouplingFvPatchFields.H"
|
||||||
|
#include "fvMatricesFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class chtRcTemperatureFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class chtRcTemperatureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public regionCouplingFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of thermal diffusivity field
|
||||||
|
word kName_;
|
||||||
|
|
||||||
|
//- Take radiation into account for this patch
|
||||||
|
bool radiation_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("chtRcTemperature");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given chtRcTemperatureFvPatchScalarField onto a new patch
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcTemperatureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
chtRcTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcTemperatureFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcTemperatureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcTemperatureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access functions
|
||||||
|
|
||||||
|
//- Return radiation
|
||||||
|
bool radiation() const
|
||||||
|
{
|
||||||
|
return radiation_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return shadow patch field
|
||||||
|
virtual const chtRcTemperatureFvPatchScalarField&
|
||||||
|
shadowPatchField() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Initialise the evaluation of the patch field
|
||||||
|
virtual void initEvaluate(const Pstream::commsTypes commsType);
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate(const Pstream::commsTypes commsType);
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Calculate source term
|
||||||
|
virtual tmp<scalarField> source() const;
|
||||||
|
|
||||||
|
//- Manipulate matrix
|
||||||
|
virtual void manipulateMatrix(fvScalarMatrix& matrix);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,364 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "chtRcThermalDiffusivityFvPatchScalarField.H"
|
||||||
|
#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H"
|
||||||
|
#include "chtRcTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "harmonic.H"
|
||||||
|
#include "radiationConstants.H"
|
||||||
|
#include "VectorN.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatchScalarField::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
calcThermalDiffusivity(*this, shadowPatchField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if(debug)
|
||||||
|
{
|
||||||
|
Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity on "
|
||||||
|
<< this->dimensionedInternalField().name()
|
||||||
|
<< " in " << this->patch().boundaryMesh().mesh().name()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatch& p = owner.patch();
|
||||||
|
const fvMesh& mesh = p.boundaryMesh().mesh();
|
||||||
|
const magLongDelta& mld = magLongDelta::New(mesh);
|
||||||
|
|
||||||
|
const chtRcTemperatureFvPatchScalarField& TwOwn =
|
||||||
|
dynamic_cast<const chtRcTemperatureFvPatchScalarField&>
|
||||||
|
(
|
||||||
|
p.lookupPatchField<volScalarField, scalar>("T")
|
||||||
|
);
|
||||||
|
scalarField& k = owner;
|
||||||
|
const scalarField& fOwn = owner.originalPatchField();
|
||||||
|
const scalarField TcOwn = TwOwn.patchInternalField();
|
||||||
|
|
||||||
|
scalarField fNei(p.size());
|
||||||
|
scalarField TcNei(p.size());
|
||||||
|
|
||||||
|
scalarField Qr(p.size(), 0.0);
|
||||||
|
scalarField fourQro(p.size(), 0.0);
|
||||||
|
|
||||||
|
if (TwOwn.radiation())
|
||||||
|
{
|
||||||
|
Qr += p.lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
fourQro += 4.0*radiation::sigmaSB.value()*pow4(TwOwn);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Field<VectorN<scalar, 4> > lData(neighbour.size());
|
||||||
|
|
||||||
|
const scalarField& lfNei = neighbour.originalPatchField();
|
||||||
|
scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField();
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][0] = lTcNei[facei];
|
||||||
|
lData[facei][1] = lfNei[facei];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
const scalarField& lQrNei =
|
||||||
|
owner.lookupShadowPatchField<volScalarField, scalar>("Qr");
|
||||||
|
const scalarField& lTwNei = TwOwn.shadowPatchField();
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][2] = lTwNei[facei];
|
||||||
|
lData[facei][3] = lQrNei[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Field<VectorN<scalar, 4> > iData =
|
||||||
|
owner.regionCouplePatch().interpolate(lData);
|
||||||
|
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
TcNei[facei] = iData[facei][0];
|
||||||
|
fNei[facei] = iData[facei][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
Qr[facei] += iData[facei][3];
|
||||||
|
fourQro[facei] +=
|
||||||
|
4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do interpolation
|
||||||
|
harmonic<scalar> interp(mesh);
|
||||||
|
const scalarField weights = interp.weights(fOwn, fNei, p);
|
||||||
|
const scalarField kHarm = weights*fOwn + (1.0 - weights)*fNei;
|
||||||
|
|
||||||
|
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
|
||||||
|
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
|
||||||
|
|
||||||
|
//Info << "kOwn = " << kOwn << endl;
|
||||||
|
//Info << "kNei = " << kNei << endl;
|
||||||
|
//Info << "TcOwn = " << TcOwn << endl;
|
||||||
|
//Info << "TcNei = " << TcNei << endl;
|
||||||
|
//Info << "DeltaT = " << TcNei - TcOwn << endl;
|
||||||
|
|
||||||
|
//Info << "Qr = " << Qr << endl;
|
||||||
|
//Info << "kOwn + kNei = " << (kOwn + kNei) << endl;
|
||||||
|
|
||||||
|
//Info << "k = " << k << endl;
|
||||||
|
|
||||||
|
k = kOwn*(TwOwn*(kNei*(TcNei - TcOwn) + Qr + fourQro) - TcOwn*fourQro);
|
||||||
|
k /= stabilise((fourQro + TwOwn*(kOwn + kNei))*(TcNei - TcOwn), SMALL);
|
||||||
|
k /= p.deltaCoeffs();
|
||||||
|
|
||||||
|
//Info << "k = " << k << endl;
|
||||||
|
|
||||||
|
forAll(k, facei)
|
||||||
|
{
|
||||||
|
k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Info << "k = " << k << endl;
|
||||||
|
|
||||||
|
owner.fvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField::calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& TwOwn,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if(debug)
|
||||||
|
{
|
||||||
|
Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcTemperature on "
|
||||||
|
<< this->dimensionedInternalField().name()
|
||||||
|
<< " in " << this->patch().boundaryMesh().mesh().name()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatch& p = TwOwn.patch();
|
||||||
|
const fvMesh& mesh = p.boundaryMesh().mesh();
|
||||||
|
const magLongDelta& mld = magLongDelta::New(mesh);
|
||||||
|
|
||||||
|
const scalarField& fOwn = ownerK.originalPatchField();
|
||||||
|
const scalarField TcOwn = TwOwn.patchInternalField();
|
||||||
|
|
||||||
|
scalarField fNei(p.size());
|
||||||
|
scalarField TcNei(p.size());
|
||||||
|
|
||||||
|
scalarField Qr(p.size(), 0.0);
|
||||||
|
scalarField fourQro(p.size(), 0.0);
|
||||||
|
|
||||||
|
if (TwOwn.radiation())
|
||||||
|
{
|
||||||
|
Qr += p.lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
fourQro += 4.0*radiation::sigmaSB.value()*pow4(TwOwn);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Field<VectorN<scalar, 4> > lData(neighbour.size());
|
||||||
|
|
||||||
|
const scalarField& lfNei =
|
||||||
|
ownerK.shadowPatchField().originalPatchField();
|
||||||
|
scalarField lTcNei =
|
||||||
|
TwOwn.shadowPatchField().patchInternalField();
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][0] = lTcNei[facei];
|
||||||
|
lData[facei][1] = lfNei[facei];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
const scalarField& lTwNei = TwOwn.shadowPatchField();
|
||||||
|
const scalarField& lQrNei =
|
||||||
|
TwOwn.lookupShadowPatchField<volScalarField, scalar>("Qr");
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][2] = lTwNei[facei];
|
||||||
|
lData[facei][3] = lQrNei[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Field<VectorN<scalar, 4> > iData =
|
||||||
|
TwOwn.regionCouplePatch().interpolate(lData);
|
||||||
|
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
TcNei[facei] = iData[facei][0];
|
||||||
|
fNei[facei] = iData[facei][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
fourQro[facei] +=
|
||||||
|
4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]);
|
||||||
|
Qr[facei] += iData[facei][3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
|
||||||
|
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
|
||||||
|
|
||||||
|
//Info << "kOwn = " << kOwn << endl;
|
||||||
|
//Info << "kNei = " << kNei << endl;
|
||||||
|
//Info << "TcOwn = " << TcOwn << endl;
|
||||||
|
//Info << "TcNei = " << TcNei << endl;
|
||||||
|
//Info << "Qr = " << Qr << " Sum = " << sum(Qr*p.magSf()) << endl;
|
||||||
|
|
||||||
|
TwOwn *=
|
||||||
|
(fourQro + Qr + kOwn*TcOwn + kNei*TcNei)
|
||||||
|
/(TwOwn*(kOwn + kNei) + fourQro);
|
||||||
|
|
||||||
|
//Info << "TwOwn = " << TwOwn << endl;
|
||||||
|
|
||||||
|
//scalarField q1 = (TwOwn - TcOwn)*kOwn;
|
||||||
|
//Info << "q1 = " << q1 << " Sum = " << sum(q1*p.magSf()) << endl;
|
||||||
|
|
||||||
|
//scalarField q2 = (TcNei - TcOwn)*ownerK*p.deltaCoeffs();
|
||||||
|
//Info << "q2 = " << q2 << " Sum = " << sum(q2*p.magSf()) << endl;
|
||||||
|
|
||||||
|
TwOwn.fvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("remoteField")
|
||||||
|
<< remoteFieldName() << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Specify data associated with VectorN<scalar, 4> type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<VectorN<scalar, 4> >() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field taking radiation into account
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef chtRcThermalDiffusivityFvPatchScalarField_H
|
||||||
|
#define chtRcThermalDiffusivityFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "chtRegionCoupleBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class chtRcThermalDiffusivityFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
:
|
||||||
|
public chtRegionCoupleBase
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("chtRcThermalDiffusivity");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given chtRcThermalDiffusivityFvPatchScalarField onto a new patch
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
chtRcThermalDiffusivityFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivityFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivityFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate(const Pstream::commsTypes commsType);
|
||||||
|
|
||||||
|
//- Calculate the thermal diffusivity
|
||||||
|
virtual void calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Calculate the temperature
|
||||||
|
virtual void calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& owner,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,479 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "chtRcThermalDiffusivityResistanceFvPatchScalarField.H"
|
||||||
|
#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H"
|
||||||
|
#include "chtRcTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "harmonic.H"
|
||||||
|
#include "radiationConstants.H"
|
||||||
|
#include "VectorN.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF),
|
||||||
|
conductivity_(p.size(), 0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF, dict),
|
||||||
|
conductivity_("conductivity", dict, p.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityResistanceFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, p, iF, mapper),
|
||||||
|
conductivity_(ptf.conductivity_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityResistanceFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, iF),
|
||||||
|
conductivity_(ptf.conductivity_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityResistanceFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatchScalarField::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityResistanceFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
calcThermalDiffusivity(*this, shadowPatchField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const fvPatch& p = owner.patch();
|
||||||
|
const fvMesh& mesh = p.boundaryMesh().mesh();
|
||||||
|
const magLongDelta& mld = magLongDelta::New(mesh);
|
||||||
|
|
||||||
|
const chtRcTemperatureFvPatchScalarField& TwOwn =
|
||||||
|
dynamic_cast<const chtRcTemperatureFvPatchScalarField&>
|
||||||
|
(
|
||||||
|
p.lookupPatchField<volScalarField, scalar>("T")
|
||||||
|
);
|
||||||
|
scalarField& k = owner;
|
||||||
|
const scalarField& fOwn = owner.originalPatchField();
|
||||||
|
const scalarField TcOwn = TwOwn.patchInternalField();
|
||||||
|
|
||||||
|
scalarField fNei(p.size());
|
||||||
|
scalarField TcNei(p.size());
|
||||||
|
scalarField TwNei(p.size());
|
||||||
|
|
||||||
|
scalarField QrOwn(p.size(), 0.0);
|
||||||
|
scalarField fourQroOwn(p.size(), 0.0);
|
||||||
|
scalarField fourQroNei(p.size(), 0.0);
|
||||||
|
|
||||||
|
if (TwOwn.radiation())
|
||||||
|
{
|
||||||
|
QrOwn += p.lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
fourQroOwn += 4.0*radiation::sigmaSB.value()*pow4(TwOwn);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField Qr = QrOwn;
|
||||||
|
scalarField cond(p.size());
|
||||||
|
|
||||||
|
{
|
||||||
|
Field<VectorN<scalar, 5> > lData(neighbour.size());
|
||||||
|
|
||||||
|
const scalarField& lfNei = neighbour.originalPatchField();
|
||||||
|
scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField();
|
||||||
|
const scalarField& lTwNei = TwOwn.shadowPatchField();
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][0] = lTcNei[facei];
|
||||||
|
lData[facei][1] = lfNei[facei];
|
||||||
|
lData[facei][2] = lTwNei[facei];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
const scalarField& lQrNei =
|
||||||
|
owner.lookupShadowPatchField<volScalarField, scalar>("Qr");
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][3] = lQrNei[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isA<chtRcThermalDiffusivitySlaveFvPatchScalarField>(owner))
|
||||||
|
{
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][4] = conductivity_[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Field<VectorN<scalar, 5> > iData =
|
||||||
|
owner.regionCouplePatch().interpolate(lData);
|
||||||
|
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
TcNei[facei] = iData[facei][0];
|
||||||
|
fNei[facei] = iData[facei][1];
|
||||||
|
TwNei[facei] = iData[facei][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
fourQroNei[facei] +=
|
||||||
|
4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]);
|
||||||
|
Qr[facei] += iData[facei][3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isA<chtRcThermalDiffusivitySlaveFvPatchScalarField>(owner))
|
||||||
|
{
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
cond[facei] = iData[facei][4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cond = conductivity_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do interpolation
|
||||||
|
harmonic<scalar> interp(mesh);
|
||||||
|
const scalarField weights = interp.weights(fOwn, fNei, p);
|
||||||
|
scalarField kHarm = weights*fOwn + (1.0 - weights)*fNei;
|
||||||
|
kHarm *= cond/(kHarm*p.deltaCoeffs() + cond);
|
||||||
|
|
||||||
|
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
|
||||||
|
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
|
||||||
|
|
||||||
|
//Info << "kOwn = " << kOwn << endl;
|
||||||
|
//Info << "kNei = " << kNei << endl;
|
||||||
|
//Info << "TcOwn = " << TcOwn << endl;
|
||||||
|
//Info << "TcNei = " << TcNei << endl;
|
||||||
|
//Info << "DeltaT = " << TcNei - TcOwn << endl;
|
||||||
|
//Info << "TwOwn = " << TwOwn << endl;
|
||||||
|
//Info << "TwNei = " << TwNei << endl;
|
||||||
|
|
||||||
|
//Info << "QrOwn = " << QrOwn << endl;
|
||||||
|
//Info << "Qr = " << Qr << endl;
|
||||||
|
//Info << "kOwn + kNei = " << (kOwn + kNei) << endl;
|
||||||
|
//Info << "f1 = " << fourQroOwn << endl;
|
||||||
|
//Info << "f2 = " << fourQroNei << endl;
|
||||||
|
|
||||||
|
scalarField temp = TwNei*(cond + kNei) + fourQroNei;
|
||||||
|
|
||||||
|
/*
|
||||||
|
k = -TwOwn*
|
||||||
|
(
|
||||||
|
kOwn*
|
||||||
|
(
|
||||||
|
TwNei*(cond*(kNei*TcNei + fourQroOwn + fourQroNei + Qr) + kNei*(fourQroOwn + QrOwn))
|
||||||
|
+ fourQroNei*(fourQroOwn + QrOwn)
|
||||||
|
)
|
||||||
|
+ kOwn*kOwn*TcOwn*temp
|
||||||
|
);
|
||||||
|
|
||||||
|
k /= stabilise(TwOwn*(kOwn*temp + cond*(TwNei*kNei + fourQroNei)) + fourQroOwn*temp, SMALL);
|
||||||
|
k += kOwn*TcOwn;
|
||||||
|
k /= stabilise(TcOwn - TcNei, SMALL)*p.deltaCoeffs();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Expression is equivalent to the one above
|
||||||
|
k = kOwn*
|
||||||
|
(
|
||||||
|
TwOwn*
|
||||||
|
(
|
||||||
|
TwNei*
|
||||||
|
(
|
||||||
|
cond*(kNei*(TcOwn - TcNei) - fourQroOwn - fourQroNei - Qr)
|
||||||
|
- kNei*(fourQroOwn + QrOwn)
|
||||||
|
)
|
||||||
|
+ fourQroNei*(TcOwn*cond - fourQroOwn - QrOwn)
|
||||||
|
)
|
||||||
|
+ (TcOwn*fourQroOwn*temp)
|
||||||
|
);
|
||||||
|
|
||||||
|
k /= stabilise
|
||||||
|
(
|
||||||
|
(TcOwn - TcNei)*
|
||||||
|
(
|
||||||
|
TwOwn*
|
||||||
|
(
|
||||||
|
kOwn*temp + cond*(TwNei*kNei + fourQroNei)
|
||||||
|
)
|
||||||
|
+ fourQroOwn*temp
|
||||||
|
),
|
||||||
|
SMALL
|
||||||
|
);
|
||||||
|
|
||||||
|
k /= p.deltaCoeffs();
|
||||||
|
|
||||||
|
//Info << "k = " << k << endl;
|
||||||
|
|
||||||
|
forAll(k, facei)
|
||||||
|
{
|
||||||
|
k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Info << "k = " << k << endl;
|
||||||
|
|
||||||
|
owner.fvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField::calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& TwOwn,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const fvPatch& p = TwOwn.patch();
|
||||||
|
const fvMesh& mesh = p.boundaryMesh().mesh();
|
||||||
|
const magLongDelta& mld = magLongDelta::New(mesh);
|
||||||
|
|
||||||
|
const scalarField& fOwn = ownerK.originalPatchField();
|
||||||
|
const scalarField TcOwn = TwOwn.patchInternalField();
|
||||||
|
|
||||||
|
scalarField fNei(p.size());
|
||||||
|
scalarField TcNei(p.size());
|
||||||
|
scalarField TwNei(p.size());
|
||||||
|
|
||||||
|
scalarField QrOwn(p.size(), 0.0);
|
||||||
|
scalarField fourQroOwn(p.size(), 0.0);
|
||||||
|
scalarField fourQroNei(p.size(), 0.0);
|
||||||
|
|
||||||
|
if (TwOwn.radiation())
|
||||||
|
{
|
||||||
|
QrOwn += p.lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
fourQroOwn += 4.0*radiation::sigmaSB.value()*pow4(TwOwn);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField Qr = QrOwn;
|
||||||
|
scalarField cond(p.size());
|
||||||
|
|
||||||
|
{
|
||||||
|
Field<VectorN<scalar, 5> > lData(neighbour.size());
|
||||||
|
|
||||||
|
const scalarField& lfNei =
|
||||||
|
ownerK.shadowPatchField().originalPatchField();
|
||||||
|
scalarField lTcNei =
|
||||||
|
TwOwn.shadowPatchField().patchInternalField();
|
||||||
|
const scalarField& lTwNei =
|
||||||
|
TwOwn.shadowPatchField();
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][0] = lTcNei[facei];
|
||||||
|
lData[facei][1] = lfNei[facei];
|
||||||
|
lData[facei][2] = lTwNei[facei];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
const scalarField& lQrNei =
|
||||||
|
TwOwn.lookupShadowPatchField<volScalarField, scalar>("Qr");
|
||||||
|
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][3] = lQrNei[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isA<chtRcThermalDiffusivitySlaveFvPatchScalarField>(ownerK))
|
||||||
|
{
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
lData[facei][4] = conductivity_[facei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Field<VectorN<scalar, 5> > iData =
|
||||||
|
TwOwn.regionCouplePatch().interpolate(lData);
|
||||||
|
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
TcNei[facei] = iData[facei][0];
|
||||||
|
fNei[facei] = iData[facei][1];
|
||||||
|
TwNei[facei] = iData[facei][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TwOwn.shadowPatchField().radiation())
|
||||||
|
{
|
||||||
|
forAll(iData, facei)
|
||||||
|
{
|
||||||
|
Qr[facei] += iData[facei][3];
|
||||||
|
fourQroNei[facei] +=
|
||||||
|
4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isA<chtRcThermalDiffusivitySlaveFvPatchScalarField>(ownerK))
|
||||||
|
{
|
||||||
|
forAll(lData, facei)
|
||||||
|
{
|
||||||
|
cond[facei] = iData[facei][4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cond = conductivity_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
|
||||||
|
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
|
||||||
|
|
||||||
|
//Info << "kOwn = " << kOwn << endl;
|
||||||
|
//Info << "kNei = " << kNei << endl;
|
||||||
|
//Info << "TcOwn = " << TcOwn << endl;
|
||||||
|
//Info << "TcNei = " << TcNei << endl;
|
||||||
|
//Info << "QrOwn = " << QrOwn << " Sum = " << sum(QrOwn*p.magSf()) << endl;
|
||||||
|
//Info << "Qr = " << Qr << " Sum = " << sum(Qr*p.magSf()) << endl;
|
||||||
|
|
||||||
|
scalarField temp = fourQroOwn + QrOwn + kOwn*TcOwn;
|
||||||
|
|
||||||
|
TwOwn *=
|
||||||
|
(
|
||||||
|
TwNei*
|
||||||
|
(
|
||||||
|
cond*
|
||||||
|
(
|
||||||
|
kNei*TcNei + fourQroOwn + fourQroNei + Qr + kOwn*TcOwn
|
||||||
|
)
|
||||||
|
+ kNei*temp
|
||||||
|
)
|
||||||
|
+ fourQroNei*temp
|
||||||
|
)
|
||||||
|
/
|
||||||
|
(
|
||||||
|
TwOwn*
|
||||||
|
(
|
||||||
|
TwNei*(cond*(kOwn + kNei) + kOwn*kNei)
|
||||||
|
+ fourQroNei*(kOwn + cond)
|
||||||
|
)
|
||||||
|
+ fourQroOwn*(TwNei*(cond + kNei) + fourQroNei)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Info << "TwOwn = " << TwOwn << endl;
|
||||||
|
|
||||||
|
//scalarField q1 = (TwOwn - TcOwn)*kOwn;
|
||||||
|
//Info << "q1 = " << q1 << " Sum = " << sum(q1*p.magSf()) << endl;
|
||||||
|
|
||||||
|
//scalarField q2 = (TcNei - TcOwn)*ownerK*p.deltaCoeffs();
|
||||||
|
//Info << "q2 = " << q2 << " Sum = " << sum(q2*p.magSf()) << endl;
|
||||||
|
|
||||||
|
TwOwn.fvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivityResistanceFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
conductivity_.writeEntry("conductivity", os);
|
||||||
|
os.writeKeyword("remoteField")
|
||||||
|
<< remoteFieldName() << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Specify data associated with VectorN<scalar, 5> type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<VectorN<scalar, 5> >() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
regionCouplingResistanceFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field jump resistance on the surface taking
|
||||||
|
radiation into account
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
regionCouplingResistanceFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef regionCouplingResistanceFvPatchField_H
|
||||||
|
#define regionCouplingResistanceFvPatchField_H
|
||||||
|
|
||||||
|
#include "chtRegionCoupleBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class regionCouplingResistanceFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
:
|
||||||
|
public chtRegionCoupleBase
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Conductivity
|
||||||
|
scalarField conductivity_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("chtRcThermalDiffusivityResistance");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given regionCouplingResistanceFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityResistanceFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
chtRcThermalDiffusivityResistanceFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivityResistanceFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivityResistanceFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivityResistanceFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return conductivity
|
||||||
|
const scalarField& conductivity() const
|
||||||
|
{
|
||||||
|
return conductivity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return Access to conductivity
|
||||||
|
scalarField& conductivity()
|
||||||
|
{
|
||||||
|
return conductivity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate(const Pstream::commsTypes commsType);
|
||||||
|
|
||||||
|
//- Calculate the thermal diffusivity
|
||||||
|
virtual void calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Calculate the temperature
|
||||||
|
virtual void calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& owner,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
chtRegionCoupleBase(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const chtRegionCoupleBase&
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField::shadowPatchField() const
|
||||||
|
{
|
||||||
|
return dynamic_cast<const chtRegionCoupleBase&>
|
||||||
|
(
|
||||||
|
regionCouplingFvPatchScalarField::shadowPatchField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivitySlaveFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatchScalarField::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRcThermalDiffusivitySlaveFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowPatchField().calcThermalDiffusivity(*this, shadowPatchField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,149 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field taking radiation into account
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef chtRcThermalDiffusivitySlaveFvPatchScalarField_H
|
||||||
|
#define chtRcThermalDiffusivitySlaveFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "chtRegionCoupleBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class chtThermalDiffusivityRegionCoupleFvPatchScalarField;
|
||||||
|
class chtTemperatureRegionCoupleFvPatchScalarField;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class chtRcThermalDiffusivitySlaveFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
:
|
||||||
|
public chtRegionCoupleBase
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("chtRcThermalDiffusivitySlave");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given chtRcThermalDiffusivitySlaveFvPatchScalarField onto a new patch
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivitySlaveFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
chtRcThermalDiffusivitySlaveFvPatchScalarField
|
||||||
|
(
|
||||||
|
const chtRcThermalDiffusivitySlaveFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivitySlaveFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRcThermalDiffusivitySlaveFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return shadow patch field
|
||||||
|
virtual const chtRegionCoupleBase& shadowPatchField() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate(const Pstream::commsTypes commsType);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,178 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "chtRcTemperatureFvPatchScalarField.H"
|
||||||
|
#include "chtRegionCoupleBase.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
chtRegionCoupleBase::chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRegionCoupleBase::chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRegionCoupleBase::chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const chtRegionCoupleBase& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
chtRegionCoupleBase::chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const chtRegionCoupleBase& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionCouplingFvPatchScalarField(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Return a named shadow patch field
|
||||||
|
const chtRegionCoupleBase&
|
||||||
|
chtRegionCoupleBase::shadowPatchField() const
|
||||||
|
{
|
||||||
|
return dynamic_cast<const chtRegionCoupleBase&>
|
||||||
|
(
|
||||||
|
regionCouplingFvPatchScalarField::shadowPatchField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chtRegionCoupleBase::initEvaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Foam::chtRegionCoupleBase::calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
shadowPatchField().calcThermalDiffusivity(owner, neighbour);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Foam::chtRegionCoupleBase::calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& owner,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
shadowPatchField().calcTemperature(owner, neighbour, ownerK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Foam::chtRegionCoupleBase::initInterfaceMatrixUpdate
|
||||||
|
(
|
||||||
|
const scalarField&,
|
||||||
|
scalarField&,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField&,
|
||||||
|
const direction,
|
||||||
|
const Pstream::commsTypes
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"chtRegionCoupleBase::initInterfaceMatrixUpdate"
|
||||||
|
) << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Foam::chtRegionCoupleBase::updateInterfaceMatrix
|
||||||
|
(
|
||||||
|
const scalarField&,
|
||||||
|
scalarField&,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField&,
|
||||||
|
const direction,
|
||||||
|
const Pstream::commsTypes
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"chtRegionCoupleBase::updateInterfaceMatrix"
|
||||||
|
) << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
chtRegionCoupleBase
|
||||||
|
);
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
chtRegionCoupleBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field taking radiation into account
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
chtRegionCoupleBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef chtRegionCoupleBase_H
|
||||||
|
#define chtRegionCoupleBase_H
|
||||||
|
|
||||||
|
#include "regionCouplingFvPatchFields.H"
|
||||||
|
#include "fvMatricesFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class chtRcTemperatureFvPatchScalarField;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class chtRegionCoupleBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class chtRegionCoupleBase
|
||||||
|
:
|
||||||
|
public regionCouplingFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("chtRegionCoupleBase");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given chtRegionCoupleBase onto a new patch
|
||||||
|
chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const chtRegionCoupleBase&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
chtRegionCoupleBase
|
||||||
|
(
|
||||||
|
const chtRegionCoupleBase&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRegionCoupleBase(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new chtRegionCoupleBase(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return false to disable interpolation on this patch
|
||||||
|
virtual bool coupled() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return shadow patch field
|
||||||
|
const chtRegionCoupleBase& shadowPatchField() const;
|
||||||
|
|
||||||
|
//- Return original patch field
|
||||||
|
const scalarField& originalPatchField() const
|
||||||
|
{
|
||||||
|
return regionCouplingFvPatchScalarField::originalPatchField();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Initialise the evaluation of the patch field
|
||||||
|
virtual void initEvaluate(const Pstream::commsTypes commsType);
|
||||||
|
|
||||||
|
//- Calculate the thermal diffusivity
|
||||||
|
virtual void calcThermalDiffusivity
|
||||||
|
(
|
||||||
|
chtRegionCoupleBase& owner,
|
||||||
|
const chtRegionCoupleBase& neighbour
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Calculate the temperature
|
||||||
|
virtual void calcTemperature
|
||||||
|
(
|
||||||
|
chtRcTemperatureFvPatchScalarField& owner,
|
||||||
|
const chtRcTemperatureFvPatchScalarField& neighbour,
|
||||||
|
const chtRegionCoupleBase& ownerK
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Initialise neighbour matrix update
|
||||||
|
virtual void initInterfaceMatrixUpdate
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix& m,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Update result field based on interface functionality
|
||||||
|
virtual void updateInterfaceMatrix
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,214 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "controlledParabolicVelocityFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
Umean_(0),
|
||||||
|
n_(0, 1, 0),
|
||||||
|
y_(1, 0, 0),
|
||||||
|
target_(0),
|
||||||
|
obsFieldName_("undef"),
|
||||||
|
obsPatchName_("undef"),
|
||||||
|
obsPatchID_(-1),
|
||||||
|
gain_(0),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const controlledParabolicVelocityFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||||
|
Umean_(ptf.Umean_),
|
||||||
|
n_(ptf.n_),
|
||||||
|
y_(ptf.y_),
|
||||||
|
target_(ptf.target_),
|
||||||
|
obsFieldName_(ptf.obsFieldName_),
|
||||||
|
obsPatchName_(ptf.obsPatchName_),
|
||||||
|
obsPatchID_(ptf.obsPatchID_),
|
||||||
|
gain_(ptf.gain_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
Umean_(readScalar(dict.lookup("Umean"))),
|
||||||
|
n_(dict.lookup("n")),
|
||||||
|
y_(dict.lookup("y")),
|
||||||
|
target_(readScalar(dict.lookup("target"))),
|
||||||
|
obsFieldName_(dict.lookup("obsFieldName")),
|
||||||
|
obsPatchName_(dict.lookup("obsPatchName")),
|
||||||
|
obsPatchID_(patch().patch().boundaryMesh().findPatchID(obsPatchName_)),
|
||||||
|
gain_(readScalar(dict.lookup("gain"))),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{
|
||||||
|
if (obsPatchID_ < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"controlledParabolicVelocityFvPatchVectorField"
|
||||||
|
) << "patch " << dict.lookup("obsPatchName")
|
||||||
|
<< "not found"
|
||||||
|
<< nl << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
n_ /= mag(n_);
|
||||||
|
y_ /= mag(y_);
|
||||||
|
|
||||||
|
fvPatchField<vector>::operator=
|
||||||
|
(
|
||||||
|
vectorField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const controlledParabolicVelocityFvPatchVectorField& fcvpvf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(fcvpvf, iF),
|
||||||
|
Umean_(fcvpvf.Umean_),
|
||||||
|
n_(fcvpvf.n_),
|
||||||
|
y_(fcvpvf.y_),
|
||||||
|
target_(fcvpvf.target_),
|
||||||
|
obsFieldName_(fcvpvf.obsFieldName_),
|
||||||
|
obsPatchName_(fcvpvf.obsPatchName_),
|
||||||
|
obsPatchID_(fcvpvf.obsPatchID_),
|
||||||
|
gain_(fcvpvf.gain_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void controlledParabolicVelocityFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curTimeIndex_ != this->db().time().timeIndex())
|
||||||
|
{
|
||||||
|
const volScalarField& field =
|
||||||
|
db().lookupObject<volScalarField>(obsFieldName_);
|
||||||
|
|
||||||
|
scalar obsPatchAverage = gAverage(field.boundaryField()[obsPatchID_]);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Average of " << obsFieldName_
|
||||||
|
<< " on patch " << patch().name()
|
||||||
|
<< " = " << obsPatchAverage
|
||||||
|
<< " Difference to target = "
|
||||||
|
<< obsPatchAverage - target_
|
||||||
|
<< " Umean = " << Umean_
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
Umean_ += gain_*(obsPatchAverage - target_);
|
||||||
|
|
||||||
|
// Get range and orientation
|
||||||
|
boundBox bb(patch().patch().localPoints(), true);
|
||||||
|
|
||||||
|
vector ctr = 0.5*(bb.max() + bb.min());
|
||||||
|
|
||||||
|
const vectorField& c = patch().Cf();
|
||||||
|
|
||||||
|
// Calculate local 1-D coordinate for the parabolic profile
|
||||||
|
scalarField coord =
|
||||||
|
0.5 - ((c - ctr) & y_)/((bb.max() - bb.min()) & y_);
|
||||||
|
|
||||||
|
operator==(n_*3/2*Umean_*(1.0 - sqr(coord)));
|
||||||
|
|
||||||
|
curTimeIndex_ = this->db().time().timeIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
void controlledParabolicVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
os.writeKeyword("Umean")
|
||||||
|
<< Umean_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("n")
|
||||||
|
<< n_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("y")
|
||||||
|
<< y_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("target")
|
||||||
|
<< target_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("obsPatchName")
|
||||||
|
<< obsPatchName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("obsFieldName")
|
||||||
|
<< obsFieldName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("gain")
|
||||||
|
<< gain_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchVectorField, controlledParabolicVelocityFvPatchVectorField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
controlledParabolicVelocityFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Boundary condition specifies a velocity inlet profile
|
||||||
|
(fixed value), given the volumetric flow rate
|
||||||
|
flow direction n and direction of the parabolic coordinate y
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
controlledParabolicVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
|
Author
|
||||||
|
Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef controlledParabolicVelocityFvPatchVectorField_H
|
||||||
|
#define controlledParabolicVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class parabolicVelocityFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class controlledParabolicVelocityFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Volumetric flow rate
|
||||||
|
scalar Umean_;
|
||||||
|
|
||||||
|
//- Flow direction
|
||||||
|
vector n_;
|
||||||
|
|
||||||
|
//- 1D coordinate direction
|
||||||
|
vector y_;
|
||||||
|
|
||||||
|
//- target value
|
||||||
|
scalar target_;
|
||||||
|
|
||||||
|
//- field to observe
|
||||||
|
word obsFieldName_;
|
||||||
|
|
||||||
|
//- patch ID to observe
|
||||||
|
word obsPatchName_;
|
||||||
|
|
||||||
|
//- patch ID to observe
|
||||||
|
label obsPatchID_;
|
||||||
|
|
||||||
|
//- proportionality factor
|
||||||
|
scalar gain_;
|
||||||
|
|
||||||
|
//- Current time index
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("controlledParabolicVelocity");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given controlledParabolicVelocityFvPatchVectorField
|
||||||
|
// onto a new patch
|
||||||
|
controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const controlledParabolicVelocityFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new controlledParabolicVelocityFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
controlledParabolicVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const controlledParabolicVelocityFvPatchVectorField&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchVectorField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new controlledParabolicVelocityFvPatchVectorField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Update coefficients
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,235 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "extendedWallHeatTransferFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "radiationConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
Tinf_(0.0),
|
||||||
|
hc_(0.0),
|
||||||
|
alpha_(0.0),
|
||||||
|
KName_("undefined-K"),
|
||||||
|
radiation_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
Tinf_(ptf.Tinf_),
|
||||||
|
hc_(ptf.hc_),
|
||||||
|
alpha_(ptf.alpha_),
|
||||||
|
radSources_(ptf.radSources_),
|
||||||
|
KName_(ptf.KName_),
|
||||||
|
radiation_(ptf.radiation_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
Tinf_(readScalar(dict.lookup("Tinf"))),
|
||||||
|
hc_(readScalar(dict.lookup("hc"))),
|
||||||
|
alpha_(readScalar(dict.lookup("alpha"))),
|
||||||
|
KName_(dict.lookup("K")),
|
||||||
|
radiation_(readBool(dict.lookup("radiation")))
|
||||||
|
{
|
||||||
|
refValue() = Tinf_;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
|
||||||
|
// Construct radiation sources
|
||||||
|
PtrList<entry> entries(dict.lookup("radiationSources"));
|
||||||
|
radSources_.setSize(entries.size());
|
||||||
|
|
||||||
|
forAll(entries, entryI)
|
||||||
|
{
|
||||||
|
radSources_.set
|
||||||
|
(
|
||||||
|
entryI,
|
||||||
|
externalRadiationSource::New
|
||||||
|
(
|
||||||
|
entries[entryI].keyword(),
|
||||||
|
entries[entryI].dict(),
|
||||||
|
p
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf),
|
||||||
|
Tinf_(tppsf.Tinf_),
|
||||||
|
hc_(tppsf.hc_),
|
||||||
|
alpha_(tppsf.alpha_),
|
||||||
|
radSources_(tppsf.radSources_),
|
||||||
|
KName_(tppsf.KName_),
|
||||||
|
radiation_(tppsf.radiation_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf, iF),
|
||||||
|
Tinf_(tppsf.Tinf_),
|
||||||
|
hc_(tppsf.hc_),
|
||||||
|
alpha_(tppsf.alpha_),
|
||||||
|
radSources_(tppsf.radSources_),
|
||||||
|
KName_(tppsf.KName_),
|
||||||
|
radiation_(tppsf.radiation_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::extendedWallHeatTransferFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatch& p = patch();
|
||||||
|
|
||||||
|
scalarField Tc = patchInternalField();
|
||||||
|
const scalarField& Tb = *this;
|
||||||
|
|
||||||
|
const scalarField& kappaEff =
|
||||||
|
p.lookupPatchField<volScalarField, scalar>(KName_);
|
||||||
|
|
||||||
|
scalarField term = kappaEff*patch().deltaCoeffs();
|
||||||
|
|
||||||
|
scalarField Qri(p.size(), 0);
|
||||||
|
if (radiation())
|
||||||
|
{
|
||||||
|
Qri = p.lookupPatchField<volScalarField, scalar>("Qr");
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField Qrio = 4.0*radiation::sigmaSB.value()*pow4(Tb);
|
||||||
|
|
||||||
|
scalarField Two = Tb - (term*(patchInternalField() - Tb) + Qri)/hc_;
|
||||||
|
|
||||||
|
scalarField Qro(p.size(), 0.0);
|
||||||
|
forAll(radSources_, rsI)
|
||||||
|
{
|
||||||
|
Qro += radSources_[rsI].q(Two);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField term2 = Tb*hc_*alpha_ + hc_*Qrio + alpha_*Qrio;
|
||||||
|
|
||||||
|
//Info << "Tc = " << Tc << endl;
|
||||||
|
//Info << "Tb = "<< (scalarField) *this << endl;
|
||||||
|
//Info << "Two = "<< Two << endl;
|
||||||
|
//Info << "Qri = "<< Qri << endl;
|
||||||
|
//Info << "q = "<< q << endl;
|
||||||
|
|
||||||
|
//Info << "q1 = " << hc_*(*this - Two) << endl;
|
||||||
|
//Info << "q2 = " << Qro + alpha_*(Two - Tinf_) << endl;
|
||||||
|
//Info << "q3 = "<< term*(Tc - *this) + Qri << endl;
|
||||||
|
|
||||||
|
valueFraction() = 1.0 / (1.0 + Tb*term*(hc_ + alpha_)/term2);
|
||||||
|
refValue() =
|
||||||
|
Tb*(hc_*alpha_*Tinf_ - hc_*Qro + (hc_ + alpha_)*(Qri + Qrio))/term2;
|
||||||
|
|
||||||
|
mixedFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::extendedWallHeatTransferFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("radiation") << radiation_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("hc") << hc_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os << nl << indent << "radiationSources" << nl
|
||||||
|
<< indent << token::BEGIN_LIST << incrIndent << nl;
|
||||||
|
|
||||||
|
forAll(radSources_, rsI)
|
||||||
|
{
|
||||||
|
os << indent << radSources_[rsI].name() << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||||
|
radSources_[rsI].write(os);
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << decrIndent << indent
|
||||||
|
<< token::END_LIST << token::END_STATEMENT << nl << nl;
|
||||||
|
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extendedWallHeatTransferFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
wall heat transfer boundary condition taking into account
|
||||||
|
|
||||||
|
- heat resistance through a solid planar wall
|
||||||
|
|
||||||
|
q = hc*(Tb - Two)
|
||||||
|
|
||||||
|
- heat convection
|
||||||
|
|
||||||
|
q = alpha*(Two - Tinf)
|
||||||
|
|
||||||
|
- grey body radiation to infinite medium
|
||||||
|
|
||||||
|
q = epsilon*sigma*(Two^4 - Tinf^4)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
extendedWallHeatTransferFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef extendedWallHeatTransferFvPatchScalarField_H
|
||||||
|
#define extendedWallHeatTransferFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
#include "externalRadiationSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class extendedWallHeatTransferFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Tinf [K]
|
||||||
|
scalar Tinf_;
|
||||||
|
|
||||||
|
//- thermal conductance [W/m^2/K]
|
||||||
|
scalar hc_;
|
||||||
|
|
||||||
|
//- heat transfer coefficient [W/m^2/K]
|
||||||
|
scalar alpha_;
|
||||||
|
|
||||||
|
//- list of radiative sources
|
||||||
|
PtrList<externalRadiationSource> radSources_;
|
||||||
|
|
||||||
|
//- Name of thermal conductivity field
|
||||||
|
word KName_;
|
||||||
|
|
||||||
|
//- Take radiation into account for this patch
|
||||||
|
bool radiation_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("extendedWallHeatTransfer");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given extendedWallHeatTransferFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new extendedWallHeatTransferFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
extendedWallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const extendedWallHeatTransferFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new extendedWallHeatTransferFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return radiation
|
||||||
|
bool radiation() const
|
||||||
|
{
|
||||||
|
return radiation_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "viewFactorRadiation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::viewFactorRadiation::viewFactorRadiation
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label size
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
Tinf_(readScalar(dict.lookup("Tinf"))),
|
||||||
|
F_("F", dict, size),
|
||||||
|
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::viewFactorRadiation::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << indent << name_ << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl;
|
||||||
|
F_.writeEntry("F", os);
|
||||||
|
os.writeKeyword("epsilon") << epsilon_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const viewFactorRadiation& r)
|
||||||
|
{
|
||||||
|
r.write(os);
|
||||||
|
os.check("Ostream& operator<<(Ostream&, const viewFactorRadiation&)");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::viewFactorRadiation
|
||||||
|
|
||||||
|
Description
|
||||||
|
helper class to sum up external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
viewFactorRadiation.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef viewFactorRadiation_H
|
||||||
|
#define viewFactorRadiation_H
|
||||||
|
|
||||||
|
#include "scalarField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
class viewFactorRadiation;
|
||||||
|
Ostream& operator<<(Ostream&, const viewFactorRadiation&);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class viewFactorRadiation
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- name
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
//- Tinf [K]
|
||||||
|
scalar Tinf_;
|
||||||
|
|
||||||
|
//- view factor [-]
|
||||||
|
scalarField F_;
|
||||||
|
|
||||||
|
//- emissivity [-]
|
||||||
|
scalar epsilon_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected thermal model
|
||||||
|
static autoPtr<viewFactorRadiation> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return autoPtr<viewFactorRadiation>
|
||||||
|
(
|
||||||
|
new viewFactorRadiation(name, dict, size)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit viewFactorRadiation
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label size
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
Foam::autoPtr<viewFactorRadiation> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<viewFactorRadiation>
|
||||||
|
(
|
||||||
|
new viewFactorRadiation(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Return Tinf
|
||||||
|
scalar Tinf() const
|
||||||
|
{
|
||||||
|
return Tinf_;
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Return F
|
||||||
|
const scalarField& F() const
|
||||||
|
{
|
||||||
|
return F_;
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Return epsilon
|
||||||
|
scalar epsilon() const
|
||||||
|
{
|
||||||
|
return epsilon_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
// IOstream operators
|
||||||
|
|
||||||
|
friend Ostream& operator<<(Ostream&, const viewFactorRadiation&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ersConstantFlux.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(ersConstantFlux, 0);
|
||||||
|
addToRunTimeSelectionTable(externalRadiationSource, ersConstantFlux, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ersConstantFlux::ersConstantFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
externalRadiationSource(name),
|
||||||
|
q_("q", dict, p.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
ersConstantFlux::ersConstantFlux
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
externalRadiationSource(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void ersConstantFlux::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
externalRadiationSource::write(os);
|
||||||
|
|
||||||
|
q_.writeEntry("q", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ersConstantFlux
|
||||||
|
|
||||||
|
Description
|
||||||
|
helper class to sum up external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ersConstantFlux.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ersConstantFlux_H
|
||||||
|
#define ersConstantFlux_H
|
||||||
|
|
||||||
|
#include "externalRadiationSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ersConstantFlux
|
||||||
|
:
|
||||||
|
public externalRadiationSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- heat flux
|
||||||
|
scalarField q_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constantFlux");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit ersConstantFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
);
|
||||||
|
|
||||||
|
explicit ersConstantFlux
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<externalRadiationSource> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<externalRadiationSource>
|
||||||
|
(
|
||||||
|
new ersConstantFlux(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~ersConstantFlux()
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
const scalarField& q() const
|
||||||
|
{
|
||||||
|
return q_;
|
||||||
|
};
|
||||||
|
|
||||||
|
scalarField& q()
|
||||||
|
{
|
||||||
|
return q_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Return heat flux
|
||||||
|
virtual tmp<scalarField> q(const scalarField&) const
|
||||||
|
{
|
||||||
|
return q_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ersPlaneToCylinder.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(ersPlaneToCylinder, 0);
|
||||||
|
addToRunTimeSelectionTable(externalRadiationSource, ersPlaneToCylinder, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ersPlaneToCylinder::ersPlaneToCylinder
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ersViewFactor(name, dict),
|
||||||
|
direction_(dict.lookup("direction"))
|
||||||
|
{
|
||||||
|
scalarField cosBeta = (direction_ & p.Sf()/p.magSf());
|
||||||
|
|
||||||
|
F() = 0.5 - 0.5*cosBeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void ersPlaneToCylinder::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
ersViewFactor::write(os);
|
||||||
|
os.writeKeyword("direction") << direction_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ersPlaneToCylinder
|
||||||
|
|
||||||
|
Description
|
||||||
|
helper class to sum up external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ersPlaneToCylinder.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ersPlaneToCylinder_H
|
||||||
|
#define ersPlaneToCylinder_H
|
||||||
|
|
||||||
|
#include "ersViewFactor.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ersPlaneToCylinder
|
||||||
|
:
|
||||||
|
public ersViewFactor
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Direction of infinite plane
|
||||||
|
vector direction_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("planeToCylinder");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit ersPlaneToCylinder
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<externalRadiationSource> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<externalRadiationSource>
|
||||||
|
(
|
||||||
|
new ersPlaneToCylinder(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~ersPlaneToCylinder()
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ersPointSource.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(ersPointSource, 0);
|
||||||
|
addToRunTimeSelectionTable(externalRadiationSource, ersPointSource, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ersPointSource::ersPointSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ersConstantFlux(name),
|
||||||
|
qmax_(readScalar(dict.lookup("qmax"))),
|
||||||
|
alpha_(readScalar(dict.lookup("alpha"))),
|
||||||
|
direction_(dict.lookup("direction"))
|
||||||
|
{
|
||||||
|
q() = -alpha_*qmax_*min(direction_ & p.Sf()/p.magSf(), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void ersPointSource::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
ersConstantFlux::write(os);
|
||||||
|
os.writeKeyword("qmax") << qmax_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("direction") << direction_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ersPointSource
|
||||||
|
|
||||||
|
Description
|
||||||
|
helper class to sum up external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ersPointSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ersPointSource_H
|
||||||
|
#define ersPointSource_H
|
||||||
|
|
||||||
|
#include "ersConstantFlux.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ersPointSource
|
||||||
|
:
|
||||||
|
public ersConstantFlux
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Strenght of the point source
|
||||||
|
scalar qmax_;
|
||||||
|
|
||||||
|
//- radiation absorptivity
|
||||||
|
scalar alpha_;
|
||||||
|
|
||||||
|
//- Direction of the ersPointSource
|
||||||
|
vector direction_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("pointSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit ersPointSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<externalRadiationSource> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<externalRadiationSource>
|
||||||
|
(
|
||||||
|
new ersPointSource(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~ersPointSource()
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ersViewFactor.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "radiationConstants.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(ersViewFactor, 0);
|
||||||
|
addToRunTimeSelectionTable(externalRadiationSource, ersViewFactor, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ersViewFactor::ersViewFactor
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
externalRadiationSource(name),
|
||||||
|
Tinf_(readScalar(dict.lookup("Tinf"))),
|
||||||
|
F_("F", dict, p.size()),
|
||||||
|
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
ersViewFactor::ersViewFactor
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
externalRadiationSource(name),
|
||||||
|
Tinf_(readScalar(dict.lookup("Tinf"))),
|
||||||
|
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tmp<scalarField> ersViewFactor::q
|
||||||
|
(
|
||||||
|
const scalarField& Tw
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return epsilon_*F_*radiation::sigmaSB.value()*(pow4(Tw) - pow4(Tinf_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ersViewFactor::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
externalRadiationSource::write(os);
|
||||||
|
|
||||||
|
os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl;
|
||||||
|
F_.writeEntry("F", os);
|
||||||
|
os.writeKeyword("epsilon") << epsilon_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ersViewFactor
|
||||||
|
|
||||||
|
Description
|
||||||
|
helper class to sum up external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ersViewFactor.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ersViewFactor_H
|
||||||
|
#define ersViewFactor_H
|
||||||
|
|
||||||
|
#include "externalRadiationSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ersViewFactor
|
||||||
|
:
|
||||||
|
public externalRadiationSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- temperature at infinity
|
||||||
|
scalar Tinf_;
|
||||||
|
|
||||||
|
//- view factor
|
||||||
|
scalarField F_;
|
||||||
|
|
||||||
|
//- espison
|
||||||
|
scalar epsilon_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("viewFactor");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit ersViewFactor
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit ersViewFactor
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<externalRadiationSource> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<externalRadiationSource>
|
||||||
|
(
|
||||||
|
new ersViewFactor(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~ersViewFactor()
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
const scalarField& F() const
|
||||||
|
{
|
||||||
|
return F_;
|
||||||
|
};
|
||||||
|
|
||||||
|
scalarField& F()
|
||||||
|
{
|
||||||
|
return F_;
|
||||||
|
};
|
||||||
|
|
||||||
|
const scalar& epsilon() const
|
||||||
|
{
|
||||||
|
return epsilon_;
|
||||||
|
};
|
||||||
|
|
||||||
|
scalar& epsilson()
|
||||||
|
{
|
||||||
|
return epsilon_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Return heat flux
|
||||||
|
virtual tmp<scalarField> q(const scalarField& Tw) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "externalRadiationSource.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(externalRadiationSource, 0);
|
||||||
|
defineRunTimeSelectionTable(externalRadiationSource, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
externalRadiationSource::externalRadiationSource
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name)
|
||||||
|
{
|
||||||
|
Info << "externalRadiationSource::externalRadiationSource" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void externalRadiationSource::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,158 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::externalRadiationSource
|
||||||
|
|
||||||
|
Description
|
||||||
|
Virtual base class for external radiation sources
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
externalRadiationSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef externalRadiationSource_H
|
||||||
|
#define externalRadiationSource_H
|
||||||
|
|
||||||
|
#include "scalarField.H"
|
||||||
|
#include "tmp.H"
|
||||||
|
#include "fvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class externalRadiationSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- name
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("externalRadiationSource");
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
externalRadiationSource,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
),
|
||||||
|
(name, dict, p)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~externalRadiationSource()
|
||||||
|
{};
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected thermal model
|
||||||
|
static autoPtr<externalRadiationSource> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<externalRadiationSource> clone() const
|
||||||
|
{
|
||||||
|
notImplemented("autoPt<externalRadiationSource> clone() const");
|
||||||
|
return autoPtr<externalRadiationSource>(NULL);
|
||||||
|
|
||||||
|
return autoPtr<externalRadiationSource>
|
||||||
|
(
|
||||||
|
new externalRadiationSource(*this)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit externalRadiationSource
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Return heat flux
|
||||||
|
virtual tmp<scalarField> q(const scalarField& Tw) const
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
type() +"::q(const scalarField& Tw) const"
|
||||||
|
);
|
||||||
|
|
||||||
|
return tmp<scalarField>(NULL);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "externalRadiationSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
autoPtr<externalRadiationSource> externalRadiationSource::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word ersTypeName = dict.lookup("type");
|
||||||
|
|
||||||
|
Info<< "Selecting external radiation source " << ersTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(ersTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"externalRadiationSource::New(\n"
|
||||||
|
" const word& name,\n"
|
||||||
|
" const dictionary& dict,\n"
|
||||||
|
" const fvPatch& p\n"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Unknown externalRadiationSource type "
|
||||||
|
<< ersTypeName << endl << endl
|
||||||
|
<< "Valid externalRadiationSource are : " << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Here 2" << endl;
|
||||||
|
|
||||||
|
return cstrIter()(name, dict, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fieldStorage.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fieldStorage<Type>::fieldStorage()
|
||||||
|
:
|
||||||
|
storedField_(),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void fieldStorage<Type>::store()
|
||||||
|
{
|
||||||
|
if (curTimeIndex_ != time_.timeIndex())
|
||||||
|
{
|
||||||
|
storedField_ = *this;
|
||||||
|
curTimeIndex_ = time_.timeIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Field<Type>& originalPatchField<Type>::store() const
|
||||||
|
{
|
||||||
|
if (curTimeIndex_ == time_.timeIndex())
|
||||||
|
{
|
||||||
|
return storedField_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void originalPatchField<Type>::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
storedField_::autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void clear() const
|
||||||
|
{
|
||||||
|
originalPatchField_.setSize(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
fieldStorage
|
||||||
|
|
||||||
|
Description
|
||||||
|
Region couple patch field
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fieldStorage.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fieldStorage_H
|
||||||
|
#define fieldStorage_H
|
||||||
|
|
||||||
|
#include "coupledFvPatchField.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fieldStorage Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fieldStorage
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
// Reference to time
|
||||||
|
const runTime& time_;
|
||||||
|
|
||||||
|
//- original patch field
|
||||||
|
Field<Type> storedField_;
|
||||||
|
|
||||||
|
//- Current time index used to store originalPatchField_
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
fieldStorage();
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Store field
|
||||||
|
void store(const Field<Type>&) const;
|
||||||
|
|
||||||
|
//- Return stored field
|
||||||
|
const Field<Type>& originalPatchField() const;
|
||||||
|
|
||||||
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
void autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||||
|
void rmap
|
||||||
|
(
|
||||||
|
const fvPatchField<Type>&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Clear storage
|
||||||
|
void clear() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "fieldStorage.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "solidWallHeatFluxTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
q_(p.size(), 0.0),
|
||||||
|
KName_("undefined-K")
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
q_(ptf.q_, mapper),
|
||||||
|
KName_(ptf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict),
|
||||||
|
q_("q", dict, p.size()),
|
||||||
|
KName_(dict.lookup("K"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf),
|
||||||
|
q_(tppsf.q_),
|
||||||
|
KName_(tppsf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF),
|
||||||
|
q_(tppsf.q_),
|
||||||
|
KName_(tppsf.KName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::autoMap(m);
|
||||||
|
q_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf =
|
||||||
|
refCast<const solidWallHeatFluxTemperatureFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
q_.rmap(hfptf.q_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalarField& Kw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||||
|
|
||||||
|
const fvPatchScalarField& Tw = *this;
|
||||||
|
|
||||||
|
operator==(q_/(patch().deltaCoeffs()*Kw) + Tw.patchInternalField());
|
||||||
|
|
||||||
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::write(os);
|
||||||
|
q_.writeEntry("q", os);
|
||||||
|
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Heat flux boundary condition for temperature on solid region
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
myWallPatch
|
||||||
|
{
|
||||||
|
type solidWallHeatFluxTemperature;
|
||||||
|
K K; // Name of K field
|
||||||
|
q uniform 1000; // Heat flux / [W/m2]
|
||||||
|
value 300.0; // Initial temperature / [K]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||||
|
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class solidWallHeatFluxTemperatureFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Heat flux / [W/m2]
|
||||||
|
scalarField q_;
|
||||||
|
|
||||||
|
//- Name of thermal conductivity field
|
||||||
|
word KName_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("solidWallHeatFluxTemperature");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new solidWallHeatFluxTemperatureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const solidWallHeatFluxTemperatureFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new solidWallHeatFluxTemperatureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
virtual void autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||||
|
virtual void rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constantResistanceThermalGap.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(constantResistanceThermalGap, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalGap, constantResistanceThermalGap, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::constantResistanceThermalGap::constantResistanceThermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalGap(name, T, dict),
|
||||||
|
R_(dict.lookup("R")),
|
||||||
|
zones_(dict.lookup("zones"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::constantResistanceThermalGap::~constantResistanceThermalGap()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::constantResistanceThermalGap::modifyResistance
|
||||||
|
(
|
||||||
|
surfaceScalarField& DT
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(zones_, zoneI)
|
||||||
|
{
|
||||||
|
const label zoneID = mesh().faceZones().findZoneID(zones_[zoneI]);
|
||||||
|
|
||||||
|
if ( zoneID < 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"constantResistanceThermalGap::modifyResistance()\n"
|
||||||
|
) << "Zone " << zones_[zoneI]
|
||||||
|
<< " specified in gap " << name()
|
||||||
|
<< " does not exist"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& faces = mesh().faceZones()[zoneID];
|
||||||
|
const surfaceScalarField& deltaCoeffs = mesh().deltaCoeffs();
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
DT[faces[faceI]] = 1.0/deltaCoeffs[faceI]/R_.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
constantResistanceThermalGap
|
||||||
|
|
||||||
|
Description
|
||||||
|
Constant thermal properties
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH, All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
constantResistanceThermalGap.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef constantResistanceThermalGap_H
|
||||||
|
#define constantResistanceThermalGap_H
|
||||||
|
|
||||||
|
#include "thermalGap.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class constantResistanceThermalGap Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class constantResistanceThermalGap
|
||||||
|
:
|
||||||
|
public thermalGap
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- thermal resistance of the gap
|
||||||
|
dimensionedScalar R_;
|
||||||
|
|
||||||
|
//- list of face zones
|
||||||
|
const wordList zones_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
constantResistanceThermalGap(const constantResistanceThermalGap&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const constantResistanceThermalGap&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constantResistance");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
constantResistanceThermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~constantResistanceThermalGap();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return density
|
||||||
|
virtual void modifyResistance(surfaceScalarField&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constantThermalGap.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(constantThermalGap, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalGap, constantThermalGap, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::constantThermalGap::constantThermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalGap(name, T, dict),
|
||||||
|
beta_(dict.lookup("beta")),
|
||||||
|
zones_(dict.lookup("zones"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::constantThermalGap::~constantThermalGap()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::constantThermalGap::modifyResistance(surfaceScalarField& DT) const
|
||||||
|
{
|
||||||
|
forAll(zones_, zoneI)
|
||||||
|
{
|
||||||
|
const label zoneID = mesh().faceZones().findZoneID(zones_[zoneI]);
|
||||||
|
|
||||||
|
if ( zoneID < 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"constantThermalGap::modifyResistance()\n"
|
||||||
|
) << "Zone " << zones_[zoneI]
|
||||||
|
<< " specified in gap " << name()
|
||||||
|
<< " does not exist"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& faces = mesh().faceZones()[zoneID];
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
label fI = faces[faceI];
|
||||||
|
if(fI < mesh().nInternalFaces())
|
||||||
|
{
|
||||||
|
DT[fI] = beta_.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const label patchI = mesh().boundaryMesh().whichPatch(fI);
|
||||||
|
fI -= mesh().boundaryMesh()[patchI].start();
|
||||||
|
DT.boundaryField()[patchI][fI] = beta_.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
constantThermalGap
|
||||||
|
|
||||||
|
Description
|
||||||
|
Constant thermal properties
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH, All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
constantThermalGap.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef constantThermalGap_H
|
||||||
|
#define constantThermalGap_H
|
||||||
|
|
||||||
|
#include "thermalGap.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class constantThermalGap Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class constantThermalGap
|
||||||
|
:
|
||||||
|
public thermalGap
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- thermal resistance of the gap
|
||||||
|
dimensionedScalar beta_;
|
||||||
|
|
||||||
|
//- list of face zones
|
||||||
|
const wordList zones_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
constantThermalGap(const constantThermalGap&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const constantThermalGap&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constant");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
constantThermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~constantThermalGap();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return density
|
||||||
|
virtual void modifyResistance(surfaceScalarField&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalGap
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalGap.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
autoPtr<thermalGap> thermalGap::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word tgTypeName = dict.lookup("type");
|
||||||
|
|
||||||
|
Info<< "Selecting thermal gap model " << tgTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(tgTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"thermalGap::New(\n"
|
||||||
|
" const word& name,\n"
|
||||||
|
" const volScalarField& T,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Unknown thermalGap type "
|
||||||
|
<< tgTypeName << endl << endl
|
||||||
|
<< "Valid thermalGaps are : " << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<thermalGap>(cstrIter()(name, T, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalGap
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalGap.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalGap, 0);
|
||||||
|
defineRunTimeSelectionTable(thermalGap, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalGap::thermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
T_(T)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalGap
|
||||||
|
|
||||||
|
Description
|
||||||
|
Thermal properties of a gap.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH, All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalGap.C
|
||||||
|
newThermalLaw.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalGap_H
|
||||||
|
#define thermalGap_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "tmp.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalGap Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalGap
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name
|
||||||
|
const word name_;
|
||||||
|
|
||||||
|
//- Reference to temperature field
|
||||||
|
const volScalarField& T_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
thermalGap(const thermalGap&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const thermalGap&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return reference to mesh
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return T_.mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalGap");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
thermalGap,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(name, T, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected thermal model
|
||||||
|
static autoPtr<thermalGap> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
thermalGap
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~thermalGap()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name
|
||||||
|
const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return temperture
|
||||||
|
const volScalarField& T() const
|
||||||
|
{
|
||||||
|
return T_;
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Modify the resistance
|
||||||
|
virtual void modifyResistance(surfaceScalarField&) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constantThermal.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(constantThermal, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalLaw, constantThermal, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::constantThermal::constantThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalLaw(name, T, dict),
|
||||||
|
rho_(dict.lookup("rho")),
|
||||||
|
C_(dict.lookup("C")),
|
||||||
|
k_(dict.lookup("k"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::constantThermal::~constantThermal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::constantThermal::rho() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
rho_,
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
tresult().correctBoundaryConditions();
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::constantThermal::C() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"C",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
C_,
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
tresult().correctBoundaryConditions();
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::constantThermal::k() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"kTmp",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
k_,
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
tresult().correctBoundaryConditions();
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
constantThermal
|
||||||
|
|
||||||
|
Description
|
||||||
|
Constant thermal properties
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
constantThermal.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef constantThermal_H
|
||||||
|
#define constantThermal_H
|
||||||
|
|
||||||
|
#include "thermalLaw.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class constantThermal Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class constantThermal
|
||||||
|
:
|
||||||
|
public thermalLaw
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Specific heat capacity
|
||||||
|
dimensionedScalar rho_;
|
||||||
|
|
||||||
|
//- Specific heat capacity
|
||||||
|
dimensionedScalar C_;
|
||||||
|
|
||||||
|
//- Thermal conductivity
|
||||||
|
dimensionedScalar k_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
constantThermal(const constantThermal&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const constantThermal&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constant");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
constantThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~constantThermal();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return density
|
||||||
|
virtual tmp<volScalarField> rho() const;
|
||||||
|
|
||||||
|
//- Return specific heat capacity
|
||||||
|
virtual tmp<volScalarField> C() const;
|
||||||
|
|
||||||
|
//- Return thermal conductivity
|
||||||
|
virtual tmp<volScalarField> k() const;
|
||||||
|
|
||||||
|
virtual void correct()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,325 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "multiMaterialThermal.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(multiMaterialThermal, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalLaw, multiMaterialThermal, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::multiMaterialThermal::indicator
|
||||||
|
(
|
||||||
|
const label i
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const scalarField& mat = materials_.internalField();
|
||||||
|
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"indicator",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimless,
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField& result = tresult();
|
||||||
|
|
||||||
|
forAll (mat, matI)
|
||||||
|
{
|
||||||
|
if (mat[matI] > i - SMALL && mat[matI] < i + SMALL)
|
||||||
|
{
|
||||||
|
result[matI] = 1.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result[matI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.correctBoundaryConditions();
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::multiMaterialThermal::readLaws
|
||||||
|
(
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
PtrList<entry> lawEntries(dict.lookup("laws"));
|
||||||
|
laws.setSize(lawEntries.size());
|
||||||
|
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
laws.set
|
||||||
|
(
|
||||||
|
lawI,
|
||||||
|
thermalLaw::New
|
||||||
|
(
|
||||||
|
lawEntries[lawI].keyword(),
|
||||||
|
T,
|
||||||
|
lawEntries[lawI].dict()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Foam::multiMaterialThermal::checkLaws() const
|
||||||
|
{
|
||||||
|
const PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
max(materials_).value() > laws.size() + SMALL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"multiMaterialThermal::checkLaws()\n"
|
||||||
|
) << "Invalid definition of material indicator field. "
|
||||||
|
<< "Number of materials: " << laws.size()
|
||||||
|
<< " max index: " << max(materials_)
|
||||||
|
<< ". Should be " << laws.size() - 1
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
min(materials_).value() < 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"multiMaterialThermal::checkLaws()\n"
|
||||||
|
) << "Invalid definition of material indicator field. "
|
||||||
|
<< "Number of materials: " << laws.size()
|
||||||
|
<< " min index: " << min(materials_)
|
||||||
|
<< ". Should be 0"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::multiMaterialThermal::multiMaterialThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalLaw(name, T, dict),
|
||||||
|
PtrList<thermalLaw>(),
|
||||||
|
materials_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"materials",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readLaws(T, dict);
|
||||||
|
checkLaws();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct from dictionary and create default material field
|
||||||
|
Foam::multiMaterialThermal::multiMaterialThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict,
|
||||||
|
const scalar defaultMaterial
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalLaw(name, T, dict),
|
||||||
|
PtrList<thermalLaw>(),
|
||||||
|
materials_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"materials",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
defaultMaterial,
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readLaws(T, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
Foam::multiMaterialThermal::~multiMaterialThermal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::multiMaterialThermal::rho() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoTmp",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("zeroRho", dimDensity, 0),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
volScalarField& result = tresult();
|
||||||
|
|
||||||
|
// Accumulate data for all fields
|
||||||
|
const PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
result += indicator(lawI)*laws[lawI].rho()();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::multiMaterialThermal::C() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"CTmp",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("zeroC", dimSpecificHeatCapacity, 0),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
volScalarField& result = tresult();
|
||||||
|
|
||||||
|
// Accumulate data for all fields
|
||||||
|
const PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
result += indicator(lawI)*laws[lawI].C()();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::multiMaterialThermal::k() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tresult
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"kTmp",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("zerok", dimensionSet(1, 1, -3, -1, 0), 0),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
volScalarField& result = tresult();
|
||||||
|
|
||||||
|
// Accumulate data for all fields
|
||||||
|
const PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
result += indicator(lawI)*laws[lawI].k();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::multiMaterialThermal::correct()
|
||||||
|
{
|
||||||
|
PtrList<thermalLaw>& laws = *this;
|
||||||
|
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
laws[lawI].correct();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
multiMaterialThermal
|
||||||
|
|
||||||
|
Description
|
||||||
|
Zoned multi-material thermal model controlled by an indicator field.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
multiMaterialThermal.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef multiMaterialThermal_H
|
||||||
|
#define multiMaterialThermal_H
|
||||||
|
|
||||||
|
#include "thermalLaw.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class multiMaterialThermal Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class multiMaterialThermal
|
||||||
|
:
|
||||||
|
public thermalLaw,
|
||||||
|
public PtrList<thermalLaw>
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
multiMaterialThermal(const multiMaterialThermal&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const multiMaterialThermal&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Calculate indicator field given index
|
||||||
|
tmp<volScalarField> indicator(const label index) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Material indicator field
|
||||||
|
volScalarField materials_;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
|
//- Check that the laws and the material field are okay
|
||||||
|
void readLaws
|
||||||
|
(
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check that the laws and the material field are okay
|
||||||
|
void checkLaws() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("multiMaterial");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
multiMaterialThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary and create default material field
|
||||||
|
multiMaterialThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict,
|
||||||
|
const scalar defaultMaterial
|
||||||
|
);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~multiMaterialThermal();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return density
|
||||||
|
virtual tmp<volScalarField> rho() const;
|
||||||
|
|
||||||
|
//- Return specific heat capacity
|
||||||
|
virtual tmp<volScalarField> C() const;
|
||||||
|
|
||||||
|
//- Return thermal conductivity
|
||||||
|
virtual tmp<volScalarField> k() const;
|
||||||
|
|
||||||
|
//- Correct the rheological model
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "multiMaterialZonesThermal.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(multiMaterialZonesThermal, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalLaw, multiMaterialZonesThermal, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::multiMaterialZonesThermal::multiMaterialZonesThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
multiMaterialThermal(name, T, dict, -1)
|
||||||
|
{
|
||||||
|
readLaws(T, dict);
|
||||||
|
|
||||||
|
PtrList<entry> lawEntries(dict.lookup("laws"));
|
||||||
|
|
||||||
|
PtrList<thermalLaw>& laws = *this;
|
||||||
|
forAll (laws, lawI)
|
||||||
|
{
|
||||||
|
wordList zones (lawEntries[lawI].dict().lookup("zones"));
|
||||||
|
|
||||||
|
forAll(zones, zoneI)
|
||||||
|
{
|
||||||
|
const label zoneID = mesh().cellZones().findZoneID(zones[zoneI]);
|
||||||
|
|
||||||
|
if ( zoneID < 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"multiMaterialZonesThermal::multiMaterialZonesThermal()\n"
|
||||||
|
) << "Zone " << zones[zoneI]
|
||||||
|
<< " specified in material " << lawEntries[lawI].keyword()
|
||||||
|
<< " does not exist"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& cells = mesh().cellZones()[zoneID];
|
||||||
|
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
materials_[cells[cellI]] = lawI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
materials_.correctBoundaryConditions();
|
||||||
|
materials_.write();
|
||||||
|
|
||||||
|
checkLaws();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::multiMaterialZonesThermal::~multiMaterialZonesThermal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
multiMaterialZonesThermal
|
||||||
|
|
||||||
|
Description
|
||||||
|
Zoned multi-material thermal model constructed from zones
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH, All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
multiMaterialZonesThermal.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef multiMaterialZonesThermal_H
|
||||||
|
#define multiMaterialZonesThermal_H
|
||||||
|
|
||||||
|
#include "multiMaterialThermal.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class multiMaterialZonesThermal Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class multiMaterialZonesThermal
|
||||||
|
:
|
||||||
|
public multiMaterialThermal
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
multiMaterialZonesThermal(const multiMaterialZonesThermal&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const multiMaterialZonesThermal&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("multiMaterialZones");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
multiMaterialZonesThermal
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~multiMaterialZonesThermal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalLaw
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalLaw.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
autoPtr<thermalLaw> thermalLaw::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word rheoTypeName = dict.lookup("type");
|
||||||
|
|
||||||
|
Info<< "Selecting thermal model " << rheoTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(rheoTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"thermalLaw::New(\n"
|
||||||
|
" const word& name,\n"
|
||||||
|
" const volScalarField& T,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Unknown thermalLaw type "
|
||||||
|
<< rheoTypeName << endl << endl
|
||||||
|
<< "Valid thermalLaws are : " << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<thermalLaw>(cstrIter()(name, T, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalLaw
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalLaw.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalLaw, 0);
|
||||||
|
defineRunTimeSelectionTable(thermalLaw, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalLaw::thermalLaw
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
T_(T)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,173 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalLaw
|
||||||
|
|
||||||
|
Description
|
||||||
|
Thermal material properties for solids.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalLaw.C
|
||||||
|
newThermalLaw.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalLaw_H
|
||||||
|
#define thermalLaw_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "tmp.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalLaw Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalLaw
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name
|
||||||
|
const word name_;
|
||||||
|
|
||||||
|
//- Reference to temperature field
|
||||||
|
const volScalarField& T_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
thermalLaw(const thermalLaw&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const thermalLaw&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return reference to mesh
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return T_.mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalLaw");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
thermalLaw,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(name, T, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected thermal model
|
||||||
|
static autoPtr<thermalLaw> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
thermalLaw
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~thermalLaw()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name
|
||||||
|
const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return temperture
|
||||||
|
const volScalarField& T() const
|
||||||
|
{
|
||||||
|
return T_;
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Return specific density
|
||||||
|
virtual tmp<volScalarField> rho() const = 0;
|
||||||
|
|
||||||
|
//- Return specific heat capacity
|
||||||
|
virtual tmp<volScalarField> C() const = 0;
|
||||||
|
|
||||||
|
//- Return thermal conductivity
|
||||||
|
virtual tmp<volScalarField> k() const = 0;
|
||||||
|
|
||||||
|
//- Correct the thermal model
|
||||||
|
virtual void correct() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Thermal material properties for solids.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalModel.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
#include "fvm.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalModel, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalModel::thermalModel(const volScalarField& T)
|
||||||
|
:
|
||||||
|
IOdictionary
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"thermalProperties",
|
||||||
|
T.time().constant(),
|
||||||
|
T.db(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
),
|
||||||
|
T_(T),
|
||||||
|
lawPtr_(thermalLaw::New("law", T_, subDict("thermal")))
|
||||||
|
{
|
||||||
|
{
|
||||||
|
PtrList<entry> entries(subDict("thermal").lookup("gaps"));
|
||||||
|
gapPtr_.setSize(entries.size());
|
||||||
|
|
||||||
|
forAll (gapPtr_, gapI)
|
||||||
|
{
|
||||||
|
gapPtr_.set
|
||||||
|
(
|
||||||
|
gapI,
|
||||||
|
thermalGap::New
|
||||||
|
(
|
||||||
|
entries[gapI].keyword(),
|
||||||
|
T,
|
||||||
|
entries[gapI].dict()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
PtrList<entry> entries(subDict("thermal").lookup("sources"));
|
||||||
|
sourcePtr_.setSize(entries.size());
|
||||||
|
|
||||||
|
forAll (sourcePtr_, sourceI)
|
||||||
|
{
|
||||||
|
sourcePtr_.set
|
||||||
|
(
|
||||||
|
sourceI,
|
||||||
|
thermalSource::New
|
||||||
|
(
|
||||||
|
entries[sourceI].keyword(),
|
||||||
|
T,
|
||||||
|
entries[sourceI].dict()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void thermalModel::modifyResistance
|
||||||
|
(
|
||||||
|
surfaceScalarField& kf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(gapPtr_, gapI)
|
||||||
|
{
|
||||||
|
gapPtr_[gapI].modifyResistance(kf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<fvScalarMatrix> thermalModel::laplacian(volScalarField& T)
|
||||||
|
{
|
||||||
|
word kScheme ("laplacian(k,T)");
|
||||||
|
|
||||||
|
surfaceScalarField kf = fvc::interpolate(lawPtr_->k());
|
||||||
|
|
||||||
|
modifyResistance(kf);
|
||||||
|
|
||||||
|
return tmp<fvScalarMatrix>
|
||||||
|
(
|
||||||
|
new fvScalarMatrix( fvm::laplacian(kf, T, kScheme) )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<volScalarField> thermalModel::S() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tsource
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"heatSource",
|
||||||
|
T_.time().timeName(),
|
||||||
|
T_.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
T_.mesh(),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimEnergy/dimTime/dimVolume,
|
||||||
|
scalar(0.0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(sourcePtr_, sourceI)
|
||||||
|
{
|
||||||
|
sourcePtr_[sourceI].addSource(tsource());
|
||||||
|
}
|
||||||
|
|
||||||
|
return tsource;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool thermalModel::read()
|
||||||
|
{
|
||||||
|
if (regIOobject::read())
|
||||||
|
{
|
||||||
|
lawPtr_ = thermalLaw::New("law", T_, subDict("thermal"));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Thermal material properties for solids.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalModel_H
|
||||||
|
#define thermalModel_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
#include "tmp.H"
|
||||||
|
#include "thermalLaw.H"
|
||||||
|
#include "thermalGap.H"
|
||||||
|
#include "thermalSource.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalModel
|
||||||
|
:
|
||||||
|
public IOdictionary
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to temperature field
|
||||||
|
const volScalarField& T_;
|
||||||
|
|
||||||
|
//- Thermal law
|
||||||
|
autoPtr<thermalLaw> lawPtr_;
|
||||||
|
|
||||||
|
//- Contact resistance
|
||||||
|
PtrList<thermalGap> gapPtr_;
|
||||||
|
|
||||||
|
//- Thermal Source
|
||||||
|
PtrList<thermalSource> sourcePtr_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
thermalModel(const thermalModel&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const thermalModel&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalModel");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
thermalModel(const volScalarField& T);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~thermalModel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return thermal law
|
||||||
|
const thermalLaw& law() const
|
||||||
|
{
|
||||||
|
return lawPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return density
|
||||||
|
tmp<volScalarField> rho() const
|
||||||
|
{
|
||||||
|
return lawPtr_->rho();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return specific heat capacity
|
||||||
|
tmp<volScalarField> C() const
|
||||||
|
{
|
||||||
|
return lawPtr_->C();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return thermal conductivity
|
||||||
|
tmp<volScalarField> k() const
|
||||||
|
{
|
||||||
|
return lawPtr_->k();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Add resistance for gaps
|
||||||
|
void modifyResistance(surfaceScalarField&) const;
|
||||||
|
|
||||||
|
//- Return the laplacian and incorporate resistance for gaps
|
||||||
|
tmp<fvScalarMatrix> laplacian(volScalarField&);
|
||||||
|
|
||||||
|
//- Return the aggregated source
|
||||||
|
tmp<volScalarField> S() const;
|
||||||
|
|
||||||
|
//- Correct the thermal model
|
||||||
|
void correct()
|
||||||
|
{
|
||||||
|
lawPtr_->correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read thermalProperties dictionary
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constantThermalSource.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(constantThermalSource, 0);
|
||||||
|
addToRunTimeSelectionTable(thermalSource, constantThermalSource, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from dictionary
|
||||||
|
Foam::constantThermalSource::constantThermalSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalSource(name, T, dict),
|
||||||
|
S_(dict.lookup("S")),
|
||||||
|
zones_(dict.lookup("zones"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::constantThermalSource::~constantThermalSource()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::constantThermalSource::addSource(volScalarField& source) const
|
||||||
|
{
|
||||||
|
forAll(zones_, zoneI)
|
||||||
|
{
|
||||||
|
const label zoneID = mesh().cellZones().findZoneID(zones_[zoneI]);
|
||||||
|
|
||||||
|
if ( zoneID < 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"constantThermalSource::addSourcex()\n"
|
||||||
|
) << "Zone " << zones_[zoneI]
|
||||||
|
<< " specified in source " << name()
|
||||||
|
<< " does not exist"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& cells = mesh().cellZones()[zoneID];
|
||||||
|
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
source[cells[cellI]] = S_.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
constantThermalSource
|
||||||
|
|
||||||
|
Description
|
||||||
|
Constant thermal properties
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
constantThermalSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef constantThermalSource_H
|
||||||
|
#define constantThermalSource_H
|
||||||
|
|
||||||
|
#include "thermalSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class constantThermalSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class constantThermalSource
|
||||||
|
:
|
||||||
|
public thermalSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Strengh of the source
|
||||||
|
dimensionedScalar S_;
|
||||||
|
|
||||||
|
//- list of cell zones
|
||||||
|
const wordList zones_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
constantThermalSource(const constantThermalSource&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const constantThermalSource&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constant");
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
constantThermalSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~constantThermalSource();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Add source term
|
||||||
|
virtual void addSource(volScalarField& source) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalSource
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalSource.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
autoPtr<thermalSource> thermalSource::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word rheoTypeName = dict.lookup("type");
|
||||||
|
|
||||||
|
Info<< "Selecting thermal model " << rheoTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(rheoTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"thermalSource::New(\n"
|
||||||
|
" const word& name,\n"
|
||||||
|
" const volScalarField& T,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Unknown thermalSource type "
|
||||||
|
<< rheoTypeName << endl << endl
|
||||||
|
<< "Valid thermalSources are : " << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<thermalSource>(cstrIter()(name, T, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalSource
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalSource, 0);
|
||||||
|
defineRunTimeSelectionTable(thermalSource, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalSource::thermalSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
T_(T)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Rusche
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
thermalSource
|
||||||
|
|
||||||
|
Description
|
||||||
|
A thermal source.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Henrik Rusche, Wikki GmbH. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalSource.C
|
||||||
|
newThermalSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalSource_H
|
||||||
|
#define thermalSource_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name
|
||||||
|
const word name_;
|
||||||
|
|
||||||
|
//- Reference to temperature field
|
||||||
|
const volScalarField& T_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
thermalSource(const thermalSource&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const thermalSource&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return reference to mesh
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return T_.mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
thermalSource,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(name, T, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected thermal model
|
||||||
|
static autoPtr<thermalSource> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
thermalSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const volScalarField& T,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~thermalSource()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name
|
||||||
|
const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Add source term
|
||||||
|
virtual void addSource(volScalarField& source) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -12,19 +12,16 @@
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
dimensionedScalar nu
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
(
|
volScalarField p_rgh
|
||||||
transportProperties.lookup("nu")
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "Reading field p\n" << endl;
|
|
||||||
volScalarField p
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"p",
|
"p_rgh",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -48,7 +45,6 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading field T\n" << endl;
|
Info<< "Reading field T\n" << endl;
|
||||||
|
|
||||||
volScalarField T
|
volScalarField T
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
@ -64,16 +60,31 @@
|
||||||
|
|
||||||
# include "createPhi.H"
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
# include "readTransportProperties.H"
|
||||||
|
|
||||||
label pRefCell = 0;
|
label pRefCell = 0;
|
||||||
scalar pRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
setRefCell
|
||||||
|
(
|
||||||
|
p_rgh,
|
||||||
|
mesh.solutionDict().subDict("PISO"),
|
||||||
|
pRefCell,
|
||||||
|
pRefValue
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Reading field DT\n" << endl;
|
autoPtr<incompressible::RASModel> turbulence
|
||||||
volScalarField DT
|
(
|
||||||
|
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "attachPatches.H"
|
||||||
|
|
||||||
|
Info<< "Reading field kappaEff\n" << endl;
|
||||||
|
volScalarField kappaEff
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"DT",
|
"kappaEff",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -81,3 +92,21 @@
|
||||||
),
|
),
|
||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Kinematic density for buoyancy force
|
||||||
|
volScalarField rhok
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhok",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
1.0 - beta*(T - TRef)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating radiation model\n" << endl;
|
||||||
|
autoPtr<radiation::radiationModel> radiation
|
||||||
|
(
|
||||||
|
radiation::radiationModel::New(T)
|
||||||
|
);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
Info<< "Create mesh for time = "
|
Info<< "Create mesh for time = "
|
||||||
<< runTime.timeName() << nl << endl;
|
<< runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
Info << "f1" << endl;
|
|
||||||
|
|
||||||
fvMesh mesh
|
fvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
@ -13,6 +11,3 @@ Info << "f1" << endl;
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info << "f2" << endl;
|
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,15 @@
|
||||||
solidMesh
|
solidMesh
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading solid diffusivity DT\n" << endl;
|
Info<< "Reading solid thermal properties" << endl;
|
||||||
|
thermalModel solidThermo(Tsolid);
|
||||||
|
|
||||||
volScalarField DTsolid
|
Info<< "Reading solid diffusivity k\n" << endl;
|
||||||
|
volScalarField ksolid
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"DT",
|
"k",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
solidMesh,
|
solidMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -27,6 +29,17 @@
|
||||||
solidMesh
|
solidMesh
|
||||||
);
|
);
|
||||||
|
|
||||||
// On creation of both diffusivities, couple the sides
|
Info<< "Constructing rhoCp\n" << endl;
|
||||||
DT.correctBoundaryConditions();
|
volScalarField rhoCpsolid
|
||||||
DTsolid.correctBoundaryConditions();
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoCpsolid",
|
||||||
|
runTime.timeName(),
|
||||||
|
solidMesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
solidThermo.rho()*solidThermo.C()
|
||||||
|
);
|
||||||
|
rhoCpsolid.oldTime();
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
Info << "s1" << endl;
|
|
||||||
|
|
||||||
fvMesh solidMesh
|
fvMesh solidMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
@ -11,5 +9,22 @@ Info << "s1" << endl;
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info << "s2" << endl;
|
{
|
||||||
|
const polyPatchList& patches = solidMesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Attach it here
|
||||||
|
rcp.attach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
solidMesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force recalculation of weights
|
// Force recalculation of weights
|
||||||
mesh.surfaceInterpolation::movePoints();
|
mesh.surfaceInterpolation::movePoints();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// initialize values for convergence checks
|
||||||
|
|
||||||
|
scalar eqnResidual = 1, maxResidual = 0;
|
||||||
|
scalar convergenceCriterion = 0;
|
||||||
|
|
||||||
|
simple.readIfPresent("convergence", convergenceCriterion);
|
||||||
|
|
47
applications/solvers/coupled/conjugateHeatFoam/pEqn.H
Normal file
47
applications/solvers/coupled/conjugateHeatFoam/pEqn.H
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
volScalarField rUA("rUA", 1.0/UEqn.A());
|
||||||
|
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
||||||
|
|
||||||
|
U = rUA*UEqn.H();
|
||||||
|
|
||||||
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUA, U, phi);
|
||||||
|
|
||||||
|
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||||
|
phi -= buoyancyPhi;
|
||||||
|
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix p_rghEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
|
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name() + "Final"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
// Calculate the conservative fluxes
|
||||||
|
phi -= p_rghEqn.flux();
|
||||||
|
|
||||||
|
// Explicitly relax pressure for momentum corrector
|
||||||
|
p_rgh.relax();
|
||||||
|
|
||||||
|
// Correct the momentum source with the pressure gradient flux
|
||||||
|
// calculated from the relaxed pressure
|
||||||
|
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
|
// Density [kg/m^3]
|
||||||
|
dimensionedScalar rho(laminarTransport.lookup("rho"));
|
||||||
|
|
||||||
|
// Heat capacity [J/kgK]
|
||||||
|
dimensionedScalar Cp(laminarTransport.lookup("Cp"));
|
||||||
|
|
||||||
|
// Thermal expansion coefficient [1/K]
|
||||||
|
dimensionedScalar beta(laminarTransport.lookup("beta"));
|
||||||
|
|
||||||
|
// Reference temperature [K]
|
||||||
|
dimensionedScalar TRef(laminarTransport.lookup("TRef"));
|
||||||
|
|
||||||
|
// Laminar Prandtl number
|
||||||
|
dimensionedScalar Pr(laminarTransport.lookup("Pr"));
|
||||||
|
|
||||||
|
// Turbulent Prandtl number
|
||||||
|
dimensionedScalar Prt(laminarTransport.lookup("Prt"));
|
|
@ -1,7 +1,4 @@
|
||||||
{
|
{
|
||||||
// Decoupled patches
|
|
||||||
# include "attachPatches.H"
|
|
||||||
|
|
||||||
// Solid side
|
// Solid side
|
||||||
# include "readSolidControls.H"
|
# include "readSolidControls.H"
|
||||||
|
|
||||||
|
@ -9,28 +6,40 @@
|
||||||
{
|
{
|
||||||
coupledFvScalarMatrix TEqns(2);
|
coupledFvScalarMatrix TEqns(2);
|
||||||
|
|
||||||
// Add fluid equation
|
fvScalarMatrix* TFluidEqn = new fvScalarMatrix
|
||||||
TEqns.set
|
|
||||||
(
|
(
|
||||||
0,
|
rho*Cp*
|
||||||
new fvScalarMatrix
|
|
||||||
(
|
(
|
||||||
fvm::ddt(T)
|
fvm::ddt(T)
|
||||||
+ fvm::div(phi, T)
|
+ fvm::div(phi, T)
|
||||||
- fvm::laplacian(DT, T)
|
|
||||||
)
|
)
|
||||||
|
- fvm::laplacian(kappaEff, T)
|
||||||
|
==
|
||||||
|
radiation->Ru()
|
||||||
|
- fvm::Sp(4.0*radiation->Rp()*pow3(T), T)
|
||||||
|
+ 3.0*radiation->Rp()*pow4(T)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add solid equation
|
//Done automatically in 1.6.1-ext
|
||||||
TEqns.set
|
//TFluidEqn->boundaryManipulate(T.boundaryField());
|
||||||
|
|
||||||
|
fvScalarMatrix* TSolidEqn = new fvScalarMatrix
|
||||||
(
|
(
|
||||||
1,
|
fvm::ddt(rhoCpsolid, Tsolid)
|
||||||
new fvScalarMatrix
|
- fvm::laplacian(ksolidf, Tsolid, "laplacian(k,T)")
|
||||||
(
|
+ fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid)
|
||||||
fvm::ddt(Tsolid) - fvm::laplacian(DTsolid, Tsolid)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//Done automatically in 1.6.1-ext
|
||||||
|
//TSolidEqn->boundaryManipulate(Tsolid.boundaryField());
|
||||||
|
|
||||||
|
|
||||||
|
// Add fluid equation
|
||||||
|
TEqns.set(0, TFluidEqn);
|
||||||
|
|
||||||
|
// Add solid equation
|
||||||
|
TEqns.set(1, TSolidEqn);
|
||||||
|
|
||||||
TEqns.solve();
|
TEqns.solve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
{
|
|
||||||
// Detach patches
|
|
||||||
# include "detachPatches.H"
|
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
|
||||||
# include "CourantNo.H"
|
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
|
||||||
(
|
|
||||||
fvm::ddt(U)
|
|
||||||
+ fvm::div(phi, U)
|
|
||||||
- fvm::laplacian(nu, U)
|
|
||||||
);
|
|
||||||
|
|
||||||
solve(UEqn == -fvc::grad(p));
|
|
||||||
|
|
||||||
// --- PISO loop
|
|
||||||
|
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
|
||||||
{
|
|
||||||
U = UEqn.H()/UEqn.A();
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
phi = fvc::interpolate(U) & mesh.Sf();
|
|
||||||
|
|
||||||
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
|
|
||||||
{
|
|
||||||
fvScalarMatrix pEqn
|
|
||||||
(
|
|
||||||
fvm::laplacian(1.0/UEqn.A(), p) == fvc::div(phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
|
||||||
pEqn.solve();
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
|
||||||
{
|
|
||||||
phi -= pEqn.flux();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# include "continuityErrs.H"
|
|
||||||
|
|
||||||
U -= fvc::grad(p)/UEqn.A();
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
conjugateHeatSimpleFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/conjugateHeatSimpleFoam
|
|
@ -0,0 +1,22 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I../conjugateHeatFoam/conjugateHeatTransfer/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
|
-I$(LIB_SRC)/coupledMatrix/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lincompressibleTurbulenceModel \
|
||||||
|
-lincompressibleRASModels \
|
||||||
|
-lincompressibleTransportModels \
|
||||||
|
-lcoupledLduMatrix \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lradiation \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lconjugateHeatTransfer
|
27
applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H
Normal file
27
applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Solve the momentum equation
|
||||||
|
|
||||||
|
tmp<fvVectorMatrix> UEqn
|
||||||
|
(
|
||||||
|
fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevReff(U)
|
||||||
|
+ fvm::SuSp(-fvc::div(phi), U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn().relax();
|
||||||
|
|
||||||
|
eqnResidual = solve
|
||||||
|
(
|
||||||
|
UEqn()
|
||||||
|
==
|
||||||
|
fvc::reconstruct
|
||||||
|
(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rhok)
|
||||||
|
- fvc::snGrad(p_rgh)
|
||||||
|
)*mesh.magSf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).initialResidual();
|
||||||
|
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
const polyPatchList& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Attach it here
|
||||||
|
rcp.attach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
mesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2008-2011 H. Jasak & H. Rusche
|
||||||
|
\\/ M anipulation | All rights reserved
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Application
|
||||||
|
conjugateHeatSimpleFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Steady-State solver for buoyancy-driven turbulent flow of incompressible
|
||||||
|
Newtonian fluids with conjugate heat transfer, complex heat conduction
|
||||||
|
and radiation
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "coupledFvMatrices.H"
|
||||||
|
#include "regionCouplePolyPatch.H"
|
||||||
|
#include "radiationModel.H"
|
||||||
|
#include "thermalModel.H"
|
||||||
|
#include "singlePhaseTransportModel.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createFluidMesh.H"
|
||||||
|
# include "createSolidMesh.H"
|
||||||
|
# include "readGravitationalAcceleration.H"
|
||||||
|
# include "createFields.H"
|
||||||
|
# include "createSolidFields.H"
|
||||||
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
# include "readSIMPLEControls.H"
|
||||||
|
# include "initConvergenceCheck.H"
|
||||||
|
|
||||||
|
// Detach patches
|
||||||
|
# include "detachPatches.H"
|
||||||
|
|
||||||
|
p_rgh.storePrevIter();
|
||||||
|
|
||||||
|
# include "UEqn.H"
|
||||||
|
# include "pEqn.H"
|
||||||
|
|
||||||
|
// Update turbulent quantities
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
radiation->correct();
|
||||||
|
|
||||||
|
// Update thermal conductivity in the fluid
|
||||||
|
kappaEff = rho*Cp*(turbulence->nu()/Pr + turbulence->nut()/Prt);
|
||||||
|
|
||||||
|
// Update thermal conductivity in the solid
|
||||||
|
solidThermo.correct();
|
||||||
|
ksolid = solidThermo.k();
|
||||||
|
|
||||||
|
// Coupled patches
|
||||||
|
# include "attachPatches.H"
|
||||||
|
|
||||||
|
kappaEff.correctBoundaryConditions();
|
||||||
|
ksolid.correctBoundaryConditions();
|
||||||
|
|
||||||
|
// Interpolate to the faces and add thermal resistance
|
||||||
|
surfaceScalarField ksolidf = fvc::interpolate(ksolid);
|
||||||
|
solidThermo.modifyResistance(ksolidf);
|
||||||
|
|
||||||
|
# include "solveEnergy.H"
|
||||||
|
|
||||||
|
// Update density according to Boussinesq approximation
|
||||||
|
rhok = 1.0 - beta*(T - TRef);
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = "
|
||||||
|
<< runTime.elapsedCpuTime()
|
||||||
|
<< " s\n\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,112 @@
|
||||||
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
|
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
|
volScalarField p_rgh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p_rgh",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field T\n" << endl;
|
||||||
|
volScalarField T
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"T",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
# include "readTransportProperties.H"
|
||||||
|
|
||||||
|
label pRefCell = 0;
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
|
setRefCell
|
||||||
|
(
|
||||||
|
p_rgh,
|
||||||
|
mesh.solutionDict().subDict("SIMPLE"),
|
||||||
|
pRefCell,
|
||||||
|
pRefValue
|
||||||
|
);
|
||||||
|
|
||||||
|
autoPtr<incompressible::RASModel> turbulence
|
||||||
|
(
|
||||||
|
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "attachPatches.H"
|
||||||
|
|
||||||
|
Info<< "Reading field kappaEff\n" << endl;
|
||||||
|
volScalarField kappaEff
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"kappaEff",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Kinematic density for buoyancy force
|
||||||
|
volScalarField rhok
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhok",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
1.0 - beta*(T - TRef)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating radiation model\n" << endl;
|
||||||
|
autoPtr<radiation::radiationModel> radiation
|
||||||
|
(
|
||||||
|
radiation::radiationModel::New(T)
|
||||||
|
);
|
|
@ -0,0 +1,13 @@
|
||||||
|
Info<< "Create mesh for time = "
|
||||||
|
<< runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
fvMesh mesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fvMesh::defaultRegion,
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
|
@ -0,0 +1,30 @@
|
||||||
|
Info<< "Reading field Tsolid\n" << endl;
|
||||||
|
volScalarField Tsolid
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"T",
|
||||||
|
runTime.timeName(),
|
||||||
|
solidMesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
solidMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading solid thermal properties" << endl;
|
||||||
|
thermalModel solidThermo(Tsolid);
|
||||||
|
|
||||||
|
Info<< "Reading solid diffusivity k\n" << endl;
|
||||||
|
volScalarField ksolid
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"k",
|
||||||
|
runTime.timeName(),
|
||||||
|
solidMesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
solidMesh
|
||||||
|
);
|
|
@ -0,0 +1,30 @@
|
||||||
|
fvMesh solidMesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"solid",
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
{
|
||||||
|
const polyPatchList& patches = solidMesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Attach it here
|
||||||
|
rcp.attach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
solidMesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
const polyPatchList& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Detach it here
|
||||||
|
rcp.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
mesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
const polyPatchList& patches = solidMesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll (patches, patchI)
|
||||||
|
{
|
||||||
|
if (isType<regionCouplePolyPatch>(patches[patchI]))
|
||||||
|
{
|
||||||
|
const regionCouplePolyPatch& rcp =
|
||||||
|
refCast<const regionCouplePolyPatch>(patches[patchI]);
|
||||||
|
|
||||||
|
// Detach it here
|
||||||
|
rcp.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of weights
|
||||||
|
solidMesh.surfaceInterpolation::movePoints();
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,7 @@
|
||||||
|
// initialize values for convergence checks
|
||||||
|
|
||||||
|
scalar eqnResidual = 1, maxResidual = 0;
|
||||||
|
scalar convergenceCriterion = 0;
|
||||||
|
|
||||||
|
simple.readIfPresent("convergence", convergenceCriterion);
|
||||||
|
|
50
applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H
Normal file
50
applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
volScalarField rUA("rUA", 1.0/UEqn().A());
|
||||||
|
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
||||||
|
|
||||||
|
U = rUA*UEqn().H();
|
||||||
|
UEqn.clear();
|
||||||
|
|
||||||
|
phi = fvc::interpolate(U) & mesh.Sf();
|
||||||
|
adjustPhi(phi, U, p_rgh);
|
||||||
|
|
||||||
|
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||||
|
phi -= buoyancyPhi;
|
||||||
|
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix p_rghEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
|
// retain the residual from the first iteration
|
||||||
|
if (nonOrth == 0)
|
||||||
|
{
|
||||||
|
eqnResidual = p_rghEqn.solve().initialResidual();
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_rghEqn.solve();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
// Calculate the conservative fluxes
|
||||||
|
phi -= p_rghEqn.flux();
|
||||||
|
|
||||||
|
// Explicitly relax pressure for momentum corrector
|
||||||
|
p_rgh.relax();
|
||||||
|
|
||||||
|
// Correct the momentum source with the pressure gradient flux
|
||||||
|
// calculated from the relaxed pressure
|
||||||
|
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
const dictionary& simple = solidMesh.solutionDict().subDict("SIMPLE");
|
||||||
|
|
||||||
|
int nNonOrthCorr = 0;
|
||||||
|
if (simple.found("nNonOrthogonalCorrectors"))
|
||||||
|
{
|
||||||
|
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
|
// Density [kg/m^3]
|
||||||
|
dimensionedScalar rho(laminarTransport.lookup("rho"));
|
||||||
|
|
||||||
|
// Heat capacity [J/kgK]
|
||||||
|
dimensionedScalar Cp(laminarTransport.lookup("Cp"));
|
||||||
|
|
||||||
|
// Thermal expansion coefficient [1/K]
|
||||||
|
dimensionedScalar beta(laminarTransport.lookup("beta"));
|
||||||
|
|
||||||
|
// Reference temperature [K]
|
||||||
|
dimensionedScalar TRef(laminarTransport.lookup("TRef"));
|
||||||
|
|
||||||
|
// Laminar Prandtl number
|
||||||
|
dimensionedScalar Pr(laminarTransport.lookup("Pr"));
|
||||||
|
|
||||||
|
// Turbulent Prandtl number
|
||||||
|
dimensionedScalar Prt(laminarTransport.lookup("Prt"));
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue