1 // use tetrahedral decomposition of the engine mesh
4 tetPointVectorField& motionU = mSolver.motionU();
7 piston().cs().axis()*engineTime_.pistonSpeed().value();
10 forAll (valves_, valveI)
12 // If valve is present in geometry, set the motion
13 if (valves_[valveI].bottomPatchID().active())
16 valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
18 // Bottom of the valve moves with given velocity
19 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
24 Info<< "Valve " << valveI << " lift: "
25 << valves_[valveI].curLift()
26 << " velocity: " << valves_[valveI].curVelocity()
31 if (valves_[valveI].poppetPatchID().active())
33 // Top of the valve does not move
34 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
38 if (valves_[valveI].curtainInCylinderPatchID().active())
41 label cicIndex = valves_[valveI].curtainInCylinderPatchID().index();
43 componentMixedTetPolyPatchVectorField& pp =
44 refCast<componentMixedTetPolyPatchVectorField>
46 motionU.boundaryField()[cicIndex]
49 scalarField curtainInCylinderPoints =
50 motionU.boundaryField()[cicIndex].patch()
51 .localPoints().component(vector::Z);
53 pp.refValue() = pistonVel;
55 (1.0-pos(curtainInCylinderPoints - pistonPosition()))*vector(0,0,1);
61 if (valves_[valveI].curtainInPortPatchID().active())
63 label cipIndex = valves_[valveI].curtainInPortPatchID().index();
65 componentMixedTetPolyPatchVectorField& pp =
66 refCast<componentMixedTetPolyPatchVectorField>
68 motionU.boundaryField()[cipIndex]
71 scalarField curtainInPortPoints =
72 motionU.boundaryField()[cipIndex].patch()
73 .localPoints().component(vector::Z);
75 pp.refValue() = pistonVel;
77 (1.0-pos(curtainInPortPoints - pistonPosition()))*vector(0,0,1);;
81 if (valves_[valveI].detachInPortPatchID().active())
83 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
86 if (valves_[valveI].detachInCylinderPatchID().active())
88 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
91 if (valves_[valveI].stemPatchID().active())
93 label stemIndex = valves_[valveI].stemPatchID().index();
95 componentMixedTetPolyPatchVectorField& pp =
96 refCast<componentMixedTetPolyPatchVectorField>
98 motionU.boundaryField()[stemIndex]
101 pp.refValue() = vector::zero;
102 pp.valueFraction() = vector(0,0,1);
107 label linerIndex = boundaryMesh().findPatchID("liner");
109 componentMixedTetPolyPatchVectorField& pp =
110 refCast<componentMixedTetPolyPatchVectorField>
112 motionU.boundaryField()[linerIndex]
115 scalarField linerPoints =
116 motionU.boundaryField()[linerIndex].patch()
117 .localPoints().component(vector::Z);
119 pp.refValue() = pistonVel;
121 (1.0-pos(linerPoints - pistonPosition()))*vector(0,0,1);;
127 // Set piston velocity
128 if (piston().patchID().active())
133 Info<< "Piston velocity: " << pistonVel;
136 componentMixedTetPolyPatchVectorField& pp =
137 refCast<componentMixedTetPolyPatchVectorField>
139 motionU.boundaryField()[piston().patchID().index()]
142 pp.refValue() = pistonVel;
148 // Setting the boundary position
151 label cylinderHeadIndex = boundaryMesh().findPatchID("cylinderHead");
153 // Top of the valve does not move
154 motionU.boundaryField()[cylinderHeadIndex] ==