From 02703cf065be8669a48bad3ca10062e50c6fa041 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 6 Jun 2013 12:30:45 +0100 Subject: [PATCH 01/22] ENH: Removed unused #include files --- .../standardPhaseChange/standardPhaseChange.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C index 4a08755ee3..8b0a0c5f16 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C @@ -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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,8 +26,6 @@ License #include "standardPhaseChange.H" #include "addToRunTimeSelectionTable.H" #include "thermoSingleLayer.H" -#include "specie.H" -#include "heatTransferModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 8af8a6eecc1d5a0b37908d00cba0111dead10da1 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 6 Jun 2013 12:31:17 +0100 Subject: [PATCH 02/22] ENH: Upadted model variable names to use : syntax --- .../submodels/kinematic/filmTurbulenceModel/laminar/laminar.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C index 108109702b..bc4bf5ee88 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C @@ -76,7 +76,7 @@ tmp laminar::Us() const ( IOobject ( - typeName + ".Us", + typeName + ":Us", owner_.regionMesh().time().timeName(), owner_.regionMesh(), IOobject::NO_READ, @@ -104,7 +104,7 @@ tmp laminar::mut() const ( IOobject ( - typeName + ".mut", + typeName + ":mut", owner_.regionMesh().time().timeName(), owner_.regionMesh(), IOobject::NO_READ, From 0b6b2b0f53ad9a811e9a1d9eceeb65fa46522975 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jun 2013 12:13:49 +0100 Subject: [PATCH 03/22] STYLE: polyMeshTools: unused code --- .../polyMesh/polyMeshCheck/polyMeshTools.H | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H index 7f23facd04..ef500b4b8b 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H @@ -63,16 +63,6 @@ public: const vectorField& cellCtrs ); -// static tmp faceOrthogonality(const polyMesh& mesh) -// { -// return faceOrthogonality -// ( -// mesh, -// mesh.faceAreas(), -// mesh.cellCentres() -// ); -// } - //- Generate skewness field static tmp faceSkewness ( @@ -83,18 +73,6 @@ public: const vectorField& cellCtrs ); -// static tmp faceSkewness(const polyMesh& mesh) -// { -// return faceSkewness -// ( -// mesh, -// mesh.points(), -// mesh.faceCentres(), -// mesh.faceAreas(), -// mesh.cellCentres() -// ); -// } - //- Generate interpolation factors field static tmp faceWeights ( From fb1a7764ade96115d8062f6dd7862b71e7fb00d9 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Fri, 7 Jun 2013 12:22:50 +0100 Subject: [PATCH 04/22] ENH: Adding polynomial transport and thermo for solids --- .../include/solidThermoPhysicsTypes.H | 28 +- .../polynomial/polynomialSolidTransport.C | 110 +++++++ .../polynomial/polynomialSolidTransport.H | 237 ++++++++++++++ .../polynomial/polynomialSolidTransportI.H | 289 ++++++++++++++++++ .../solidThermo/solidThermo/makeSolidThermo.H | 52 ++++ .../solidThermo/solidThermo/solidThermos.C | 13 +- 6 files changed, 723 insertions(+), 6 deletions(-) create mode 100644 src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.C create mode 100644 src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H create mode 100644 src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H diff --git a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H index c1269e8000..7ecbb075eb 100644 --- a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H +++ b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,13 +35,17 @@ Description #include "specie.H" #include "rhoConst.H" #include "hConstThermo.H" +#include "hPolynomialThermo.H" #include "hExponentialThermo.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" +#include "polynomialSolidTransport.H" + #include "sensibleEnthalpy.H" #include "thermo.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -57,8 +61,7 @@ namespace Foam >, sensibleEnthalpy > - > - hConstSolidThermoPhysics; + > hConstSolidThermoPhysics; typedef exponentialSolidTransport @@ -71,8 +74,23 @@ namespace Foam >, sensibleEnthalpy > - > - hExponentialSolidThermoPhysics; + > hExponentialSolidThermoPhysics; + + + typedef + polynomialSolidTransport + < + species::thermo + < + hPolynomialThermo + < + rhoConst, + 8 + >, + sensibleEnthalpy + >, + 8 + > hTransportThermoPoly8SolidThermoPhysics; } diff --git a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.C b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.C new file mode 100644 index 0000000000..7bddd6d822 --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "polynomialSolidTransport.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::polynomialSolidTransport::polynomialSolidTransport +( + Istream& is +) +: + Thermo(is), + kappaCoeffs_("kappaCoeffs<" + Foam::name(PolySize) + '>', is) +{ +} + + +template +Foam::polynomialSolidTransport::polynomialSolidTransport +( + const dictionary& dict +) +: + Thermo(dict), + kappaCoeffs_ + ( + dict.subDict("transport").lookup + ( + "kappaCoeffs<" + Foam::name(PolySize) + '>' + ) + ) +{ +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::polynomialSolidTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + + Thermo::write(os); + + dictionary dict("transport"); + + dict.add + ( + word("kappaCoeffs<" + Foam::name(PolySize) + '>'), + kappaCoeffs_ + ); + os << indent << dict.dictName() << dict; + + os << decrIndent << token::END_BLOCK << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const polynomialSolidTransport& pt +) +{ + os << static_cast(pt) << tab + << "kappaCoeffs<" << Foam::name(PolySize) << '>' << tab + << pt.kappaCoeffs_; + + os.check + ( + "Ostream& operator<<" + "(" + "Ostream&, " + "const polynomialSolidTransport&" + ")" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H new file mode 100644 index 0000000000..90a9e52f6a --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H @@ -0,0 +1,237 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::polynomialSolidTransport + +Description + Transport package using polynomial functions for solid kappa + +SourceFiles + polynomialSolidTransportI.H + polynomialSolidTransport.C + +\*---------------------------------------------------------------------------*/ + +#ifndef polynomialSolidTransport_H +#define polynomialSolidTransport_H + +#include "Polynomial.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template class polynomialSolidTransport; + +template +inline polynomialSolidTransport operator+ +( + const polynomialSolidTransport&, + const polynomialSolidTransport& +); + +template +inline polynomialSolidTransport operator- +( + const polynomialSolidTransport&, + const polynomialSolidTransport& +); + +template +inline polynomialSolidTransport operator* +( + const scalar, + const polynomialSolidTransport& +); + +template +inline polynomialSolidTransport operator== +( + const polynomialSolidTransport&, + const polynomialSolidTransport& +); + +template +Ostream& operator<< +( + Ostream&, + const polynomialSolidTransport& +); + + +/*---------------------------------------------------------------------------*\ + Class polynomialSolidTransport Declaration +\*---------------------------------------------------------------------------*/ + +template +class polynomialSolidTransport +: + public Thermo +{ + // Private data + + //- Thermal conductivity polynomial coefficients + // Note: input in [W/m/K] + Polynomial kappaCoeffs_; + + + // Private Member Functions + + //- Construct from components + inline polynomialSolidTransport + ( + const Thermo& t, + const Polynomial& kappaPoly + ); + + +public: + + // Constructors + + //- Construct copy + inline polynomialSolidTransport(const polynomialSolidTransport&); + + //- Construct as named copy + inline polynomialSolidTransport + ( + const word&, + const polynomialSolidTransport& + ); + + //- Construct from Istream + polynomialSolidTransport(Istream& is); + + //- Construct from dictionary + polynomialSolidTransport(const dictionary& dict); + + //- Construct and return a clone + inline autoPtr clone() const; + + // Selector from Istream + inline static autoPtr New(Istream& is); + + // Selector from dictionary + inline static autoPtr New + ( + const dictionary&dict + ); + + + // Member functions + + //- Return the instantiated type name + static word typeName() + { + return "polynomial<" + Thermo::typeName() + '>'; + } + + //- Is the thermal conductivity isotropic + static const bool isotropic = true; + + //- Dynamic viscosity [kg/ms] + inline scalar mu(const scalar p, const scalar T) const; + + //- Thermal conductivity [W/mK] + inline scalar kappa(const scalar p, const scalar T) const; + + //- Thermal conductivity [W/mK] + inline vector Kappa(const scalar p, const scalar T) const; + + //- Thermal diffusivity of enthalpy [kg/ms] + inline scalar alphah(const scalar p, const scalar T) const; + + + //- Write to Ostream + void write(Ostream& os) const; + + + // Member operators + + inline polynomialSolidTransport& operator= + ( + const polynomialSolidTransport& + ); + inline void operator+=(const polynomialSolidTransport&); + inline void operator-=(const polynomialSolidTransport&); + inline void operator*=(const scalar); + + + // Friend operators + + friend polynomialSolidTransport operator+ + ( + const polynomialSolidTransport&, + const polynomialSolidTransport& + ); + + friend polynomialSolidTransport operator- + ( + const polynomialSolidTransport&, + const polynomialSolidTransport& + ); + + friend polynomialSolidTransport operator* + ( + const scalar, + const polynomialSolidTransport& + ); + + friend polynomialSolidTransport operator== + ( + const polynomialSolidTransport&, + const polynomialSolidTransport& + ); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const polynomialSolidTransport& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "polynomialSolidTransportI.H" + +#ifdef NoRepository +# include "polynomialSolidTransport.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H new file mode 100644 index 0000000000..51dda6ba57 --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H @@ -0,0 +1,289 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "specie.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::polynomialSolidTransport:: +polynomialSolidTransport +( + const polynomialSolidTransport& pt +) +: + Thermo(pt), + kappaCoeffs_(pt.kappaCoeffs_) +{} + + +template +inline Foam::polynomialSolidTransport:: +polynomialSolidTransport +( + const Thermo& t, + const Polynomial& kappaCoeffs +) +: + Thermo(t), + kappaCoeffs_(kappaCoeffs) +{} + + +template +inline Foam::polynomialSolidTransport:: +polynomialSolidTransport +( + const word& name, + const polynomialSolidTransport& pt +) +: + Thermo(name, pt), + kappaCoeffs_(pt.kappaCoeffs_) +{} + + +template +inline Foam::autoPtr > +Foam::polynomialSolidTransport::clone() const +{ + return autoPtr > + ( + new polynomialSolidTransport(*this) + ); +} + + +template +inline Foam::autoPtr > +Foam::polynomialSolidTransport::New(Istream& is) +{ + return autoPtr > + ( + new polynomialSolidTransport(is) + ); +} + + +template +inline Foam::autoPtr > +Foam::polynomialSolidTransport::New(const dictionary& dict) +{ + return autoPtr > + ( + new polynomialSolidTransport(dict) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::polynomialSolidTransport::mu +( + const scalar p, + const scalar T +) const +{ + notImplemented + ( + "Foam::scalar Foam::polynomialSolidTransportmu::" + "(" + " const scalar p, const scalar T" + ") const" + ); + return scalar(0); +} + + +template +inline Foam::scalar Foam::polynomialSolidTransport::kappa +( + const scalar p, + const scalar T +) const +{ + return kappaCoeffs_.value(T); +} + + +template +inline Foam::vector Foam::polynomialSolidTransport::Kappa +( + const scalar p, + const scalar T +) const +{ + const scalar kappa(kappaCoeffs_.value(T)); + return vector(kappa, kappa, kappa); +} + + +template +inline Foam::scalar Foam::polynomialSolidTransport::alphah +( + const scalar p, const scalar T +) const +{ + return kappa(p, T)/this->Cpv(p, T); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +inline Foam::polynomialSolidTransport& +Foam::polynomialSolidTransport::operator= +( + const polynomialSolidTransport& pt +) +{ + Thermo::operator=(pt); + + kappaCoeffs_ = pt.kappaCoeffs_; + + return *this; +} + + +template +inline void Foam::polynomialSolidTransport::operator+= +( + const polynomialSolidTransport& pt +) +{ + scalar molr1 = this->nMoles(); + + Thermo::operator+=(pt); + + molr1 /= this->nMoles(); + scalar molr2 = pt.nMoles()/this->nMoles(); + + kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_; +} + + +template +inline void Foam::polynomialSolidTransport::operator-= +( + const polynomialSolidTransport& pt +) +{ + scalar molr1 = this->nMoles(); + + Thermo::operator-=(pt); + + molr1 /= this->nMoles(); + scalar molr2 = pt.nMoles()/this->nMoles(); + + kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_; +} + + +template +inline void Foam::polynomialSolidTransport::operator*= +( + const scalar s +) +{ + Thermo::operator*=(s); +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +template +inline Foam::polynomialSolidTransport Foam::operator+ +( + const polynomialSolidTransport& pt1, + const polynomialSolidTransport& pt2 +) +{ + Thermo t + ( + static_cast(pt1) + static_cast(pt2) + ); + + scalar molr1 = pt1.nMoles()/t.nMoles(); + scalar molr2 = pt2.nMoles()/t.nMoles(); + + return polynomialSolidTransport + ( + t, + molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_ + ); +} + + +template +inline Foam::polynomialSolidTransport Foam::operator- +( + const polynomialSolidTransport& pt1, + const polynomialSolidTransport& pt2 +) +{ + Thermo t + ( + static_cast(pt1) - static_cast(pt2) + ); + + scalar molr1 = pt1.nMoles()/t.nMoles(); + scalar molr2 = pt2.nMoles()/t.nMoles(); + + return polynomialSolidTransport + ( + t, + molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_ + ); +} + + +template +inline Foam::polynomialSolidTransport Foam::operator* +( + const scalar s, + const polynomialSolidTransport& pt +) +{ + return polynomialSolidTransport + ( + s*static_cast(pt), + pt.kappaCoeffs_ + ); +} + + +template +inline Foam::polynomialSolidTransport Foam::operator== +( + const polynomialSolidTransport& pt1, + const polynomialSolidTransport& pt2 +) +{ + return pt2 - pt1; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H index 85000a3c10..5193a4b9de 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H @@ -103,6 +103,58 @@ addToRunTimeSelectionTable \ ); + +#define makeSolidThermoPhysicsType(BaseThermo,Cthermo,Mixture,SolidPhysicsType)\ + \ + \ + \ +typedef \ + heThermo \ + < \ + BaseThermo, \ + Mixture \ + > heThermo##Mixture##SolidPhysicsType; \ + \ +typedef \ + Cthermo \ + < \ + BaseThermo, \ + Mixture \ + > Cthermo##Mixture##SolidPhysicsType; \ + \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + Cthermo##Mixture##SolidPhysicsType, \ + ( \ + #Cthermo"<"#Mixture"<" \ + + SolidPhysicsType::typeName() \ + + ">>" \ + ).c_str(), \ + 0 \ +); \ + \ + \ +addToRunTimeSelectionTable \ +( \ + basicThermo, \ + Cthermo##Mixture##SolidPhysicsType, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + BaseThermo, \ + Cthermo##Mixture##SolidPhysicsType, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + BaseThermo, \ + Cthermo##Mixture##SolidPhysicsType, \ + dictionary \ +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index 6814431fec..020dbfda92 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,14 +31,17 @@ License #include "rhoConst.H" #include "hConstThermo.H" #include "hExponentialThermo.H" +#include "hPolynomialThermo.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" +#include "polynomialSolidTransport.H" #include "pureMixture.H" #include "sensibleEnthalpy.H" #include "sensibleInternalEnergy.H" #include "thermo.H" +#include "solidThermoPhysicsTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -83,6 +86,14 @@ makeSolidThermo specie ); +makeSolidThermoPhysicsType +( + solidThermo, + heSolidThermo, + pureMixture, + hTransportThermoPoly8SolidThermoPhysics +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam From 010a01e536e6c6fc94bccd240e2850b5facdacea Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Fri, 7 Jun 2013 12:25:34 +0100 Subject: [PATCH 05/22] BUG: Correcting Cp to Cpv to handle inernal energy or enthalpy depending on the thermo --- .../specie/transport/const/constTransportI.H | 2 +- .../specie/transport/polynomial/polynomialTransportI.H | 4 ++-- .../specie/transport/sutherland/sutherlandTransportI.H | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/thermophysicalModels/specie/transport/const/constTransportI.H b/src/thermophysicalModels/specie/transport/const/constTransportI.H index 98ce21d97e..9949fddae4 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransportI.H +++ b/src/thermophysicalModels/specie/transport/const/constTransportI.H @@ -111,7 +111,7 @@ inline Foam::scalar Foam::constTransport::kappa const scalar T ) const { - return this->Cp(p, T)*mu(p, T)*rPr_; + return this->Cpv(p, T)*mu(p, T)*rPr_; } diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H index a2ff3f4d22..9a5ad80d5e 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,7 +129,7 @@ inline Foam::scalar Foam::polynomialTransport::alphah const scalar p, const scalar T ) const { - return kappa(p, T)/this->Cp(p, T); + return kappa(p, T)/this->Cpv(p, T); } diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H index 7a0845cfb5..01668dda17 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H @@ -158,7 +158,7 @@ inline Foam::scalar Foam::sutherlandTransport::alphah ) const { - return kappa(p, T)/this->Cp(p, T); + return kappa(p, T)/this->Cpv(p, T); } From 25ace9a507161325025d80a4532c2ef3487e7ae2 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Fri, 7 Jun 2013 12:44:05 +0100 Subject: [PATCH 06/22] ENH: Clipping htcs and htcw of the film to near zero where there is not film. This avoid heat transfer in regions where the surface is dry --- .../thermoSingleLayer/thermoSingleLayer.C | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 42d459ce01..03d1654fda 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -294,10 +294,20 @@ tmp thermoSingleLayer::q(volScalarField& hs) const { dimensionedScalar Tstd("Tstd", dimTemperature, 298.15); + volScalarField htcst = htcs_->h()(); + volScalarField htcwt = htcw_->h()(); + forAll(alpha_, i) + { + htcst[i] *= max(alpha_[i], ROOTVSMALL); + htcwt[i] *= max(alpha_[i], ROOTVSMALL); + } + htcst.correctBoundaryConditions(); + htcwt.correctBoundaryConditions(); + return ( - - fvm::Sp(htcs_->h()/Cp_, hs) - htcs_->h()*(Tstd - TPrimary_) - - fvm::Sp(htcw_->h()/Cp_, hs) - htcw_->h()*(Tstd - Tw_) + - fvm::Sp(htcst/Cp_, hs) - htcst*(Tstd - TPrimary_) + - fvm::Sp(htcwt/Cp_, hs) -htcwt*(Tstd - Tw_) ); } From 745ca39fbe30e04dc873bcc0a8ddffb3ba7a8685 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jun 2013 14:35:24 +0100 Subject: [PATCH 07/22] ENH: scalarField: added unit conversions on fields --- src/OpenFOAM/fields/Fields/scalarField/scalarField.C | 8 +++++++- src/OpenFOAM/fields/Fields/scalarField/scalarField.H | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C index 96e41d9571..7ae37531de 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C @@ -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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ Description \*---------------------------------------------------------------------------*/ #include "scalarField.H" +#include "unitConversion.H" #define TEMPLATE #include "FieldFunctionsM.C" @@ -155,6 +156,11 @@ UNARY_FUNCTION(scalar, scalar, j1) UNARY_FUNCTION(scalar, scalar, y0) UNARY_FUNCTION(scalar, scalar, y1) +UNARY_FUNCTION(scalar, scalar, degToRad) +UNARY_FUNCTION(scalar, scalar, radToDeg) +UNARY_FUNCTION(scalar, scalar, atmToPa) +UNARY_FUNCTION(scalar, scalar, paToAtm) + #define BesselFunc(func) \ void func(scalarField& res, const int n, const UList& sf) \ diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H index ff322d3fe4..f30938e9b6 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,6 +130,10 @@ UNARY_FUNCTION(scalar, scalar, j1) UNARY_FUNCTION(scalar, scalar, y0) UNARY_FUNCTION(scalar, scalar, y1) +UNARY_FUNCTION(scalar, scalar, degToRad) +UNARY_FUNCTION(scalar, scalar, radToDeg) +UNARY_FUNCTION(scalar, scalar, atmToPa) +UNARY_FUNCTION(scalar, scalar, paToAtm) #define BesselFunc(func) \ void func(scalarField& Res, const int n, const UList& sf); \ From 6e857fc8dcfa4e33eb0a6ec114ef0d8c3e0b2231 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jun 2013 14:36:04 +0100 Subject: [PATCH 08/22] ENH: treDataPrimitivePatch: added self intersection operator --- .../indexedOctree/treeDataPrimitivePatch.C | 55 +++++++++++++++++++ .../indexedOctree/treeDataPrimitivePatch.H | 34 ++++++++++-- 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C index 488104a345..7f2c7f9327 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C @@ -187,6 +187,19 @@ Foam::treeDataPrimitivePatch::findAllIntersectOp::findAllIntersectOp {} +template +Foam::treeDataPrimitivePatch:: +findSelfIntersectOp::findSelfIntersectOp +( + const indexedOctree >& tree, + const label edgeID +) +: + tree_(tree), + edgeID_(edgeID) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -645,4 +658,46 @@ bool Foam::treeDataPrimitivePatch::findAllIntersectOp::operator() } +template +bool Foam::treeDataPrimitivePatch::findSelfIntersectOp::operator() +( + const label index, + const point& start, + const point& end, + point& intersectionPoint +) const +{ + if (edgeID_ == -1) + { + FatalErrorIn + ( + "findSelfIntersectOp::operator()\n" + "(\n" + " const label index,\n" + " const point& start,\n" + " const point& end,\n" + " point& intersectionPoint\n" + ") const" + ) << "EdgeID not set. Please set edgeID to the index of" + << " the edge you are testing" + << exit(FatalError); + } + + const treeDataPrimitivePatch& shape = tree_.shapes(); + const PatchType& patch = shape.patch(); + + const typename PatchType::FaceType& f = patch.localFaces()[index]; + const edge& e = patch.edges()[edgeID_]; + + if (findIndex(f, e[0]) == -1 && findIndex(f, e[1]) == -1) + { + return findIntersection(tree_, index, start, end, intersectionPoint); + } + else + { + return false; + } +} + + // ************************************************************************* // diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.H b/src/meshTools/indexedOctree/treeDataPrimitivePatch.H index 9d43d2ba85..6cce11c796 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.H +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.H @@ -141,8 +141,8 @@ public: findIntersectOp(const indexedOctree& tree); - //- Calculate intersection of triangle with ray. Sets result - // accordingly + //- Calculate intersection of any face with ray. Sets result + // accordingly. Used to find first intersection. bool operator() ( const label index, @@ -167,8 +167,34 @@ public: DynamicList