示例#1
0
            public float GasViscosity;    // Вязкость газа, сПз

            public void Fill(PVT.Context ctx, Gradient.DataInfo gd, int direction)
            {
                Pressure        = (float)ctx[PVT.Prm.P].MPa2Atm();
                Temperature     = (float)ctx[PVT.Prm.T].Cel2Kel();
                OilVolumeRate   = (float)gd.Q_oil_rate * direction;
                WaterVolumeRate = (float)gd.Q_water_rate * direction;
                GasVolumeRate   = (float)gd.Q_gas_rate * direction;
                OilDensity      = (float)ctx[PVT.Prm.Rho_o];
                OilViscosity    = (float)ctx[PVT.Prm.Mu_o];
                WaterDensity    = (float)ctx[PVT.Prm.Rho_w];
                WaterViscosity  = (float)ctx[PVT.Prm.Mu_w];
                GasDensity      = (float)ctx[PVT.Prm.Rho_g] * 1000;
                GasViscosity    = (float)ctx[PVT.Prm.Mu_g];
            }
示例#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);
            }