From adb6714a2d7e3fa66bb985bd59711e2b308648b6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 12 Sep 2012 16:54:35 +0100 Subject: [PATCH] BUG: MRFZone: reference to temp --- .../cfdTools/general/MRF/MRFZone.C | 42 ++++++------------- .../cfdTools/general/MRF/MRFZoneTemplates.C | 22 ++++------ 2 files changed, 20 insertions(+), 44 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 9b88668dcc..1aa6bdd0cd 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -307,9 +307,7 @@ void Foam::MRFZone::addCoriolis vectorField& ddtUc = ddtU.internalField(); const vectorField& Uc = U.internalField(); - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; forAll(cells, i) { @@ -331,9 +329,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; forAll(cells, i) { @@ -359,9 +355,7 @@ void Foam::MRFZone::addCoriolis vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; forAll(cells, i) { @@ -375,18 +369,14 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector& origin = origin_; - - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; const labelList& cells = mesh_.cellZones()[cellZoneID_]; forAll(cells, i) { label celli = cells[i]; - U[celli] -= (Omega ^ (C[celli] - origin)); + U[celli] -= (Omega ^ (C[celli] - origin_)); } // Included patches @@ -407,7 +397,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const label patchFacei = excludedFaces_[patchi][i]; U.boundaryField()[patchi][patchFacei] -= (Omega - ^ (C.boundaryField()[patchi][patchFacei] - origin)); + ^ (C.boundaryField()[patchi][patchFacei] - origin_)); } } } @@ -417,18 +407,14 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector& origin = origin_; - - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; const labelList& cells = mesh_.cellZones()[cellZoneID_]; forAll(cells, i) { label celli = cells[i]; - U[celli] += (Omega ^ (C[celli] - origin)); + U[celli] += (Omega ^ (C[celli] - origin_)); } // Included patches @@ -438,7 +424,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const { label patchFacei = includedFaces_[patchi][i]; U.boundaryField()[patchi][patchFacei] = - (Omega ^ (C.boundaryField()[patchi][patchFacei] - origin)); + (Omega ^ (C.boundaryField()[patchi][patchFacei] - origin_)); } } @@ -449,7 +435,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const { label patchFacei = excludedFaces_[patchi][i]; U.boundaryField()[patchi][patchFacei] += - (Omega ^ (C.boundaryField()[patchi][patchFacei] - origin)); + (Omega ^ (C.boundaryField()[patchi][patchFacei] - origin_)); } } } @@ -489,11 +475,7 @@ void Foam::MRFZone::absoluteFlux void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const { - const vector& origin = origin_; - - const scalar t = mesh_.time().timeOutputValue(); - - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; // Included patches @@ -507,7 +489,7 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const { label patchFacei = includedFaces_[patchi][i]; - pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin)); + pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin_)); } U.boundaryField()[patchi] == pfld; diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C index 6a13cac888..f15aef2647 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C @@ -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) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,10 +41,7 @@ void Foam::MRFZone::relativeRhoFlux const surfaceVectorField& Cf = mesh_.Cf(); const surfaceVectorField& Sf = mesh_.Sf(); - const vector& origin = origin_; - - const scalar t = mesh_.time().timeOutputValue(); - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; const vectorField& Cfi = Cf.internalField(); const vectorField& Sfi = Sf.internalField(); @@ -54,7 +51,7 @@ void Foam::MRFZone::relativeRhoFlux forAll(internalFaces_, i) { label facei = internalFaces_[i]; - phii[facei] -= rho[facei]*(Omega ^ (Cfi[facei] - origin)) & Sfi[facei]; + phii[facei] -= rho[facei]*(Omega ^ (Cfi[facei] - origin_)) & Sfi[facei]; } // Included patches @@ -77,7 +74,7 @@ void Foam::MRFZone::relativeRhoFlux phi.boundaryField()[patchi][patchFacei] -= rho.boundaryField()[patchi][patchFacei] - * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin_)) & Sf.boundaryField()[patchi][patchFacei]; } } @@ -94,10 +91,7 @@ void Foam::MRFZone::absoluteRhoFlux const surfaceVectorField& Cf = mesh_.Cf(); const surfaceVectorField& Sf = mesh_.Sf(); - const vector& origin = origin_; - - const scalar t = mesh_.time().timeOutputValue(); - const vector& Omega = omega_->value(t)*axis_; + const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; const vectorField& Cfi = Cf.internalField(); const vectorField& Sfi = Sf.internalField(); @@ -107,7 +101,7 @@ void Foam::MRFZone::absoluteRhoFlux forAll(internalFaces_, i) { label facei = internalFaces_[i]; - phii[facei] += rho[facei]*(Omega ^ (Cfi[facei] - origin)) & Sfi[facei]; + phii[facei] += rho[facei]*(Omega ^ (Cfi[facei] - origin_)) & Sfi[facei]; } // Included patches @@ -119,7 +113,7 @@ void Foam::MRFZone::absoluteRhoFlux phi.boundaryField()[patchi][patchFacei] += rho.boundaryField()[patchi][patchFacei] - * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin_)) & Sf.boundaryField()[patchi][patchFacei]; } } @@ -133,7 +127,7 @@ void Foam::MRFZone::absoluteRhoFlux phi.boundaryField()[patchi][patchFacei] += rho.boundaryField()[patchi][patchFacei] - * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin_)) & Sf.boundaryField()[patchi][patchFacei]; } }