1 // use tetrahedral decomposition of the engine mesh
5 Info << "setting valve motion b.c." << endl;
7 tetPointVectorField& motionU = mSolver.motionU();
10 forAll (valves_, valveI)
13 Info << "Valve n. " << valveI + 1 << " velocity = " << valves_[valveI].curVelocity() << endl;
16 valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
18 // If valve is present in geometry, set the motion
19 if (valves_[valveI].bottomPatchID().active())
21 // Bottom of the valve moves with given velocity
22 motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
27 Info<< "Valve " << valveI << " lift: "
28 << valves_[valveI].curLift()
29 << " velocity: " << valves_[valveI].curVelocity()
34 if (valves_[valveI].poppetPatchID().active())
37 // Top of the valve does not move
38 motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
42 if (valves_[valveI].sidePatchID().active())
44 // Top of the valve does not move
45 motionU.boundaryField()[valves_[valveI].sidePatchID().index()] ==
53 valves_[valveI].detachInPortPatchID().active()
55 valves_[valveI].detachInCylinderPatchID().active()
59 label detachInPortIndex = valves_[valveI].detachInPortPatchID().index();
60 label detachInCylIndex = valves_[valveI].detachInCylinderPatchID().index();
62 const coordinateSystem& cSysV = valves_[valveI].cs();
64 const pointField& detachInPortGlobal =
65 motionU.boundaryField()[detachInPortIndex].patch().localPoints();
67 const pointField& detachInCylGlobal =
68 motionU.boundaryField()[detachInCylIndex].patch().localPoints();
70 scalarField detachInPortLocal = cSysV.localPosition(detachInPortGlobal)().component(vector::Z);
71 scalarField detachInCylLocal = cSysV.localPosition(detachInCylGlobal)().component(vector::Z);
73 scalar maxDetachInPort = max(detachInPortLocal);
74 scalar minDetachInPort = min(detachInPortLocal);
76 scalar maxDetachInCyl = max(detachInCylLocal);
77 scalar minDetachInCyl = min(detachInCylLocal);
79 Info << "maxDetachInPort = " << maxDetachInPort << endl;
80 Info << "minDetachInPort = " << minDetachInPort << endl;
81 Info << "maxDetachInCyl = " << maxDetachInCyl << endl;
82 Info << "minDetachInCyl = " << minDetachInCyl << endl;
85 motionU.boundaryField()[detachInPortIndex] == valveVel*(maxDetachInPort -
86 detachInPortLocal)/(maxDetachInPort-minDetachInPort);
88 motionU.boundaryField()[detachInCylIndex] == valveVel*(maxDetachInCyl -
89 detachInCylLocal)/(maxDetachInCyl-minDetachInCyl);
93 /* if (valves_[valveI].detachInPortPatchID().active())
95 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
97 Info << "detach in port" << endl;
99 if (valves_[valveI].detachInCylinderPatchID().active())
101 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
103 Info << "detach in cyl" << endl;
108 valves_[valveI].detachInPortPatchID().active()
110 valves_[valveI].detachInCylinderPatchID().active()
114 motionU.boundaryField()[valves_[valveI].detachInPortPatchID().index()] == vector::zero;
115 motionU.boundaryField()[valves_[valveI].detachInCylinderPatchID().index()] == vector::zero;
120 // Setting the boundary position
123 label cylinderHeadIndex = boundaryMesh().findPatchID(cylinderHeadName_);
125 // Top of the valve does not move
126 motionU.boundaryField()[cylinderHeadIndex] ==
130 Info << "valve motion boundary conditions set" << endl;