Commit 1bd6b1bb authored by sergio's avatar sergio
Browse files

ENH: Adding isotropic flag to solidThermo for transport.

Modified chtMultiRegionFoam and chtMultiRegionSimpleFoam to work with
anisotropic heat transfer conductivity
parent 464756f8
......@@ -40,13 +40,14 @@ Description
#include "rhoThermo.H"
#include "turbulenceModel.H"
#include "fixedGradientFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "regionProperties.H"
#include "compressibleCourantNo.H"
#include "solidRegionDiffNo.H"
#include "solidThermo.H"
#include "radiationModel.H"
#include "fvIOoptionList.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -37,6 +37,7 @@ Description
#include "solidThermo.H"
#include "radiationModel.H"
#include "fvIOoptionList.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -3,7 +3,9 @@
{
fvScalarMatrix hEqn
(
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
thermo.isotropic()
? -fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
: -fvm::laplacian(betav*tAnialpha(), h, "laplacian(alpha,h)")
+ fvOptions(rho, h)
);
......
// Initialise solid field pointer lists
PtrList<coordinateSystem> coordinates(solidRegions.size());
PtrList<solidThermo> thermos(solidRegions.size());
PtrList<radiation::radiationModel> radiations(solidRegions.size());
PtrList<fv::IOoptionList> solidHeatSources(solidRegions.size());
......@@ -23,6 +24,16 @@
new fv::IOoptionList(solidRegions[i])
);
if (!thermos[i].isotropic())
{
Info<< " Adding coordinateSystems\n" << endl;
coordinates.set
(
i,
coordinateSystem::New(solidRegions[i], thermos[i])
);
}
IOobject betavSolidIO
(
"betavSolid",
......
......@@ -8,10 +8,36 @@
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> talpha = thermo.alpha();
const volScalarField& alpha = talpha();
tmp<volScalarField> tkappa = thermo.kappa();
const volScalarField& kappa = tkappa();
tmp<volSymmTensorField> tAnialpha;
if (!thermo.isotropic())
{
tmp<volVectorField> tkappaCp = thermo.Kappa()/cp;
const coordinateSystem& coodSys = coordinates[i];
tAnialpha =
tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"Anialpha",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
tkappaCp().dimensions(),
zeroGradientFvPatchVectorField::typeName
)
);
volSymmTensorField& Anialpha = tAnialpha();
Anialpha.internalField() = coodSys.R().transformVector(tkappaCp());
Anialpha.correctBoundaryConditions();
}
volScalarField& h = thermo.he();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,38 +56,4 @@ Foam::scalar Foam::solidRegionDiffNo
return DiNum;
}
Foam::scalar Foam::solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& kappadirectional
)
{
scalar DiNum = 0.0;
scalar meanDiNum = 0.0;
volScalarField kappa(mag(kappadirectional));
//- Take care: can have fluid domains with 0 cells so do not test for
// zero internal faces.
surfaceScalarField kapparhoCpbyDelta
(
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(kappa)
/ fvc::interpolate(Cprho)
);
DiNum = gMax(kapparhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(kapparhoCpbyDelta)).value()*runTime.deltaT().value();
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
<< " max: " << DiNum << endl;
return DiNum;
}
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -41,15 +41,6 @@ namespace Foam
const volScalarField& Cprho,
const volScalarField& kappa
);
scalar solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& kappa
);
}
#endif
......
scalar DiNum = -GREAT;
scalar DiNum = -GREAT;
forAll(solidRegions, i)
forAll(solidRegions, i)
{
#include "setRegionSolidFields.H"
tmp<volScalarField> magKappa;
if (thermo.isotropic())
{
magKappa = thermo.kappa();
}
else
{
#include "setRegionSolidFields.H"
magKappa = mag(thermo.Kappa());
}
DiNum = max
DiNum = max
(
solidRegionDiffNo
(
solidRegionDiffNo
(
solidRegions[i],
runTime,
rho*cp,
kappa
),
DiNum
);
}
solidRegions[i],
runTime,
rho*cp,
magKappa()
),
DiNum
);
}
......@@ -9,7 +9,11 @@ if (finalIter)
tmp<fvScalarMatrix> hEqn
(
fvm::ddt(betav*rho, h)
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
- (
thermo.isotropic()
? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
: fvm::laplacian(betav*tAnialpha(), h, "laplacian(alpha,h)")
)
==
fvOptions(rho, h)
);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -111,6 +111,9 @@ public:
return "constAnIso<" + Thermo::typeName() + '>';
}
//- Is the thermal conductivity isotropic
static const bool isotropic = false;
//- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar p, const scalar T) const;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -112,6 +112,9 @@ public:
return "constIso<" + Thermo::typeName() + '>';
}
//- Is the thermal conductivity isotropic
static const bool isotropic = true;
//- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar p, const scalar T) const;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -121,6 +121,9 @@ public:
return "exponential<" + Thermo::typeName() + '>';
}
//- Is the thermal conductivity isotropic
static const bool isotropic = true;
//- Thermal conductivity [W/mK]
inline scalar kappa(const scalar p, const scalar T) const;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -99,6 +99,12 @@ public:
//- Anisotropic thermal conductivity [W/m/K]
virtual tmp<volVectorField> Kappa() const;
//- Return true if thermal conductivity is isotropic
virtual bool isotropic() const
{
return MixtureType::thermoType::isotropic;
}
// Per patch calculation
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -144,6 +144,9 @@ public:
//- Thermal conductivity [W/m/K]
virtual tmp<volVectorField> Kappa() const = 0;
//- Return true if thermal conductivity is isotropic
virtual bool isotropic() const = 0;
// Per patch calculation
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment