Ejemplo n.º 1
0
    public static double vvap_given_p(double p)
    {
        double ret_val;

        try
        {
            ret_val = 1.0 / IF97.rhovap_p(p / 1000000.0); //expects:MPa returns Kg/M^3
            return(ret_val);
        }
        catch (Exception ex)
        {
            Debug.Log(String.Format("Got an exception: {0}\nReturning {1}", ex.Message, v_neutral));
            got_error = true;
            return(v_neutral);
        }
        //return 1.0/IF97.rhovap_p(p/1000000.0); //expects:MPa returns Kg/M^3
    }
Ejemplo n.º 2
0
    public static double x_given_pv(double p, double v) //ONLY USE IN VAPOR DOME
    {
        double ret_val;

        try
        {
            //f means saturated liquid,
            //g means saturated gas
            double vf = 1.0 / IF97.rholiq_p(p / 1000000.0);
            double vg = 1.0 / IF97.rhovap_p(p / 1000000.0);
            ret_val = (v - vf) / (vg - vf); //UNIT CONVERSION UNTESTED!
            return(ret_val);
        }
        catch (Exception ex)
        {
            Debug.Log(String.Format("Got an exception: {0}\nReturning {1}", ex.Message, x_neutral));
            got_error = true;
            return(x_neutral);
        }
        //return (v-vf)/(vg-vf); //UNIT CONVERSION UNTESTED!
    }
Ejemplo n.º 3
0
    //a bunch of options for getting region here- still need to figure out most reliable
    //region: 0 subcooled liquid, 1 two-phase, 2 superheated vapor
    public static int region_given_pvt(double p, double v, double t)
    {
        int liq   = 0;
        int two   = 1;
        int vapor = 2;

        //broad check w/ t
        if (t - t_smallstep > IF97.Tsat97(p / 1000000.0))
        {
            return(vapor);
        }
        if (t + t_smallstep < IF97.Tsat97(p / 1000000.0))
        {
            return(liq);
        }

        //broad check w/ p - unneeded
        //if(p-p_smallstep > IF97.psat97(t)) return liq;
        //if(p+p_smallstep < IF97.psat97(t)) return vapor;

        //fine check w/ v
        //f means saturated liquid,
        //g means saturated gas
        double vf = 1.0 / IF97.rholiq_p(p / 1000000.0);

        if (v <= vf)
        {
            return(liq);
        }
        double vg = 1.0 / IF97.rhovap_p(p / 1000000.0);

        if (v >= vg)
        {
            return(vapor);
        }
        return(two);
    }