1 // use tetrahedral decomposition of the engine mesh
5 Info << "setting valve motion b.c." << endl;
7 tetPointVectorField& motionU = mSolver.motionU();
11 forAll (valves_, valveI)
15 valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
17 if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
19 valveVel = vector::zero;
22 Info << "Valve n. " << valveI + 1 << " velocity = " << valves_[valveI].curVelocity() << endl;
25 // If valve is present in geometry, set the motion
26 if (valves_[valveI].bottomPatchID().active())
28 // Bottom of the valve moves with given velocity
29 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
34 Info<< "Valve " << valveI << " lift: "
35 << valves_[valveI].curLift()
36 << " velocity: " << valves_[valveI].curVelocity()
41 if (valves_[valveI].poppetPatchID().active())
44 // Top of the valve does not move
45 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
48 Info<< "Valve " << valveI << " lift: "
49 << valves_[valveI].curLift()
50 << " velocity: " << valves_[valveI].curVelocity()
55 if (valves_[valveI].sidePatchID().active())
57 // Top of the valve does not move
58 motionU.boundaryField()[valves_[valveI].sidePatchID().index()] ==
62 if (valves_[valveI].detachInPortPatchID().active())
64 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
67 if (valves_[valveI].detachInCylinderPatchID().active())
69 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
72 // If valve is present in geometry, set the motion
75 valves_[valveI].curtainInPortPatchID().active()
77 valves_[valveI].poppetPatchID().active()
79 valves_[valveI].curtainInCylinderPatchID().active()
84 label curtainInPortIndex = valves_[valveI].curtainInPortPatchID().index();
85 label poppetIndex = valves_[valveI].poppetPatchID().index();
86 label curtainInCylIndex = valves_[valveI].curtainInCylinderPatchID().index();
88 const coordinateSystem& cSysV = valves_[valveI].cs();
90 const pointField& curtainInPortGlobal =
91 motionU.boundaryField()[curtainInPortIndex].patch().localPoints();
93 const pointField& poppetGlobal =
94 motionU.boundaryField()[poppetIndex].patch().localPoints();
96 const pointField& curtainInCylGlobal =
97 motionU.boundaryField()[curtainInCylIndex].patch().localPoints();
99 scalarField curtainInPortLocal = cSysV.localPosition(curtainInPortGlobal)().component(vector::Z);
100 scalarField poppetLocal = cSysV.localPosition(poppetGlobal)().component(vector::Z);
101 scalarField curtainInCylLocal = cSysV.localPosition(curtainInCylGlobal)().component(vector::Z);
103 scalar maxCurtain = max(curtainInCylLocal);
104 scalar minPoppet = min(poppetLocal);
106 Info << "maxCurtain = " << maxCurtain << endl;
107 Info << "minPoppet = " << minPoppet << endl;
109 motionU.boundaryField()[curtainInPortIndex] == (pos(curtainInPortLocal - minPoppet))*valveVel*(maxCurtain -
110 curtainInPortLocal)/(maxCurtain-minPoppet);
116 Info<< "Valve " << valveI << " lift: "
117 << valves_[valveI].curLift()
118 << " velocity: " << valves_[valveI].curVelocity()
125 // Setting the boundary position
126 Info << "valve motion boundary conditions set" << endl;