示例#1
0
        /// <summary>
        /// Updates the values of the <see cref="Fluid"/> after an update
        /// </summary>
        protected virtual void UpdateValues()
        {
            try
            {
                if (Media.BackendType == "HEOS")
                {
                    //Mixed fluids does not have these properties
                    SoundSpeed      = REF.speed_sound();
                    MolarMass       = REF.molar_mass();
                    Compressibility = REF.compressibility_factor();
                }

                Enthalpy         = REF.hmass();
                Temperature      = REF.T();
                Pressure         = REF.p();
                Entropy          = REF.smass();
                Quality          = REF.Q();
                Density          = REF.rhomass();
                Cp               = REF.cpmass();
                Cv               = REF.cvmass();
                DynamicViscosity = REF.viscosity();
                Prandtl          = REF.Prandtl();
                SurfaceTension   = REF.surface_tension();
                InternalEnergy   = REF.umass();
                Conductivity     = REF.conductivity();
                Phase            = (Phases)REF.phase();
                FailState        = false;
            }
            catch (Exception e)
            {
                Log.Error($"SharpFluid -> UpdateValues -> {e}");
                throw new Exception("UpdateValues", e);
            }
        }
示例#2
0
        /// <summary>
        /// Updates the constants of the <see cref="Fluid"/>
        /// <br><see cref="Fluid"/> constants are Limits and Criticalpoint values</br>
        /// </summary>
        protected virtual void UpdateFluidConstants()
        {
            FailState = true;


            if (Media.BackendType == "CustomFluid")
            {
                return;
            }


            try
            {
                //Setting the constant values up
                LimitTemperatureMax = REF.Tmax();
                LimitTemperatureMin = REF.Tmin();


                if (REF.backend_name() == "HelmholtzEOSBackend")
                {
                    CriticalTemperature = REF.T_critical();
                    CriticalPressure    = REF.p_critical();
                    LimitPressureMin    = REF.p_triple();
                    LimitPressureMax    = REF.pmax();

                    //Finding H_crit
                    REF.update(input_pairs.PQ_INPUTS, CriticalPressure.Pascals, 1);
                    CriticalEnthalpy = REF.hmass();
                }

                //Fraction
                FractionMin = REF.keyed_output(parameters.ifraction_min);
                FractionMax = REF.keyed_output(parameters.ifraction_max);
            }
            catch (Exception e)
            {
                Log.Error($"SharpFluid -> UpdateFluidConstants -> {e}");
            }
        }