1 // use tetrahedral decomposition of the engine mesh
4 tetPointVectorField& motionU = mSolver.motionU();
7 piston().cs().axis()*engineTime_.pistonSpeed().value();
9 Info << " Set valve velocity " << endl;
11 forAll (valves_, valveI)
13 // If valve is present in geometry, set the motion
15 Info << " Set valve Bottom velocity " << endl;
17 if (valves_[valveI].bottomPatchID().active())
20 -valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
22 // Bottom of the valve moves with given velocity
23 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
28 Info<< "Valve " << valveI << " lift: "
29 << valves_[valveI].curLift()
30 << " velocity: " << valves_[valveI].curVelocity()
36 Info << " Set valve poppet velocity " << endl;
38 if (valves_[valveI].poppetPatchID().active())
41 // Top of the valve does not move
42 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
47 Info << " Set valve curInCyl velocity " << endl;
49 if (valves_[valveI].curtainInCylinderPatchID().active())
52 label cicIndex = valves_[valveI].curtainInCylinderPatchID().index();
54 componentMixedTetPolyPatchVectorField& pp =
55 refCast<componentMixedTetPolyPatchVectorField>
57 motionU.boundaryField()[cicIndex]
60 scalarField curtainInCylinderPoints =
61 motionU.boundaryField()[cicIndex].patch()
62 .localPoints().component(vector::Z);
64 pp.refValue() = pistonVel;
66 (1.0-pos(curtainInCylinderPoints - pistonPosition()))*vector(0,0,1);
72 Info << " Set valve curInport velocity " << endl;
75 if (valves_[valveI].curtainInPortPatchID().active())
77 label cipIndex = valves_[valveI].curtainInPortPatchID().index();
79 componentMixedTetPolyPatchVectorField& pp =
80 refCast<componentMixedTetPolyPatchVectorField>
82 motionU.boundaryField()[cipIndex]
85 scalarField curtainInPortPoints =
86 motionU.boundaryField()[cipIndex].patch()
87 .localPoints().component(vector::Z);
89 pp.refValue() = pistonVel;
91 (1.0-pos(curtainInPortPoints - pistonPosition()))*vector(0,0,1);;
96 Info << " Set valve stem velocity " << endl;
98 if (valves_[valveI].stemPatchID().active())
100 label stemIndex = valves_[valveI].stemPatchID().index();
102 componentMixedTetPolyPatchVectorField& pp =
103 refCast<componentMixedTetPolyPatchVectorField>
105 motionU.boundaryField()[stemIndex]
108 pp.refValue() = vector::zero;
109 pp.valueFraction() = vector(0,0,1);
114 label linerIndex = boundaryMesh().findPatchID("liner");
116 componentMixedTetPolyPatchVectorField& pp =
117 refCast<componentMixedTetPolyPatchVectorField>
119 motionU.boundaryField()[linerIndex]
122 scalarField linerPoints =
123 motionU.boundaryField()[linerIndex].patch()
124 .localPoints().component(vector::Z);
126 pp.refValue() = pistonVel;
128 (1.0-pos(linerPoints - pistonPosition()))*vector(0,0,1);;
134 // Set piston velocity
135 if (piston().patchID().active())
140 Info<< "Piston velocity: " << pistonVel;
143 componentMixedTetPolyPatchVectorField& pp =
144 refCast<componentMixedTetPolyPatchVectorField>
146 motionU.boundaryField()[piston().patchID().index()]
149 pp.refValue() = pistonVel;
157 Info << "msolved" << endl;
159 // Setting the boundary position
162 label cylinderHeadIndex = boundaryMesh().findPatchID("cylinderHead");
164 // Top of the valve does not move
165 motionU.boundaryField()[cylinderHeadIndex] ==