public void add_heat_constant_v(double j) { try { double new_u = internalenergy + j; double new_t = ThermoMath.iterate_t_given_v_verify_u(temperature, volume, new_u); //at this point, we have enough internal state to derive the rest internalenergy = new_u; temperature = new_t; pressure = ThermoMath.p_given_vt(volume, temperature); enthalpy = ThermoMath.h_given_vt(volume, temperature); entropy = ThermoMath.s_given_vt(volume, temperature); region = ThermoMath.region_given_pvt(pressure, volume, temperature); switch (region) { case 0: quality = 0; break; //subcooled liquid case 1: quality = ThermoMath.x_given_pv(pressure, volume); break; //two-phase region case 2: quality = 1; break; //superheated vapor } } catch (Exception e) {} clamp_state(); visualize_state(); }
void SetChallengeBall() { double volume = ThermoMath.v_given_percent(Random.Range(0.1f, 0.9f)); double temperature = ThermoMath.t_given_percent(Random.Range(0.1f, 0.9f)); double pressure = ThermoMath.p_given_vt(volume, temperature); challenge_dot.transform.localPosition = thermo.plot(pressure, volume, temperature); }