1 // use tetrahedral decomposition of the engine mesh
5 Info << "setting valve motion b.c." << endl;
7 tetPointVectorField& motionU = mSolver.motionU();
12 forAll (valves_, valveI)
16 valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
18 if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
20 valveVel = vector::zero;
23 Info << "Valve n. " << valveI + 1 << " velocity = " << valves_[valveI].curVelocity() << endl;
26 // If valve is present in geometry, set the motion
27 if (valves_[valveI].bottomPatchID().active())
29 // Bottom of the valve moves with given velocity
30 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
35 Info<< "Valve " << valveI << " lift: "
36 << valves_[valveI].curLift()
37 << " velocity: " << valves_[valveI].curVelocity()
42 if (valves_[valveI].poppetPatchID().active())
45 // Top of the valve does not move
46 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
49 Info<< "Valve " << valveI << " lift: "
50 << valves_[valveI].curLift()
51 << " velocity: " << valves_[valveI].curVelocity()
56 if (valves_[valveI].sidePatchID().active())
58 // Top of the valve does not move
59 motionU.boundaryField()[valves_[valveI].sidePatchID().index()] ==
63 if (valves_[valveI].detachInPortPatchID().active())
65 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
68 if (valves_[valveI].detachInCylinderPatchID().active())
70 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
73 // If valve is present in geometry, set the motion
76 valves_[valveI].curtainInPortPatchID().active()
78 valves_[valveI].poppetPatchID().active()
80 valves_[valveI].curtainInCylinderPatchID().active()
85 label curtainInPortIndex = valves_[valveI].curtainInPortPatchID().index();
86 label poppetIndex = valves_[valveI].poppetPatchID().index();
87 label curtainInCylIndex = valves_[valveI].curtainInCylinderPatchID().index();
89 const coordinateSystem& cSysV = valves_[valveI].cs();
91 const pointField& curtainInPortGlobal =
92 motionU.boundaryField()[curtainInPortIndex].patch().localPoints();
94 const pointField& poppetGlobal =
95 motionU.boundaryField()[poppetIndex].patch().localPoints();
97 const pointField& curtainInCylGlobal =
98 motionU.boundaryField()[curtainInCylIndex].patch().localPoints();
100 scalarField curtainInPortLocal = cSysV.localPosition(curtainInPortGlobal)().component(vector::Z);
101 scalarField poppetLocal = cSysV.localPosition(poppetGlobal)().component(vector::Z);
102 scalarField curtainInCylLocal = cSysV.localPosition(curtainInCylGlobal)().component(vector::Z);
104 scalar maxCurtain = max(curtainInCylLocal);
105 scalar minPoppet = min(poppetLocal);
107 Info << "maxCurtain = " << maxCurtain << endl;
108 Info << "minPoppet = " << minPoppet << endl;
110 motionU.boundaryField()[curtainInPortIndex] == (pos(curtainInPortLocal - minPoppet))*valveVel*(maxCurtain -
111 curtainInPortLocal)/(maxCurtain-minPoppet);
117 Info<< "Valve " << valveI << " lift: "
118 << valves_[valveI].curLift()
119 << " velocity: " << valves_[valveI].curVelocity()
126 // Setting the boundary position
127 Info << "valve motion boundary conditions set" << endl;