From 33a5944fc8fc8869d5b8199b1f0e756a97ff810d Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Tue, 24 Jul 2012 15:03:58 +0100 Subject: [PATCH] Corrected updateCoeffs in BCs --- ...veViewFactorFixedValueFvPatchScalarField.C | 7 ++- ...convectiveHeatTransferFvPatchScalarField.C | 2 + ...ndaryLayerInletEpsilonFvPatchScalarField.C | 11 +---- ...ndaryLayerInletEpsilonFvPatchScalarField.H | 8 +--- ...daryLayerInletVelocityFvPatchVectorField.C | 46 ++++++++----------- ...daryLayerInletVelocityFvPatchVectorField.H | 39 ++++++++-------- 6 files changed, 48 insertions(+), 65 deletions(-) diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index 642d2aeee87..1b1d55c8a74 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -128,10 +128,14 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField:: updateCoeffs() { + if (this->updated()) + { + return; + } + // Do nothing if (debug) @@ -149,6 +153,7 @@ updateCoeffs() << endl; } + fixedValueFvPatchScalarField::updateCoeffs(); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C index c747a97b84e..116bfc9c253 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C @@ -142,6 +142,8 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs() htc[faceI] = 0.037*pow(Re, 0.8)*cbrt(Pr[faceI])*kappaw[faceI]/L_; } } + + fixedValueFvPatchScalarField::updateCoeffs(); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index 51f4aae20c0..80aa64362a9 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -116,7 +116,8 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField z_ /= mag(z_); - evaluate(); + const vectorField& c = patch().Cf(); + scalarField::operator=(pow3(Ustar_)/(kappa_*((c & z_) - zGround_ + z0_))); } @@ -169,14 +170,6 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap } -void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs() -{ - const vectorField& c = patch().Cf(); - tmp<scalarField> coord = (c & z_); - scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_))); -} - - void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index c72e35372a3..bce9e014809 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -176,7 +176,7 @@ public: // Access //- Return max value - scalarField Ustar() const + const scalarField& Ustar() const { return Ustar_; } @@ -204,12 +204,6 @@ public: ); - // Evaluation functions - - //- Update coefficients - virtual void updateCoeffs(); - - //- Write virtual void write(Ostream&) const; }; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index 3a336770253..e41c3904faa 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -120,7 +120,25 @@ atmBoundaryLayerInletVelocityFvPatchVectorField Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001))); } - evaluate(); + const vectorField& c = patch().Cf(); + const scalarField coord(c & z_); + scalarField Un(coord.size()); + + forAll(coord, i) + { + if ((coord[i] - zGround_[i]) < Href_) + { + Un[i] = + (Ustar_[i]/kappa_) + * log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001)); + } + else + { + Un[i] = Uref_; + } + } + + vectorField::operator=(n_*Un); } @@ -174,32 +192,6 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap } -void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs() -{ - const vectorField& c = patch().Cf(); - const scalarField coord(c & z_); - scalarField Un(coord.size()); - - forAll(coord, i) - { - if ((coord[i] - zGround_[i]) < Href_) - { - Un[i] = - (Ustar_[i]/kappa_) - * log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001)); - } - else - { - Un[i] = Uref_; - } - } - - vectorField::operator=(n_*Un); - - fixedValueFvPatchVectorField::updateCoeffs(); -} - - void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index 68a6408f2b2..0249b7111c9 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -180,23 +180,26 @@ public: // Member functions - //- Return Ustar - scalarField& Ustar() - { - return Ustar_; - } + // Access - //- Return flow direction - vector& n() - { - return n_; - } + //- Return Ustar + const scalarField& Ustar() const + { + return Ustar_; + } + + //- Return flow direction + const vector& n() const + { + return n_; + } + + //- Return z direction + const vector& z() const + { + return z_; + } - //- Return z direction - vector& z() - { - return z_; - } // Mapping functions @@ -214,12 +217,6 @@ public: ); - // Evaluation functions - - //- Update coefficients - virtual void updateCoeffs(); - - //- Write virtual void write(Ostream&) const; }; -- GitLab