From 6d71a38e6673ff1b234b71fa46dad900e2ea7902 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Apr 2010 11:34:47 +0100 Subject: [PATCH] ENH: Allow tensorial K --- ...allHeatFluxTemperatureFvPatchScalarField.C | 42 ++++++++++++++++--- ...allHeatFluxTemperatureFvPatchScalarField.H | 12 ++++-- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C index e2b1d536d2..1a5f871d96 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C @@ -124,6 +124,41 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap } +Foam::tmp +Foam::solidWallHeatFluxTemperatureFvPatchScalarField::K() const +{ + const fvMesh& mesh = patch().boundaryMesh().mesh(); + + if (mesh.objectRegistry::foundObject(KName_)) + { + return patch().lookupPatchField(KName_); + } + else if (mesh.objectRegistry::foundObject(KName_)) + { + const symmTensorField& KWall = + patch().lookupPatchField(KName_); + + vectorField n = patch().nf(); + + return n & KWall & n; + } + else + { + FatalErrorIn + ( + "solidWallHeatFluxTemperatureFvPatchScalarField::K()" + " const" + ) << "Did not find field " << KName_ + << " on mesh " << mesh.name() << " patch " << patch().name() + << endl + << "Please set 'K' to a valid volScalarField" + << " or a valid volSymmTensorField." << exit(FatalError); + + return scalarField(0); + } +} + + void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() { if (updated()) @@ -131,12 +166,7 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() return; } - const scalarField& Kw = patch().lookupPatchField - ( - KName_ - ); - - gradient() = q_/Kw; + gradient() = q_/K(); fixedGradientFvPatchScalarField::updateCoeffs(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H index ffbcf52ed5..0544b2bffa 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H @@ -31,9 +31,10 @@ Description myWallPatch { type solidWallHeatFluxTemperature; - K K; // Name of K field - q uniform 1000; // Heat flux / [W/m2] - value 300.0; // Initial temperature / [K] + K K; // Name of K field + q uniform 1000; // Heat flux / [W/m2] + value uniform 300.0; // Initial temperature / [K] + gradient uniform 0.0; // Initial gradient / [K/m] } @@ -140,6 +141,11 @@ public: // Member functions + // Helper + + //- Get K field on this patch + tmp K() const; + // Evaluation functions //- Update the coefficients associated with the patch field