Mercurial > hg > cfcfd3
changeset 2542:a20d91d034c9
app/pitot: very small changes to pitot_output_utils and pitot_flow_functions
there was a bug in pitot_output_utils.py where if the stag_temp wasn't found,
it would try to print it anyway, causing the code to crash...
there was also a bug in pitot_flow_functions where if the two initial
Vs2 guesses in the acc tube failed, it would set them to guess_1 + 1000,
and guess_2 + 1000 and try again. This is fine, however guess_2 is already
guess_1 + 1000, so if guess_2 caused the failure, it will be the new
guess_2 and will fail again. Now the code sets them to guess_1 + 1500
and guess_2 + 1500 so this can't happen
author | Chris James <c.james4@uq.edu.au> |
---|---|
date | Mon, 31 Jul 2017 12:38:32 +1000 |
parents | b69d00697b5e |
children | 1cf76b020031 |
files | app/pitot/pitot.py app/pitot/pitot_flow_functions.py app/pitot/pitot_output_utils.py |
diffstat | 3 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/app/pitot/pitot.py Tue Jul 25 16:55:57 2017 +1000 +++ b/app/pitot/pitot.py Mon Jul 31 12:38:32 2017 +1000 @@ -314,7 +314,7 @@ from pitot_output_utils import * from pitot_area_ratio_check import * -VERSION_STRING = "25-Jul-2017" +VERSION_STRING = "31-Jul-2017" DEBUG_PITOT = False
--- a/app/pitot/pitot_flow_functions.py Tue Jul 25 16:55:57 2017 +1000 +++ b/app/pitot/pitot_flow_functions.py Mon Jul 31 12:38:32 2017 +1000 @@ -641,9 +641,10 @@ except Exception as e: print "{0}: {1}".format(type(e).__name__, e.message) print "Shock tube secant solver failed. Will try again with higher initial guesses." + cfg['Vs1_guess_1'] += 2000.0; cfg['Vs1_guess_2'] += 2000.0 print "New guesses are: 'Vs1_guess_1' = {0} m/s and 'Vs1_guess_2' = {1} m/s".\ - format(cfg['Vs1_guess_1'] + 2000.0, cfg['Vs1_guess_2'] + 2000.0) - cfg['Vs1_guess_1'] += 2000.0; cfg['Vs1_guess_2'] += 2000.0 + format(cfg['Vs1_guess_1'], cfg['Vs1_guess_2']) + try: cfg['Vs1'] = secant(error_in_velocity_shock_tube_expansion_shock_speed_iterator, @@ -1262,9 +1263,9 @@ format(last_guess - 100.0, last_guess + 100.0) cfg['Vs2_guess_1'] = last_guess - 100.0; cfg['Vs2_guess_2'] = last_guess + 100.0 else: + cfg['Vs2_guess_1'] += 1500.0; cfg['Vs2_guess_2'] += 1500.0 print "New guesses are: 'Vs2_guess_1' = {0} m/s and 'Vs2_guess_2' = {1} m/s".\ - format(cfg['Vs2_guess_1'] + 1000.0, cfg['Vs2_guess_2'] + 1000.0) - cfg['Vs2_guess_1'] += 1000.0; cfg['Vs2_guess_2'] += 1000.0 + format(cfg['Vs2_guess_1'], cfg['Vs2_guess_2']) try: cfg['Vs2'] = secant(error_in_pressure_s2_expansion_shock_speed_iterator, cfg['Vs2_guess_1'], cfg['Vs2_guess_2'],
--- a/app/pitot/pitot_output_utils.py Tue Jul 25 16:55:57 2017 +1000 +++ b/app/pitot/pitot_output_utils.py Mon Jul 31 12:38:32 2017 +1000 @@ -506,8 +506,8 @@ elif not cfg['nozzle'] and cfg['tunnel_mode'] == 'reflected-shock-tunnel': stag_temp = 'The total temperature (Tt) in the stagnated region (state 5) is {0:<.5g} K.'.format(states['test_section_total'].T) - print stag_temp - txt_output.write(stag_temp + '\n') + print stag_temp + txt_output.write(stag_temp + '\n') # I'm going to add freestream enthalpy (just the h component) to the output also # (take away the initial enthalpy in state 1 to get the change) @@ -538,7 +538,7 @@ cfg['u_eq'] = math.sqrt(2.0*cfg['stagnation_enthalpy']) u_eq_print = 'The flight equivalent velocity (Ue) is {0:<.5g} m/s.'.format(cfg['u_eq']) else: - u_eq_print = "Unable to find equivalent velocity as stagnation enthalpy could not be found." + u_eq_print = "Unable to find flight equivalent velocity as stagnation enthalpy could not be found." cfg['u_eq'] = None print u_eq_print