1 // use tetrahedral decomposition of the engine mesh
5 Info << "setting valve motion b.c." << endl;
7 tetPointVectorField& motionU = mSolver.motionU();
10 // set piston motion boundary conditions
12 // Set piston velocity
13 if (piston().patchID().active())
16 piston().cs().axis()*engineTime_.pistonSpeed().value();
20 Info << "Piston velocity: " << pistonVel;
23 motionU.boundaryField()[piston().patchID().index()] == pistonVel;
28 forAll (valves_, valveI)
32 valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
34 Info << "Valve n. " << valveI + 1 << " velocity = " << valves_[valveI].curVelocity() << endl;
36 // If valve is present in geometry, set the motion
37 if (valves_[valveI].bottomPatchID().active())
39 // Bottom of the valve moves with given velocity
40 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
45 if (valves_[valveI].poppetPatchID().active())
48 if(valves_[valveI].curLift() < valves_[valveI].deformationLift())
50 // Top of the valve does not move
51 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
56 // Top of the valve does not move
57 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
63 if (valves_[valveI].sidePatchID().active())
65 // Top of the valve does not move
66 motionU.boundaryField()[valves_[valveI].sidePatchID().index()] ==
70 if (valves_[valveI].detachInPortPatchID().active())
72 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
75 if (valves_[valveI].detachInCylinderPatchID().active())
77 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
82 valves_[valveI].curtainInPortPatchID().active()
84 valves_[valveI].poppetPatchID().active()
86 valves_[valveI].curtainInCylinderPatchID().active()
88 valves_[valveI].bottomPatchID().active()
94 label curtainInCylIndex = valves_[valveI].curtainInCylinderPatchID().index();
95 label bottomIndex = valves_[valveI].bottomPatchID().index();
97 // label poppetIndex = valves_[valveI].poppetPatchID().index();
98 // label curtainInCylIndex = valves_[valveI].curtainInCylinderPatchID().index();
100 const coordinateSystem& cSysV = valves_[valveI].cs();
102 const pointField& curtainInCylGlobal =
103 motionU.boundaryField()[curtainInCylIndex].patch().localPoints();
105 const pointField& bottomGlobal =
106 motionU.boundaryField()[bottomIndex].patch().localPoints();
108 scalarField curtainInCylLocal = cSysV.localPosition(curtainInCylGlobal)().component(vector::Z);
110 scalarField bottomLocal = cSysV.localPosition(bottomGlobal)().component(vector::Z);
113 scalar maxCurtain = max(curtainInCylLocal);
115 scalar minCurtain = min(curtainInCylLocal);
116 // scalar minCurtain = max(bottomLocal);
117 scalar maxBottom = max(bottomLocal);
120 Info << "minCurtain = " << minCurtain << endl;
121 Info << "maxBottom = " << max(bottomLocal) << endl;
124 // motionU.boundaryField()[curtainInCylIndex] == (pos(curtainInCylLocal - minCurtain))*valveVel*(maxCurtain -
125 // curtainInCylLocal)/(maxCurtain-minCurtain);
129 forAll(motionU.boundaryField()[curtainInCylIndex], pointi)
131 if(curtainInCylLocal[pointi] > maxBottom)
133 motionU.boundaryField()[curtainInCylIndex][pointi]
136 (maxCurtain - curtainInCylLocal[pointi])
138 (maxCurtain-maxBottom);
142 motionU.boundaryField()[curtainInCylIndex][pointi]
151 motionU.boundaryField()[curtainInCylIndex] == valveVel*(maxCurtain -
152 curtainInCylLocal)/(maxCurtain-minCurtain);
154 motionU.boundaryField()[curtainInCylIndex] == pos(curtainInCylLocal - maxBottom) * valveVel*(maxCurtain -
155 curtainInCylLocal)/(maxCurtain-minCurtain) + (1.0 - pos(curtainInCylLocal - maxBottom)) * valveVel;
157 // Info << "motionU" << motionU.boundaryField()[curtainInCylIndex] << endl;
159 Info << "valveVel" << valveVel << endl;
161 // Info << "motionU.boundaryField()[curtainInCylIndex]" <<
162 // motionU.boundaryField()[curtainInCylIndex] << endl;
168 // Setting the boundary position
169 Info << "valve motion boundary conditions set" << endl;