Пример #1
0
        public void T01_Should_create_pressure_drop()
        {
            var p  = Pressure.FromKiloPascal(12);
            var pd = new PressureDrop(1.5m, PressureUnits.Pascal, LengthUnits.Meter);

            var pd1 = PressureDrop.FromPascalPerMeter(13.4m);

            Assert.Equal(PressureUnits.Pascal, pd1.Unit.CounterUnit);
            Assert.Equal(LengthUnits.Meter, pd1.Unit.DenominatorUnit);
        }
Пример #2
0
            CalcEdge(int iEdge, int iNode, double Pin, double Qliq, double WCT, FluidInfo fluid, bool addEdgeInfo = true)
            {
                if (addEdgeInfo)
                {
                    resEdgeInfo.Add(iEdge, new EdgeInfo(Q: Qliq, WCT: WCT, f: fluid));
                }

                var e = edges[iEdge];

                var(iNextNode, direction) = e.Next(iNode);

                var Pout = double.NaN;

                if (!double.IsNaN(Pin) && !fluid.IsEmpty)
                {
                    var root = fluid.GetPvtContext();
                    var ctx  = root.NewCtx()
                               .With(PVT.Prm.P, U.Atm2MPa(Pin))
                               .Done();

                    var gd  = new Gradient.DataInfo();
                    var GOR = root[PVT.Arg.Rsb]; // todo: what with GOR ?

                    try
                    {
                        var angleDeg = e.GetAngleDeg(nodes) * direction;
                        var P_MPa    = PressureDrop.dropLiq(ctx, gd,
                                                            D_mm: e.D, L0_m: 0, L1_m: e.L,
                                                            Roughness: 0.0,
                                                            flowDir: (PressureDrop.FlowDirection)direction,
                                                            P0_MPa: ctx[PVT.Prm.P], Qliq, WCT, GOR,
                                                            dL_m: 20, dP_MPa: 1e-4, maxP_MPa: 60, stepHandler: stepHandler, (iEdge + 1) * direction,
                                                            getTempK: (Qo, Qw, L) => 273 + 20,
                                                            getAngle: _ => angleDeg,
                                                            gradCalc: Gradient.BegsBrill.Calc,
                                                            WithFriction: false
                                                            );
                        Pout = U.MPa2Atm(P_MPa);
                    }
                    catch (Exception ex)
                    {
                        var cn = nodes[iNode];
                        var nn = nodes[iNextNode];
                        Logger.TraceInformation($"Error calc for edge A->B\tNodeA={cn.Node_ID}\tNodeB={nn.Node_ID}\tP={ctx[PVT.Prm.P]}\tQ={Qliq}\tEx={ex.Message}");
                    }
                }
                UpdateNodeInfo(iNextNode, Pout);
                return(iNextNode, Pout);
            }