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