I'm working on a C# program that getting some values from textboxes and set them to some variables in 2 class that their name is:"Tfluid"
and "Twell"
then I use them in another class the name is "Tcalc" through a method with name "fluidcal"
and make some calculations with them,
I have 2 crossed while
that means it starts with a "ql"
and then match a final P
to each "ql"
. now I want to use these (ql, P)
to plot a graph in another form,
so what is the best way of saving them (i don't know what should I return with the fluidal method)
and how can I add them to the chart?
this is my calculation process
public double Fluidcal(TWell well, TFluid fluid)
{
double froudnumber, noslipholdup, vm, vsl, vsg, liquidvelocitynumber, l1, l2, l3, l4, fluidregim, hozhold, C, psy, liqhold, liqholdseg, liqholdinter, fn, nren, densityn, viscosityn, y, S, ftp, dpdzel, dpdzf, dpperdzt, rhos, Ek,ql;
ql = 1;
while (ql<=fluid.maxoilflowrate)
{
vsl = (ql) / Math.PI * Math.Pow(well.tubingdiameter / 2, 2); //superficial velocities
vsg = (ql * fluid.gor) / Math.PI * Math.Pow(well.tubingdiameter / 2, 2);
vm = vsl + vsg;
double nowlength = 0;
double P = well.wellheadpressure;
while (nowlength <= well.welldepth)
{
froudnumber = Math.Pow(vm, 2) / well.tubingdiameter * 32.174; //froud number
noslipholdup = vsl / vm; //no slip holdup
double newoildensity = fluid.oildensity / (1 + 0.00056 * (0.01515 * nowlength));
liquidvelocitynumber = vsl * Math.Pow((newoildensity / 32.174 * fluid.gasliquidsurfacetension), 0.25); //liquid velocity number
//correlating parametrs
l1 = 316 * Math.Pow(noslipholdup, 0.302);
l2 = 0.0009252 * Math.Pow(noslipholdup, -2.4684);
l3 = 0.1 * Math.Pow(noslipholdup, -1.4516);
l4 = 0.5 * Math.Pow(noslipholdup, -6.738);
fluidregim = 0;
C = 0;
liqhold = 0;
if ((noslipholdup < 0.01 && froudnumber < l1) || (noslipholdup >= 0.01 && froudnumber < l2))
{
segregated(froudnumber, noslipholdup, liquidvelocitynumber, out fluidregim, out hozhold, out C, out psy, out liqhold);
}
else if ((noslipholdup >= 0.01 && l2 < froudnumber && froudnumber <= l3))
{
transition(froudnumber, noslipholdup, liquidvelocitynumber, l2, l3, out fluidregim, out hozhold, out C, out psy, out liqhold, out liqholdseg, out liqholdinter);
}
else if ((noslipholdup >= 0.01 && noslipholdup < 0.4 && froudnumber > l3 && froudnumber <= l1)
|| (noslipholdup >= 0.4 && l3 < froudnumber && froudnumber <= 4))
{
intermittent(froudnumber, noslipholdup, liquidvelocitynumber, out fluidregim, out hozhold, out C, out psy, out liqhold);
}
else if ((noslipholdup < 0.4 && froudnumber >= l1) || (noslipholdup >= 0.4 && froudnumber > l4))
{
disturbuted(froudnumber, noslipholdup, out fluidregim, out hozhold, out C, out psy, out liqhold);
}
// else
// {
// System.Windows.Forms.MessageBox.Show("Undefined Flow Regim");
//}
y = noslipholdup / Math.Pow(liqhold, 2);
if (y > 1 && y < 1.2)
{
S = Math.Log(2.2 * y - 1.2);
}
else
{
S = (Math.Log(y)) / (-0.0523 + 3.182 * Math.Log(y) - 0.8725 * Math.Pow(Math.Log(y), 2) + 0.01853 * Math.Pow(Math.Log(y), 4));
}
viscosityn = fluid.oilviscosity * noslipholdup + fluid.gasviscosity * (1 - noslipholdup);
densityn = fluid.oildensity * noslipholdup + (1 - noslipholdup) * fluid.gasdensity;
nren = densityn * vm * (well.tubingdiameter) / viscosityn;
fn = 1 / Math.Pow((2 * Math.Log(nren / (4.5223 * Math.Log(nren) - 3.8215))), 2);
ftp = fn * Math.Exp(S);
rhos = fluid.oildensity * liqhold + fluid.gasdensity * (1 - liqhold);
Ek = rhos * vm * vsg / 32.2 * P;
dpdzel = (1) * rhos;
dpdzf = ftp * densityn * Math.Pow(vm, 2) / 2 * 32.174 * well.tubingdiameter;
dpperdzt = (dpdzel + dpdzf) / 1 - Ek;
P = P + 5 * dpperdzt;
yax.Add(P);
nowlength = +5;
vsl = vm * liqhold;
vsg = vsl * fluid.gor;
}
ql = +20;
}return; //what should I write here?I want pairs of(ql,P)