From 52e78fb3319068a02db6e981574fceb005d497c2 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 12 Mar 2013 17:00:48 +0000 Subject: [PATCH] fvMotionSolverEngineMesh: Corrected handling of the piston and liner velocity Changed the motion specification to be point-based rather than cell-based. Resolves bug report http://www.openfoam.org/mantisbt/view.php?id=766 --- .../componentVelocityMotionSolver.H | 9 ++++++++- .../fvMotionSolverEngineMesh.C | 18 +++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H index 5370797094..1044940777 100644 --- a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H +++ b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,6 +108,13 @@ public: // Member Functions + //- Non-const access to the pointMotionU in order to allow changes + // to the boundary motion + pointScalarField& pointMotionU() + { + return pointMotionU_; + } + //- Update local data for geometry changes virtual void movePoints(const pointField&); diff --git a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C index cc66e0201d..50ad3749b8 100644 --- a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C +++ b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,19 +80,20 @@ void Foam::fvMotionSolverEngineMesh::move() // Position of the top of the static mesh layers above the piston scalar pistonPlusLayers = pistonPosition_.value() + pistonLayers_.value(); - motionSolver_.cellMotionU().boundaryField()[pistonIndex_] == deltaZ; + scalar pistonSpeed = deltaZ/engineDB_.deltaTValue(); + + motionSolver_.pointMotionU().boundaryField()[pistonIndex_] == pistonSpeed; { scalarField linerPoints ( - motionSolver_.cellMotionU() - .boundaryField()[linerIndex_].patch().Cf().component(vector::Z) + boundary()[linerIndex_].patch().localPoints().component(vector::Z) ); - motionSolver_.cellMotionU().boundaryField()[linerIndex_] == - deltaZ*pos(deckHeight_.value() - linerPoints) - *(deckHeight_.value() - linerPoints) - /(deckHeight_.value() - pistonPlusLayers); + motionSolver_.pointMotionU().boundaryField()[linerIndex_] == + pistonSpeed*pos(deckHeight_.value() - linerPoints) + *(deckHeight_.value() - linerPoints) + /(deckHeight_.value() - pistonPlusLayers); } motionSolver_.solve(); @@ -130,7 +131,6 @@ void Foam::fvMotionSolverEngineMesh::move() pistonPosition_.value() += deltaZ; - scalar pistonSpeed = deltaZ/engineDB_.deltaTValue(); Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl << "Piston speed = " << pistonSpeed << " m/s" << endl;