Mercurial > hg > cfcfd3
changeset 2585:37e069be9b79
app/pitot: some small changes to pitot
Just some small things which I changed while getting x3r set up
for my shot class.
I am now using the pitot_condition to get pitot pressures in the table,
and I added the flow pitot pressure to the text output below the table.
Also fixed a couple of small bugs which came to light...
author | Chris James (c.james4@uq.edu.au) |
---|---|
date | Fri, 07 Jun 2019 18:48:32 +1000 |
parents | 706906ee1d30 |
children | 627134cf3c2c |
files | app/pitot/pitot.py app/pitot/pitot_flow_functions.py app/pitot/pitot_input_utils.py app/pitot/pitot_output_utils.py |
diffstat | 4 files changed, 31 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/app/pitot/pitot.py Thu Jun 06 10:29:03 2019 +1000 +++ b/app/pitot/pitot.py Fri Jun 07 18:48:32 2019 +1000 @@ -315,7 +315,7 @@ from pitot_output_utils import * from pitot_area_ratio_check import * -VERSION_STRING = "05-Jun-2019" +VERSION_STRING = "07-Jun-2019" DEBUG_PITOT = False
--- a/app/pitot/pitot_flow_functions.py Thu Jun 06 10:29:03 2019 +1000 +++ b/app/pitot/pitot_flow_functions.py Fri Jun 07 18:48:32 2019 +1000 @@ -1589,7 +1589,7 @@ def test_section_setup(cfg, states, V, M): """Function to setup what is the test section state. It will also do the steady expansion through the nozzle if it detects that it needs to.""" - + if cfg['tunnel_mode'] == 'expansion-tube' and cfg['nozzle']: cfg['nozzle_entry_state'] = 's7' cfg['test_section_state'] = 's8' @@ -1607,7 +1607,7 @@ cfg['test_section_state'] = 's8' cfg, states, V, M == nozzle_expansion(cfg, states, V, M) elif cfg['tunnel_mode'] == 'reflected-shock-tunnel' and not cfg['nozzle']: - cfg['test_section_state'] = 's5' + cfg['test_section_state'] = 's5' return cfg, states, V, M
--- a/app/pitot/pitot_input_utils.py Thu Jun 06 10:29:03 2019 +1000 +++ b/app/pitot/pitot_input_utils.py Fri Jun 07 18:48:32 2019 +1000 @@ -448,7 +448,14 @@ print "tunnel_mode variable not set but your inputs imply non-reflected shock tube mode." print "tunnel_mode set to nr-shock-tunnel" cfg['tunnel_mode'] = 'nr-shock-tunnel' - + + valid_tunnel_modes = ['expansion-tube','nr-shock-tunnel','reflected-shock-tunnel'] + if cfg['tunnel_mode'] not in valid_tunnel_modes: + print "Chosen tunnel mode ({0}) not a valid tunnel mode value".format(cfg['tunnel_mode']) + print "Valid tunnel modes are: ".format(valid_tunnel_modes) + raise Exception, "pitot_input_utils.input_checker(): Chosen tunnel mode ({0} )not a valid tunnel mode value".format(cfg['tunnel_mode']) + print "Valid tunnel modes are: ".format(valid_tunnel_modes) + if 'area_ratio_check' not in cfg: #If they haven't told pitot to do the area ratio check, don't do it. print "Area ratio check variable not set. Setting it to false."
--- a/app/pitot/pitot_output_utils.py Thu Jun 06 10:29:03 2019 +1000 +++ b/app/pitot/pitot_output_utils.py Fri Jun 07 18:48:32 2019 +1000 @@ -313,12 +313,14 @@ p0[it_string] = states[it_string].p/1.0e6 elif clone_successful: try: - pitot[it_string] = pitot_p(state.p,M[it_string],state.gam)/1000.0 + pitot_state = pitot_condition(state, V[it_string]) + pitot[it_string] = pitot_state.p/1000.0 except: try: #try again with no ions turned on if it bails out state.with_ions = False - pitot[it_string] = pitot_p(state.p,M[it_string],state.gam)/1000.0 + pitot_state = pitot_condition(state, V[it_string]) + pitot[it_string] = pitot_state.p / 1000.0 state.with_ions = True except: # if this fails just give up and print 0.0 @@ -371,7 +373,6 @@ # store the pitot and total pressure dictionaries in the cfg file... cfg['pitot_pressures'] = pitot cfg['stagnation_pressures'] = p0 - #print the driver related stuff first @@ -489,6 +490,7 @@ states['test_section_total'] = None states['test_section_pitot'] = None cfg['stagnation_enthalpy'] = None + if cfg['stagnation_enthalpy']: if cfg['nozzle']: @@ -556,6 +558,21 @@ print u_eq_print txt_output.write(u_eq_print + '\n') + + if 'test_section_pitot' in states: + if cfg['nozzle']: + pitot_pressure_output = 'The Pitot pressure leaving the nozzle (state 8) is {0:<.5g} kPa'.format(states['test_section_pitot'].p / 1.0e3) + elif not cfg['nozzle'] and cfg['tunnel_mode'] == 'expansion-tube': + pitot_pressure_output = 'The Pitot pressure at the end of the acceleration tube (state 7) is {0:<.5g} kPa'.format(states['test_section_pitot'].p / 1.0e3) + elif not cfg['nozzle'] and cfg['tunnel_mode'] == 'nr-shock-tunnel': + pitot_pressure_output = 'The Pitot pressure at the end of the shock tube (state 2) is {0:<.5g} kPa'.format(states['test_section_pitot'].p / 1.0e3) + + # no nozzle and reflected shock tunnel doesn't need a pitot pressure output so just put pass there... + if not cfg['nozzle'] and cfg['tunnel_mode'] == 'reflected-shock-tunnel': + pass + else: + print pitot_pressure_output + txt_output.write(pitot_pressure_output + '\n') if cfg['wedge']: if 'beta_pg' in cfg: