From 1876f95e2a238c7af73dc8284f148f45bb401fe7 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 24 Sep 2014 13:28:56 +0100 Subject: [PATCH 1/6] ENH: Surface film modelling - updated thixotropic viscosity model --- .../thixotropicViscosity.C | 42 +++++++++++-------- .../thixotropicViscosity.H | 28 ++----------- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C index 5847ce12..3817aeeb 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C @@ -91,12 +91,12 @@ thixotropicViscosity::thixotropicViscosity ) : filmViscosityModel(typeName, owner, dict, mu), - a_(coeffDict_.lookup("a")), - b_(coeffDict_.lookup("b")), - c_(coeffDict_.lookup("c")), - d_(coeffDict_.lookup("d")), - mu0_(coeffDict_.lookup("mu0")), - muInf_(coeffDict_.lookup("muInf")), + a_("a", dimless/dimTime, coeffDict_.lookup("a")), + b_("b", dimless, coeffDict_.lookup("b")), + d_("d", dimless, coeffDict_.lookup("d")), + c_("c", pow(dimTime, d_.value() - scalar(1)), coeffDict_.lookup("c")), + mu0_("mu0", dimPressure*dimTime, coeffDict_.lookup("mu0")), + muInf_("muInf", mu0_.dimensions(), coeffDict_.lookup("muInf")), K_(1.0 - Foam::sqrt(muInf_/mu0_)), lambda_ ( @@ -144,27 +144,33 @@ void thixotropicViscosity::correct const volScalarField& delta = film.delta(); const volScalarField& deltaRho = film.deltaRho(); const surfaceScalarField& phi = film.phi(); + const volScalarField& alpha = film.alpha(); - // gamma-dot (shear rate) raised to the power d - volScalarField gDotPowD - ( - "gDotPowD", - pow(mag(U - Uw)/(delta + film.deltaSmall()), d_) - ); + // gamma-dot (shear rate) + volScalarField gDot("gDot", alpha*mag(U - Uw)/(delta + film.deltaSmall())); - dimensionedScalar c0("SMALL", dimMass/sqr(dimLength)/dimTime, SMALL); - volScalarField coeff(-deltaRho*c_*gDotPowD + c0); + if (debug && this->owner().regionMesh().time().outputTime()) + { + gDot.write(); + } + + dimensionedScalar deltaRho0("deltaRho0", deltaRho.dimensions(), ROOTVSMALL); + surfaceScalarField phiU(phi/fvc::interpolate(deltaRho + deltaRho0)); + + dimensionedScalar c0("c0", dimless/dimTime, ROOTVSMALL); + volScalarField coeff("coeff", -c_*pow(gDot, d_) + c0); fvScalarMatrix lambdaEqn ( - fvm::ddt(deltaRho, lambda_) - + fvm::div(phi, lambda_) - - fvm::Sp(fvc::div(phi), lambda_) + fvm::ddt(lambda_) + + fvm::div(phiU, lambda_) + - fvm::Sp(fvc::div(phiU), lambda_) == - deltaRho*a_*pow((1.0 - lambda_), b_) + a_*pow((1.0 - lambda_), b_) + fvm::SuSp(coeff, lambda_) ); + lambdaEqn.relax(); lambdaEqn.solve(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.H index 2c60dc42..ac1a2ac2 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -105,38 +105,18 @@ protected: // Protected data -/* - //- Model `a' coefficient - scalar a_; - - //- Model `b' coefficient - scalar b_; - - //- Model `c' coefficient - scalar c_; - - //- Model `d' coefficient - scalar d_; - - //- Limiting viscosity when lambda = 1 - scalar mu0_; - - //- Limiting viscosity when lambda = 0 - scalar muInf_; -*/ - //- Model `a' coefficient dimensionedScalar a_; //- Model `b' coefficient dimensionedScalar b_; - //- Model `c' coefficient - dimensionedScalar c_; - //- Model `d' coefficient dimensionedScalar d_; + //- Model `c' coefficient (read after d since dims depend on d value) + dimensionedScalar c_; + //- Limiting viscosity when lambda = 1 dimensionedScalar mu0_; From a90c8192d70cf123705d1063a1144828c09c6082 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 15 Oct 2014 11:53:02 +0100 Subject: [PATCH 2/6] BUG: Adding mapping functions to radiationCoupledBase --- .../MarshakRadiationFvPatchScalarField.C | 9 ++-- ...iationFixedTemperatureFvPatchScalarField.C | 8 ++-- .../radiationCoupledBase.C | 38 +++++++++++++++- .../radiationCoupledBase.H | 45 +++++++++++++++---- 4 files changed, 85 insertions(+), 15 deletions(-) diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C index 2bd7a38f..9f72eea8 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,8 @@ Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField ( p, ptf.emissivityMethod(), - ptf.emissivity_ + ptf.emissivity_, + mapper ), TName_(ptf.TName_) {} @@ -136,7 +137,8 @@ void Foam::MarshakRadiationFvPatchScalarField::autoMap const fvPatchFieldMapper& m ) { - scalarField::autoMap(m); + mixedFvPatchScalarField::autoMap(m); + radiationCoupledBase::autoMap(m); } @@ -147,6 +149,7 @@ void Foam::MarshakRadiationFvPatchScalarField::rmap ) { mixedFvPatchScalarField::rmap(ptf, addr); + radiationCoupledBase::rmap(ptf, addr); } diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C index d98d0c56..218ec2a9 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,8 @@ MarshakRadiationFixedTemperatureFvPatchScalarField ( p, ptf.emissivityMethod(), - ptf.emissivity_ + ptf.emissivity_, + mapper ), Trad_(ptf.Trad_, mapper) {} @@ -136,6 +137,7 @@ void Foam::MarshakRadiationFixedTemperatureFvPatchScalarField::autoMap ) { mixedFvPatchScalarField::autoMap(m); + radiationCoupledBase::autoMap(m); Trad_.autoMap(m); } @@ -147,7 +149,7 @@ void Foam::MarshakRadiationFixedTemperatureFvPatchScalarField::rmap ) { mixedFvPatchScalarField::rmap(ptf, addr); - + radiationCoupledBase::rmap(ptf, addr); const MarshakRadiationFixedTemperatureFvPatchScalarField& mrptf = refCast(ptf); diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C index ced47a95..e34ebe42 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -66,6 +66,20 @@ Foam::radiationCoupledBase::radiationCoupledBase {} +Foam::radiationCoupledBase::radiationCoupledBase +( + const fvPatch& patch, + const word& calculationType, + const scalarField& emissivity, + const fvPatchFieldMapper& mapper +) +: + patch_(patch), + method_(emissivityMethodTypeNames_[calculationType]), + emissivity_(emissivity, mapper) +{} + + Foam::radiationCoupledBase::radiationCoupledBase ( const fvPatch& patch, @@ -189,6 +203,28 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const } +void Foam::radiationCoupledBase::autoMap +( + const fvPatchFieldMapper& m +) +{ + emissivity_.autoMap(m); +} + + +void Foam::radiationCoupledBase::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + const radiationCoupledBase& mrptf = + refCast(ptf); + + emissivity_.rmap(mrptf.emissivity_, addr); +} + + void Foam::radiationCoupledBase::write(Ostream& os) const { os.writeKeyword("emissivityMode") << emissivityMethodTypeNames_[method_] diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H index 12d805c0..f6e4cd48 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,7 @@ SourceFiles #include "scalarField.H" #include "NamedEnum.H" #include "fvPatch.H" +#include "fvPatchFieldMapper.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -99,6 +100,15 @@ public: const scalarField& emissivity ); + //- Construct from patch, emissivity mode and emissivity and mapper + radiationCoupledBase + ( + const fvPatch& patch, + const word& calculationMethod, + const scalarField& emissivity, + const fvPatchFieldMapper& mapper + ); + //- Construct from patch and dictionary radiationCoupledBase ( @@ -109,15 +119,34 @@ public: // Member functions - //- Method to obtain emissivity - word emissivityMethod() const - { - return emissivityMethodTypeNames_[method_]; - } + // Access + + //- Method to obtain emissivity + word emissivityMethod() const + { + return emissivityMethodTypeNames_[method_]; + } - //- Calculate corresponding emissivity field - scalarField emissivity() const; + //- Calculate corresponding emissivity field + scalarField emissivity() const; + + + // Mapping functions + + //- 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 fvPatchScalarField&, + const labelList& + ); + //- Write void write(Ostream&) const; From 057f8797dd452416873faaed49b55406ecae4628 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 15 Oct 2014 12:14:15 +0100 Subject: [PATCH 3/6] BUG: Adding mapping function to radiationCoupledBase --- .../radiationCoupledBase/radiationCoupledBase.C | 13 +++++++++++++ .../radiationCoupledBase/radiationCoupledBase.H | 11 +++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C index e34ebe42..3d885c51 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C @@ -32,6 +32,13 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(radiationCoupledBase, 0); +} + + namespace Foam { template<> @@ -139,6 +146,12 @@ Foam::radiationCoupledBase::radiationCoupledBase } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::radiationCoupledBase::~radiationCoupledBase() +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::scalarField Foam::radiationCoupledBase::emissivity() const diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H index f6e4cd48..c5fd277d 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H @@ -90,6 +90,10 @@ protected: public: + //- Runtime type information + TypeName("radiationCoupledBase"); + + // Constructors //- Construct from patch, emissivity mode and emissivity @@ -117,6 +121,9 @@ public: ); + //- Destructor + virtual ~radiationCoupledBase(); + // Member functions // Access @@ -135,13 +142,13 @@ public: // Mapping functions //- Map (and resize as needed) from self given a mapping object - void autoMap + virtual void autoMap ( const fvPatchFieldMapper& ); //- Reverse map the given fvPatchField onto this fvPatchField - void rmap + virtual void rmap ( const fvPatchScalarField&, const labelList& From afda83faa55b1bb5b01989ad256feedbac93a21c Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 15 Oct 2014 12:28:49 +0100 Subject: [PATCH 4/6] BUG: adding templated argument to Field --- .../externalCoupledTemperatureMixedFvPatchScalarField.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C index 3d85ccda..c4d54b83 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -201,8 +201,8 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData { const Field& magSf = magSfs[procI]; const Field& value = values[procI]; - const Field& qDot = qDots[procI]; - const Field& htc = htcs[procI]; + const Field& qDot = qDots[procI]; + const Field& htc = htcs[procI]; forAll(magSf, faceI) { From ccc9593194b09fe0a975c6d2de717588d39d77f9 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 16 Oct 2014 10:20:19 +0100 Subject: [PATCH 5/6] ENH: chtMultiRegionFoam solvers - added option to calculate using frozen flow --- .../fluid/createFluidFields.H | 35 ++++++------------- .../fluid/setRegionFluidFields.H | 1 + .../fluid/solveFluid.H | 22 ++++++++---- .../fluid/createFluidFields.H | 7 +++- .../fluid/setRegionFluidFields.H | 2 ++ .../chtMultiRegionFoam/fluid/solveFluid.H | 33 ++++++++++------- 6 files changed, 54 insertions(+), 46 deletions(-) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index 99f14113..885b1f08 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -11,8 +11,9 @@ PtrList radiation(fluidRegions.size()); List initialMassFluid(fluidRegions.size()); - List