From 1ef6ff4f509374f6c460c230a20bce6f7cfb8d51 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 28 May 2014 11:54:42 +0100 Subject: [PATCH 1/5] rotatingMotion: Corrected construction of quaternion for non-coordinate axis rotation Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1306 --- .../rotatingMotion/rotatingMotion.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C index 7d716e68..0ce2b8db 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,9 +75,9 @@ Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const scalar t = time_.value(); // Rotation around axis - vector eulerAngles = omega_->integrate(0, t)*axis_; + scalar angle = omega_->integrate(0, t); - quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z()); + quaternion R(axis_, angle); septernion TR(septernion(origin_)*R*septernion(-origin_)); Info<< "solidBodyMotionFunctions::rotatingMotion::transformation(): " From 55a97bd751fb4d2d6856306839641733c8cc7e2a Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 28 May 2014 12:54:25 +0100 Subject: [PATCH 2/5] movingWallVelocityFvPatchVectorField: Update U at the wall only if the mesh is 'moving' rather than 'changing'. Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1305 --- .../movingWallVelocity/movingWallVelocityFvPatchVectorField.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index 11f811e4..07c79444 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,7 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() const fvMesh& mesh = dimensionedInternalField().mesh(); - if (mesh.changing()) + if (mesh.moving()) { const fvPatch& p = patch(); const polyPatch& pp = p.patch(); From 50304f561dfd61a94abe99d8a02639acb167431b Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 28 May 2014 15:23:56 +0100 Subject: [PATCH 3/5] ENH: dynamicRefineFvMesh: #1203 base unrefinement on max, not min of surrounding cells --- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 48 ++++++++++++------- .../dynamicRefineFvMesh/dynamicRefineFvMesh.H | 10 ++-- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 201e62b7..fc8fcce1 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -59,7 +59,15 @@ Foam::label Foam::dynamicRefineFvMesh::count { n++; } + + // debug also serves to get-around Clang compiler trying to optimsie + // out this forAll loop under O3 optimisation + if (debug) + { + Info<< "n=" << n << endl; + } } + return n; } @@ -659,11 +667,11 @@ Foam::dynamicRefineFvMesh::maxPointField(const scalarField& pFld) const } -// Get min of connected cell +// Get max of connected cell Foam::scalarField -Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const +Foam::dynamicRefineFvMesh::maxCellField(const volScalarField& vFld) const { - scalarField pFld(nPoints(), GREAT); + scalarField pFld(nPoints(), -GREAT); forAll(pointCells(), pointI) { @@ -671,7 +679,7 @@ Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const forAll(pCells, i) { - pFld[pointI] = min(pFld[pointI], vFld[pCells[i]]); + pFld[pointI] = max(pFld[pointI], vFld[pCells[i]]); } } return pFld; @@ -774,10 +782,11 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectRefineCells calculateProtectedCells(unrefineableCell); // Count current selection - label nCandidates = returnReduce(count(candidateCell, 1), sumOp