/// <summary> /// Initializes a new instance of the <see cref="BaseWell"/> class. /// </summary> /// <param name="data">The <see cref="SimulationData"/>.</param> /// <param name="index">The index of the block the well is located into.</param> /// <param name="type">The well type<see cref="Global.WellType"/>.</param> /// <param name="control">The well control method <see cref="Global.WellControl"/>.</param> /// <param name="radius">The well radius.</param> /// <param name="skin">The skin factor.</param> /// <param name="specifiedMinimumBHP">The specified_minimum BHP.</param> /// <param name="specifiedFlowRate">The specified flow rate.</param> /// <param name="method">The well rate method used <see cref="Global.WellRateCalculation"/>.</param> public BaseWell(SimulationData data, int index, Global.WellType type, Global.WellControl control, double radius, double skin, double specifiedMinimumBHP = 0, double specifiedFlowRate = 0, Global.WellRateCalculation method = Global.WellRateCalculation.Explicit) { this.index = index; this.type = type; this.control = control; this.method = method; data.grid[index].type = Global.BlockType.WellBlock; this.radius = radius; this.skin = skin; this.R_equivalent = GetR_Equivalent(data.grid[index], data.grid); this.WI = GetWI(data.grid[index]); this.specifiedMinimumBHP = specifiedMinimumBHP; this.specifiedFlowRate = specifiedFlowRate; if (type == Global.WellType.Injection) { this.specifiedFlowRate = -1 * specifiedFlowRate; } this.BHP = new double[Global.STEPS_MEMORY]; this.q_oil = new double[Global.STEPS_MEMORY]; this.q_free_gas = new double[Global.STEPS_MEMORY]; this.q_solution_gas = new double[Global.STEPS_MEMORY]; this.q_water = new double[Global.STEPS_MEMORY]; }
// checks "for a flow rate controlled well" if the calculated BHP falls below the input minimum value. // if so, the well control method changes from rate controlled to specific BHP controlled. private bool CheckWellControlChanged(int timeLevel) { if (control == Global.WellControl.OilRate) { if (BHP[timeLevel] < specifiedMinimumBHP) { control = Global.WellControl.BHP; return(true); } } return(false); }
private static void InitializeSCHEDULE(SimulationData data, List <string> section) { int x, y, z, well_index; double well_radius, skin_factor; Global.WellType type; Global.WellControl control = Global.WellControl.OilRate; double flow_rate, BHP; int index = section.FindIndex(line => line.Contains("WELSPECS")); string[][] WELSPECS = new string[data.wells.Length][]; for (int i = 0; i < data.wells.Length; i++) { WELSPECS[i] = Helper.GetDataAsString(section[index + 1 + i]); } index = section.FindIndex(line => line.Contains("WELCONT")); string[][] WELCONT = new string[data.wells.Length][]; for (int i = 0; i < data.wells.Length; i++) { WELCONT[i] = Helper.GetDataAsString(section[index + 1 + i]); } for (int i = 0; i < data.wells.Length; i++) { x = int.Parse(WELSPECS[i][1]) - 1; y = int.Parse(WELSPECS[i][2]) - 1; z = int.Parse(WELSPECS[i][3]) - 1; well_index = Misc.Rectangular.xyzToNatural(data.x, data.y, data.z, x, y, z); skin_factor = double.Parse(WELSPECS[i][4]); well_radius = double.Parse(WELSPECS[i][5]); type = WELCONT[i][0].Contains("PRODUCER") ? Global.WellType.Production : Global.WellType.Injection; if (type == Global.WellType.Production) { control = WELCONT[i][1] == "RATE" ? Global.WellControl.OilRate : Global.WellControl.BHP; } else if (type == Global.WellType.Injection) { control = WELCONT[i][1] == "RATE" ? Global.WellControl.GasRate : Global.WellControl.BHP; } flow_rate = double.Parse(WELCONT[i][2]); BHP = double.Parse(WELCONT[i][3]); data.wells[i] = new Well.BaseWell(data, well_index, type, control, well_radius, skin_factor, BHP, flow_rate); data.wells[i].name = WELSPECS[i][0]; } data.originalTimeStep = Helper.GetData("TSTEP", section)[0]; data.endingTime = Helper.GetData("ENDTIME", section)[0]; }