internal FAREN(int NEq, OdeFunction Func) { this.MeNEq = NEq; this.MeY = new double[NEq]; //this.MeYDot = new double[NEq]; this.MeFunction = Func; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations) { base.InicializacionWithoutJacobiano(function, ODEType.NonStiff, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0) { base.InitializationWithoutJacobian(function, ODEType.Stiff, numEquations); this.SetInitialValues(t0, y0); }
/// <summary> /// Initializes a new instance of the OdeGearsBDF class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeGearsBDF(OdeFunction function, OdeJacobian jacobian, int numEquations) { base.InitializationWithJacobian(function, jacobian, numEquations); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations, double t0, double[] y0) { base.InitializationWithJacobian(function, jacobian, numEquations); this.SetInitialValues(t0, y0); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations, double t0, double[] y0) { this._IOut = 1; this.MeIJAC = 1; base.InitializeRungeKutta(function, jacobian, numEquations); this.SetInitialValues(t0, y0); }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { _fex = new FEX(this._NEquations, fun); _jex = new JEX(this._NEquations, jac); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0) { base.InitializeRungeKutta(function, null, numEquations); SetInitialValues(t0, y0); }
public OdeMidpoint(int dim, float step, OdeFunction function) : base(dim, step, function) { this._halfStep = this._step * 0.5f; this._yTemp = new float[this._dim]; }
internal virtual void InitializeInternal(OdeFunction function, OdeJacobian jacobian, int numEquations) { //this.MeIsInitialized = true; //if (this.MeIsInitialized == false) //{ // throw new ArgumentException("Please call the Inizialize method first."); //} this._InvokeInitializeODEs = false; this.InitializeSizeDependentVariables(numEquations); this.InitializeFunctionAndJacobian(function, jacobian); this.InitializeExceptionMessages(); }
internal abstract void InitializeFunctionAndJacobian(OdeFunction fun ,OdeJacobian jac);
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public abstract void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0);
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public abstract void InitializeODEs(OdeFunction function, int numEquations);
internal void InitializeRungeKutta(OdeFunction function, OdeJacobian jacobian, int numEquations) { //internal void InitializeRungeKutta(OdeFunction function, OdeJacobian jacobian, double[] y0, double t0, double deltaT, double tEnd) //this.TestArguments(t0, deltaT, tEnd); //this.MeT0 = t0; //this.MeY0 = y0; //this.MeTf = tEnd; this.InitializeInternal(function, jacobian, numEquations); // IOUT=2: DENSE OUTPUT IS PERFORMED IN SOLOUTR // (IN THIS CASE WORK(5) MUST BE SPECIFIED) if (this._IOut == 2) { this._IWork[4] = numEquations; } //this.SetSolutionDimension(y0, t0, deltaT, tEnd); }
public OdeEuler(int dim, float step, OdeFunction function) : base(dim, step, function) { }
/// <summary> /// Initializes a new instance of the OdeExplicitRungeKutta45 class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeExplicitRungeKutta45(OdeFunction function, int numEquations) { InitializeRungeKuttaClasses(); base.InitializeRungeKutta(function, null, numEquations); }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { _fex = new FEX(this._NEquations, fun); _jex = new JEX(this._NEquations, jac); }
/// <summary> /// Inicialize the ODE solver with a Jacobiano /// </summary> /// <param name="Func">The function that define the ODEs.</param> /// <param name="Jac">The Ode type (stiff, nonstiff).</param> /// <param name="numEquations">The number of equatins.</param> protected internal void InicializacionWithJacobiano(OdeFunction Func, OdeJacobian Jac , int numEquations) { //dvode = new DVODE(); this._IState = 1; this._UserJacobian = true; this._Type = ODEType.Stiff; base.InitializeInternal(Func, Jac, numEquations); }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { this.fvpol = new FVPOL(this._NEquations, fun); this.jvpol = new JVPOL(this._NEquations, jac); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0) { // C IOUT SWITCH FOR CALLING THE SUBROUTINE SOLOUTR: // C IOUT=0: SUBROUTINE IS NEVER CALLED // C this._IOut = 1; this.MeIJAC = 0; base.InitializeRungeKutta(function, null, numEquations); this.SetInitialValues(t0, y0); }
/// <summary> /// Initializes a new instance of the OdeAdamsMoulton class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeAdamsMoulton(OdeFunction function, int numEquations) { base.InitializationWithoutJacobian(function, ODEType.NonStiff, numEquations); this._InvokeSetInitialValues = true; }
public void ODEGearsBDFJacobian() { // Problem from chemical kinetics. Consists of the following three rate equations: // dy1/dt = -.04*y1 + 1.e4*y2*y3 // dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 // dy3/dt = 3.e7*y2**2 // on the interval from t = 0.0 to t = 4.e10, with initial conditions // y1 = 1.0, y2 = y3 = 0. The problem is stiff. //using DotNumerics.ODE double[] y = new double[3]; y[0] = 1.0; y[1] = 0.0; y[2] = 0.0; OdeFunction YDot = new OdeFunction(RateEquations); OdeJacobian jac = new OdeJacobian(JacRateEquations); OdeGearsBDF bdf = new OdeGearsBDF(YDot, jac, 3); bdf.SetInitialValues(0, y); bdf.RelTolArray[0] = 1.0E-4; bdf.RelTolArray[1] = 1.0E-4; bdf.RelTolArray[2] = 1.0E-4; bdf.AbsTolArray[0] = 1.0E-8; bdf.AbsTolArray[1] = 1.0E-14; bdf.AbsTolArray[2] = 1.0E-6; double TOut = 0.4; for (int IOUT = 1; IOUT <= 12; IOUT++) { y = bdf.Solve(TOut); ObjectDumper.Write("t = " + TOut.ToString() + " y = " + y[0].ToString() + " " + y[1].ToString() + " " + y[2].ToString()); TOut = TOut * 10.0; } //private double[] RateEquations(double t, double[] y) //{ // double[] dydt = new double[3]; // dydt[0] = -.04E0 * y[0] + 1.0E4 * y[1] * y[2]; // dydt[2] = 3.0E7 * y[1] * y[1]; // dydt[1] = -dydt[0] - dydt[2]; // return dydt; //} //public double[,] JacRateEquations(double t, double[] y) //{ // double[,] jacobian = new double[y.Length, y.Length]; // jacobian[0, 0] = -.04E0; // jacobian[0, 1] = 1.0E4 * y[2]; // jacobian[0, 2] = 1.0E4 * y[1]; // jacobian[1, 0] = .04E0; // jacobian[1, 2] = -jacobian[0, 2]; // jacobian[2, 1] = 6.0E7 * y[1]; // jacobian[1, 1] = -jacobian[0, 1] - jacobian[2, 1]; // return jacobian; //} }
internal abstract void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac);
/// <summary> /// Initializes a new instance of the OdeGearsBDF class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeGearsBDF(OdeFunction function, int numEquations) { base.InitializationWithoutJacobian(function, ODEType.Stiff, numEquations); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public abstract void InitializeODEs(OdeFunction function, int numEquations);
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations) { base.InitializationWithoutJacobian(function, ODEType.Stiff, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public abstract void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0);
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations) { base.InitializationWithJacobian(function, jacobian, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations, double t0, double[] y0) { base.InicializacionWithJacobiano(function, jacobian, numEquations); this.SetInitialValues(t0, y0); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0) { base.InicializacionWithoutJacobiano(function, ODEType.NonStiff, numEquations); this.SetInitialValues(t0, y0); }
/// <summary> /// Initializes a new instance of the OdeGearsBDF class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeGearsBDF(OdeFunction function, int numEquations) { base.InicializacionWithoutJacobiano(function, ODEType.Stiff, numEquations); }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { _Faren = new FAREN(_NEquations, fun); }
/// <summary> /// Initializes a new instance of the OdeGearsBDF class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeGearsBDF(OdeFunction function, OdeJacobian jacobian, int numEquations) { base.InicializacionWithJacobiano(function, jacobian, numEquations); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations) { base.InitializeRungeKutta(function, null, numEquations); _InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations) { base.InicializacionWithJacobiano(function, jacobian, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Initializes a new instance of the OdeAdamsMoulton class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeAdamsMoulton(OdeFunction function, int numEquations) { base.InitializationWithoutJacobian(function, ODEType.NonStiff, numEquations); _InvokeSetInitialValues = true; }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { this._Faren = new FAREN(this._NEquations, fun); }
/// <summary> /// Inicialize the ODE solver without a Jacobiano /// </summary> /// <param name="Func">The function that define the ODEs.</param> /// <param name="type">The Ode type (stiff, nonstiff).</param> /// <param name="numEquations">The number of equatins.</param> internal void InicializacionWithoutJacobiano(OdeFunction Func, ODEType type, int numEquations) { //dvode = new DVODE(); this._IState = 1; this._UserJacobian = false; this._Type = type; OdeJacobian jac = null; base.InitializeInternal(Func, jac, numEquations); }
/// <summary> /// Initializes a new instance of the OdeExplicitRungeKutta45 class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeExplicitRungeKutta45(OdeFunction function, int numEquations) { this.InitializeRungeKuttaClasses(); base.InitializeRungeKutta(function, null, numEquations); }
/// <summary> /// Initializes a new instance of the OdeImplicitRungeKutta5 class. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public OdeImplicitRungeKutta5(OdeFunction function, int numEquations) { this.InitializeRungeKuttaClasses(); // C IOUT SWITCH FOR CALLING THE SUBROUTINE SOLOUTR: // C IOUT=0: SUBROUTINE IS NEVER CALLED // C this._IOut = 1; this.MeIJAC = 0; base.InitializeRungeKutta(function, null, numEquations); }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations) { base.InitializeRungeKutta(function, null, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="jacobian">A function that evaluates the jacobian matrix.</param> /// <param name="numEquations">The number of differential equations.</param> public void InitializeODEs(OdeFunction function, OdeJacobian jacobian, int numEquations) { this._IOut = 1; this.MeIJAC = 1; base.InitializeRungeKutta(function, jacobian, numEquations); this._InvokeSetInitialValues = true; }
/// <summary> /// Method that initialize the ODE to solve. /// </summary> /// <param name="function">A function that evaluates the right side of the differential equations.</param> /// <param name="numEquations">The number of differential equations.</param> /// <param name="t0">The initial value for the independent variable.</param> /// <param name="y0">A vector of size N containing the initial conditions. N is the number of differential equations.</param> public override void InitializeODEs(OdeFunction function, int numEquations, double t0, double[] y0) { base.InitializeRungeKutta(function, null, numEquations); this.SetInitialValues(t0, y0); }
internal override void InitializeFunctionAndJacobian(OdeFunction fun, OdeJacobian jac) { this.fvpol = new FVPOL(this._NEquations, fun); this.jvpol = new JVPOL(this._NEquations, jac); }
private void button_Run_Click(object sender, EventArgs e) { /***************** Defining initial conditions **************/ d_p_i = Convert.ToDouble(textBox_d_p_i.Text) * Math.Pow(10, -6); // Initial droplet diameter [m]: T_d_i = Convert.ToDouble(textBox_T_d_i.Text); // Initial temperature of the droplet [K]: T_inf_i = Convert.ToDouble(textBox_T_inf_i.Text); // Initial temperature of the surrounding air [K]: phi_inf_i = Convert.ToDouble(textBox_phi_inf_i.Text); // Initial relative humidity of surrounding air [RH]: double V_a = Convert.ToDouble(textBox_V_a.Text) * Math.Pow(10, -3); // Volume flow rate of air [m^3/s]: double V_w = Convert.ToDouble(textBox_V_w.Text) * Math.Pow(10, -6); // Volume flow rate of water [m^3/s]: double tf = Convert.ToDouble(textBox_tf.Text); // Evaluation time double delta_t = Convert.ToDouble(textBox_delta_t.Text); // Time step /***************** Calculation of initial water vapour pressure **************/ // Saturation pressure calculation (2007, P.T. Tsilingiris) [Pa]: double p_s_i = (0.7073 - 2.7036E-2 * (T_inf_i - 273.15) + 4.3609E-3 * Math.Pow(T_inf_i - 273.15, 2) - 4.6626E-5 * Math.Pow(T_inf_i - 273.15, 3) + 1.0347E-6 * Math.Pow(T_inf_i - 273.15, 4) ) * Math.Pow(10, 3); p_inf_i = phi_inf_i * p_s_i / 100; // Initial water vapour pressure in the surrounding air [Pa]: /***************ODE Solver*********************/ OdeFunction YDot = new OdeFunction(Equation); OdeImplicitRungeKutta5 rungeKutta = new OdeImplicitRungeKutta5(YDot, 4); double[] y0 = new double[4]; y0[0] = d_p_i; y0[1] = T_d_i; y0[2] = p_inf_i; y0[3] = T_inf_i; double x0 = 0; double xf = tf; /**************Solution out********************/ /*************Error handler*********************/ this.label_Error.Text = "Error: no error"; try { sol = rungeKutta.Solve(y0, x0, delta_t, xf); //Solution identifier which is 0 if the droplets do not fully evaporate droplet_evaporated = 0; } catch { //Error lable this.label_Error.Text = "Error: Droplet evaporated"; //Solution identifier which is 1 if the droplets do fully evaporate droplet_evaporated = 1; } if (droplet_evaporated == 0) { /***************Printing number of datapoints**********/ solLength = sol.GetLength(0); string input1 = solLength.ToString(); this.textBox_number_of_data_points.Text = ""; this.textBox_number_of_data_points.Text = input1; /*********************Converting data*******************/ //Creating arrays to store datapoints tValues = new double[solLength]; d_pValues = new double[solLength]; t_dValues = new double[solLength]; p_infValues = new double[solLength]; T_infValues = new double[solLength]; //Storing datapoints in arrays for (int i = 0; i < solLength; i++) { tValues[i] = sol[i, 0]; d_pValues[i] = sol[i, 1]; t_dValues[i] = sol[i, 2]; p_infValues[i] = sol[i, 3]; T_infValues[i] = sol[i, 4]; } //Claculating evaporation percentage double evaporation = 100 - ((4 / 3 * Math.PI * Math.Pow((d_pValues[solLength - 1] * Math.Pow(10, 6)) / 2, 3)) / (4 / 3 * Math.PI * Math.Pow((d_p_i * Math.Pow(10, 6)) / 2, 3)) * 100); //Calculating relative humidity double relativeHumidity = (p_infValues[solLength - 1] / ( (0.7073 - 2.7036E-2 * (T_infValues[solLength - 1] - 273.15) + 4.3609E-3 * Math.Pow(T_infValues[solLength - 1] - 273.15, 2) - 4.6626E-5 * Math.Pow(T_infValues[solLength - 1] - 273.15, 3) + 1.0347E-6 * Math.Pow(T_infValues[solLength - 1] - 273.15, 4) ) * Math.Pow(10, 3) )) * 100; //phi_inf = (Y[2] / p_s) * 100; // Data with two decimal points double d_p_end = Math.Truncate(d_pValues[solLength - 1] * Math.Pow(10, 8)) / 100; double t_d_end = Math.Truncate(t_dValues[solLength - 1] * 100) / 100; double T_inf_end = Math.Truncate(T_infValues[solLength - 1] * 100) / 100; double T_inf_diff = Math.Truncate((T_infValues[0] - T_infValues[solLength - 1]) * 100) / 100; double p_inf_end = Math.Truncate(p_infValues[solLength - 1] * 100) / 100; double evap_end = Math.Truncate(evaporation * 100) / 100; double phi_inf_end = Math.Truncate(relativeHumidity * 100) / 100; // Printing end result string d_p_end_str = d_p_end.ToString(); string t_d_end_str = t_d_end.ToString(); string T_inf_end_str = T_inf_end.ToString(); string T_inf_diff_str = T_inf_diff.ToString(); string p_inf_end_str = p_inf_end.ToString(); string evap_end_str = evap_end.ToString(); string phi_inf_end_str = phi_inf_end.ToString(); this.textBox_d_p_end.Text = ""; this.textBox_d_p_end.Text = d_p_end_str; this.textBox_T_d_end.Text = ""; this.textBox_T_d_end.Text = t_d_end_str; this.textBox_T_inf_end.Text = ""; this.textBox_T_inf_end.Text = T_inf_end_str; this.textBox_T_inf_diff.Text = ""; this.textBox_T_inf_diff.Text = T_inf_diff_str; this.textBox_p_inf_end.Text = ""; this.textBox_p_inf_end.Text = p_inf_end_str; this.textBox_evap_end.Text = ""; this.textBox_evap_end.Text = evap_end_str; this.textBox_phi_inf_end.Text = ""; this.textBox_phi_inf_end.Text = phi_inf_end_str; //Converting datapoints to input units d_pValues_mum = new double[solLength]; multi = 1000000; for (int i = 0; i < solLength; i++) { d_pValues_mum[i] = d_pValues[i] * multi; } // Clearing charts foreach (var series in chart_all.Series) { series.Points.Clear(); } // Populating chart with datapoints for (int i = 0; i < solLength; i++) { chart_all.Series["Droplet diameter"].Points.AddXY(tValues[i], d_pValues_mum[i]); chart_all.Series["Droplet temperature"].Points.AddXY(tValues[i], t_dValues[i]); } // Setting Y-axis values on upper chart chart_all.ChartAreas[0].AxisY.Maximum = d_pValues_mum[0] + (d_pValues_mum[0] / 10); chart_all.ChartAreas[0].AxisY.Minimum = d_pValues_mum[solLength - 1] - (d_pValues_mum[solLength - 1] / 10); // Setting Y-axis values on lower chart chart_all.ChartAreas[1].AxisY.Maximum = T_inf_i + (T_inf_i / 100); chart_all.ChartAreas[1].AxisY.Minimum = t_dValues[solLength - 1] - (t_dValues[solLength - 1] / 100); // Setting axis decimals and lable on upper chart chart_all.ChartAreas[0].AxisX.LabelStyle.Format = "#.#"; chart_all.ChartAreas[0].AxisY.LabelStyle.Format = "#"; chart_all.ChartAreas[0].AxisX.Title = "Time [s]"; chart_all.ChartAreas[0].AxisY.Title = "Droplet diameter [μm]"; // Setting axis decimals and lable on lower chart chart_all.ChartAreas[1].AxisX.LabelStyle.Format = "#.#"; chart_all.ChartAreas[1].AxisY.LabelStyle.Format = "#"; chart_all.ChartAreas[1].AxisX.Title = "Time [s]"; chart_all.ChartAreas[1].AxisY.Title = "Droplet temperature [K]"; } else { //Printing N/A in the result boxes this.textBox_d_p_end.Text = ""; this.textBox_d_p_end.Text = "N/A"; this.textBox_T_d_end.Text = ""; this.textBox_T_d_end.Text = "N/A"; this.textBox_T_inf_end.Text = ""; this.textBox_T_inf_end.Text = "N/A"; this.textBox_p_inf_end.Text = ""; this.textBox_p_inf_end.Text = "N/A"; this.textBox_evap_end.Text = ""; this.textBox_evap_end.Text = "N/A"; this.textBox_phi_inf_end.Text = ""; this.textBox_phi_inf_end.Text = "N/A"; this.textBox_number_of_data_points.Text = ""; this.textBox_number_of_data_points.Text = "N/A"; // Clearing charts foreach (var series in chart_all.Series) { series.Points.Clear(); } } }