From 0946ba74275e6c7b1271303fd5e52ae68b5d38d3 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Tue, 13 May 2014 16:18:15 +0100 Subject: [PATCH] BUG: rotorDiskSource - local force was not transformed into global frame correctly - mantis #1290 --- .../derived/rotorDiskSource/rotorDiskSource.C | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index 443e2edf2ca..f565a397d27 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -234,6 +234,29 @@ void Foam::fv::rotorDiskSource::setFaceArea(vector& axis, const bool correct) reduce(n, sumOp<vector>()); axis = n/mag(n); } + + if (debug) + { + volScalarField area + ( + IOobject + ( + name_ + ":area", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("0", dimArea, 0) + ); + UIndirectList<scalar>(area.internalField(), cells_) = area_; + + Info<< type() << ": " << name_ << " writing field " << area.name() + << endl; + + area.write(); + } } @@ -317,7 +340,8 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() ( mesh_, axis, - origin + origin, + cells_ ) ); @@ -339,7 +363,8 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() ( mesh_, axis, - origin + origin, + cells_ ) ); @@ -503,10 +528,6 @@ void Foam::fv::rotorDiskSource::calculate scalar AOAmin = GREAT; scalar AOAmax = -GREAT; - tmp<vectorField> tUcf(localAxesRotation_->transform(U)); - - vectorField& Ucf = tUcf(); - forAll(cells_, i) { if (area_[i] > ROOTVSMALL) @@ -516,7 +537,7 @@ void Foam::fv::rotorDiskSource::calculate const scalar radius = x_[i].x(); // velocity in local cylindrical reference frame - vector Uc = Ucf[i]; + vector Uc = localAxesRotation_->transform(U[cellI], i); // transform from rotor cylindrical into local coning system Uc = R_[i] & Uc; @@ -581,7 +602,7 @@ void Foam::fv::rotorDiskSource::calculate localForce = invR_[i] & localForce; // convert force to global cartesian co-ordinate system - force[cellI] = coordSys_.globalVector(localForce); + force[cellI] = localAxesRotation_->invTransform(localForce, i); if (divideVolume) { -- GitLab