Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "fvMotionSolverEngineMesh.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/fvcMeshPhi.H>
00029 #include <finiteVolume/surfaceInterpolate.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 defineTypeNameAndDebug(fvMotionSolverEngineMesh, 0);
00039
00040 addToRunTimeSelectionTable(engineMesh, fvMotionSolverEngineMesh, IOobject);
00041
00042
00043
00044 fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
00045 :
00046 engineMesh(io),
00047 pistonLayers_("pistonLayers", dimLength, 0.0),
00048 motionSolver_(*this, engineDB_.engineDict().lookup("motionSolver"))
00049 {
00050 if (engineDB_.engineDict().found("pistonLayers"))
00051 {
00052 engineDB_.engineDict().lookup("pistonLayers") >> pistonLayers_;
00053 }
00054 }
00055
00056
00057
00058
00059 fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh()
00060 {}
00061
00062
00063
00064
00065 void fvMotionSolverEngineMesh::move()
00066 {
00067 scalar deltaZ = engineDB_.pistonDisplacement().value();
00068 Info<< "deltaZ = " << deltaZ << endl;
00069
00070
00071 scalar pistonPlusLayers = pistonPosition_.value() + pistonLayers_.value();
00072
00073 motionSolver_.cellMotionU().boundaryField()[pistonIndex_] == deltaZ;
00074
00075 {
00076 scalarField linerPoints =
00077 motionSolver_.cellMotionU()
00078 .boundaryField()[linerIndex_].patch().Cf().component(vector::Z);
00079
00080 motionSolver_.cellMotionU().boundaryField()[linerIndex_] ==
00081 deltaZ*pos(deckHeight_.value() - linerPoints)
00082 *(deckHeight_.value() - linerPoints)
00083 /(deckHeight_.value() - pistonPlusLayers);
00084 }
00085
00086 motionSolver_.solve();
00087
00088 if (engineDB_.foundObject<surfaceScalarField>("phi"))
00089 {
00090 surfaceScalarField& phi =
00091 const_cast<surfaceScalarField&>
00092 (engineDB_.lookupObject<surfaceScalarField>("phi"));
00093
00094 const volScalarField& rho =
00095 engineDB_.lookupObject<volScalarField>("rho");
00096
00097 const volVectorField& U =
00098 engineDB_.lookupObject<volVectorField>("U");
00099
00100 bool absolutePhi = false;
00101 if (moving())
00102 {
00103 phi += fvc::interpolate(rho)*fvc::meshPhi(rho, U);
00104 absolutePhi = true;
00105 }
00106
00107 movePoints(motionSolver_.curPoints());
00108
00109 if (absolutePhi)
00110 {
00111 phi -= fvc::interpolate(rho)*fvc::meshPhi(rho, U);
00112 }
00113 }
00114 else
00115 {
00116 movePoints(motionSolver_.curPoints());
00117 }
00118
00119
00120 pistonPosition_.value() += deltaZ;
00121 scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
00122
00123 Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
00124 << "Piston speed = " << pistonSpeed << " m/s" << endl;
00125 }
00126
00127
00128
00129
00130 }
00131
00132