Mercurial > hg > cfcfd3
changeset 2581:97dba0f60c6d
app/pitot: fixed state 10 velocity issues
state 10 should really have shock steady velocities as the shock
is stopped around the model, was an old bug. Fixed this and the
related Reynolds number calcs. Also added unit Reynolds number
to normal output.
author | Chris James <c.james4@uq.edu.au> |
---|---|
date | Mon, 03 Jun 2019 11:34:51 +1000 |
parents | 0088711aecbf |
children | 101e2b77a77a |
files | app/pitot/pitot.py app/pitot/pitot_flow_functions.py app/pitot/pitot_output_utils.py |
diffstat | 3 files changed, 71 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/app/pitot/pitot.py Fri May 31 12:21:10 2019 +1000 +++ b/app/pitot/pitot.py Mon Jun 03 11:34:51 2019 +1000 @@ -315,7 +315,7 @@ from pitot_output_utils import * from pitot_area_ratio_check import * -VERSION_STRING = "31-May-2019" +VERSION_STRING = "03-Jun-2019" DEBUG_PITOT = False
--- a/app/pitot/pitot_flow_functions.py Fri May 31 12:21:10 2019 +1000 +++ b/app/pitot/pitot_flow_functions.py Mon Jun 03 11:34:51 2019 +1000 @@ -1876,7 +1876,11 @@ if 's10f' in states.keys(): try: - (V10, V['s10f']) = shock_ideal(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10f']) + # here because the model in the tunnel is stationary, this is one + # of the places where the correct value to store is actually the + # shock steady value, which is the first velocity returned by the function + # changing this is fixing quite an old 'bug' in the code - CMJ 03/06/19 + (V['s10f'], V10fg) = shock_ideal(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10f']) M['s10f']= V['s10f']/states['s10f'].a except Exception as e: print "Error {0}".format(str(e)) @@ -1936,7 +1940,12 @@ try: # I added the normal shock wrapper here as I was having some issues with these shocks bailing out.. # This mean that I could remove anything here to catch the shocks too, as that is done in the wrapper - (V10, V['s10e']) = normal_shock_wrapper(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10e']) + + # here because the model in the tunnel is stationary, this is one + # of the places where the correct value to store is actually the + # shock steady value, which is the first velocity returned by the function + # changing this is fixing quite an old 'bug' in the code - CMJ 03/06/19 + (V['s10e'], V10eg) = normal_shock_wrapper(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10e']) M['s10e']= V['s10e']/states['s10e'].a #print states['s10e'].species except Exception as e: @@ -1945,7 +1954,7 @@ if cfg['gas_guess']: print "Will try again with a high temperature gas guess." try: - (V10, V['s10e']) = normal_shock_wrapper(states[cfg['test_section_state']], + (V['s10e'], V10eg) = normal_shock_wrapper(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10e'], cfg['gas_guess']) M['s10e']= V['s10e']/states['s10e'].a @@ -1970,7 +1979,11 @@ states['s10e'].onlyList = current_species print states[cfg['test_section_state']].onlyList print states['s10e'].onlyList - (V10, V['s10e']) = normal_shock(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10e']) + # here because the model in the tunnel is stationary, this is one + # of the places where the correct value to store is actually the + # shock steady value, which is the first velocity returned by the function + # changing this is fixing quite an old 'bug' in the code - CMJ 03/06/19 + (V['s10e'], V10eg) = normal_shock(states[cfg['test_section_state']], V[cfg['test_section_state']], states['s10e']) M['s10e']= V['s10e']/states['s10e'].a states[cfg['test_section_state']].onlyList = old_onlyList states['s10e'].onlyList = old_onlyList @@ -1994,7 +2007,11 @@ states[cfg['test_section_state']+'eq'].set_pT(states[cfg['test_section_state']].p,states[cfg['test_section_state']].T) states['s10e'] = states[cfg['test_section_state']+'eq'].clone() try: - (V10, V['s10e']) = normal_shock(states[cfg['test_section_state']+'eq'], V[cfg['test_section_state']], states['s10e']) + # here because the model in the tunnel is stationary, this is one + # of the places where the correct value to store is actually the + # shock steady value, which is the first velocity returned by the function + # changing this is fixing quite an old 'bug' in the code - CMJ 03/06/19 + (V['s10e'],V10eg) = normal_shock_wrapper(states[cfg['test_section_state']+'eq'], V[cfg['test_section_state']], states['s10e']) M['s10e']= V['s10e']/states['s10e'].a except Exception as e: print "Error {0}".format(str(e)) @@ -2547,14 +2564,10 @@ cfg['rho_l_product_state10e'] = states['s10e'].rho*cfg['representative_length_scale'] cfg['pressure_l_product_state10e'] = states['s10e'].p*cfg['representative_length_scale'] - - cfg['V10e_shock_reference'] = V[cfg['test_section_state']] - V['s10e'] - cfg['reynolds_number_state10e'] = (states['s10e'].rho*cfg['V10e_shock_reference']*cfg['representative_length_scale'])/ states['s10e'].mu + cfg['reynolds_number_state10e'] = (states['s10e'].rho*V['s10e']*cfg['representative_length_scale'])/ states['s10e'].mu - cfg['M10e_shock_reference'] = cfg['V10e_shock_reference']/ states['s10e'].a - - cfg['knudsen_number_state10e'] = (cfg['M10e_shock_reference']/cfg['reynolds_number_state10e'])*math.sqrt(states['s10e'].gam*math.pi/2.0) + cfg['knudsen_number_state10e'] = (M['s10e']/cfg['reynolds_number_state10e'])*math.sqrt(states['s10e'].gam*math.pi/2.0) return cfg
--- a/app/pitot/pitot_output_utils.py Fri May 31 12:21:10 2019 +1000 +++ b/app/pitot/pitot_output_utils.py Mon Jun 03 11:34:51 2019 +1000 @@ -588,10 +588,38 @@ rst_3 = '{0}'.format(states['s5'].species) print rst_3 - txt_output.write(rst_3 + '\n') - - #added ability to get the species in the post-shock condition - + txt_output.write(rst_3 + '\n') + + freestream_mu_string = 'Using a freestream ({0}) dynamic viscosity (mu) of {1:.4e} Pa.s.'.format( + cfg['test_section_state'], + states[cfg['test_section_state']].mu) + + print freestream_mu_string + txt_output.write(freestream_mu_string + '\n') + + cfg['unit_reynolds_number_freestream'] = (states[cfg['test_section_state']].rho*V[cfg['test_section_state']])/ states[cfg['test_section_state']].mu + + unit_reynolds_number_freestream_print = "Freestream ({0}) unit Reynolds number is {1:.2f}/m.".format(cfg['test_section_state'], + cfg['unit_reynolds_number_freestream']) + + print unit_reynolds_number_freestream_print + txt_output.write(unit_reynolds_number_freestream_print + '\n') + + if cfg['shock_over_model'] and 's10e' in states: + state10e_mu_string = 'Using a test section post normal shock eq (s10e) dynamic viscosity (mu) of {0:.4e} Pa.s.'.format( + states['s10e'].mu) + + print state10e_mu_string + txt_output.write(state10e_mu_string + '\n') + + cfg['unit_reynolds_number_state10e'] = (states['s10e'].rho * V['s10e'] ) / states['s10e'].mu + + unit_reynolds_number_state10e_print = "Test section post normal shock eq (s10e) unit Reynolds number is {0:.2f}/m.".format( + cfg['unit_reynolds_number_state10e']) + + print unit_reynolds_number_state10e_print + txt_output.write(unit_reynolds_number_state10e_print + '\n') + if cfg['calculate_scaling_information']: scaling_intro = "Calculating scaling information for a represenative length scale of {0:.4f} m.".format(cfg['representative_length_scale']) print scaling_intro @@ -636,38 +664,29 @@ pressure_l_product_state10e_print = "Test section post normal shock eq (s10e) pL product is {0:.4f} Pa.m.".format(cfg['pressure_l_product_state10e']) print pressure_l_product_state10e_print - txt_output.write(pressure_l_product_state10e_print + '\n') - - V10e_print = 'Test section post normal shock (s10e) velocity in the shock reference frame is {0:.2f} m/s.'.format(cfg['V10e_shock_reference']) - - print V10e_print - txt_output.write(V10e_print + '\n') - - V10e_print_2 = 'This velocity will be used to calculate the Reynolds number below.' - - print V10e_print_2 - txt_output.write(V10e_print_2 + '\n') + txt_output.write(pressure_l_product_state10e_print + '\n') reynolds_number_state10e_print = "Test section post normal shock eq (s10e) Reynolds number is {0:.4f}.".format(cfg['reynolds_number_state10e']) print reynolds_number_state10e_print txt_output.write(reynolds_number_state10e_print + '\n') - - M10e_print = 'Test section post normal shock (s10e) Mach number in the shock reference frame is {0:.2f}.'.format(cfg['M10e_shock_reference']) - - print M10e_print - txt_output.write(M10e_print + '\n') - - M10e_print_2 = 'This Mach number will be used to calculate the Knudsen number below.' - - print M10e_print_2 - txt_output.write(M10e_print_2 + '\n') - + knudsen_number_state10e_print = "Test section post normal shock eq (s10e) Knudsen number is {0:.4e}.".format(cfg['knudsen_number_state10e']) print knudsen_number_state10e_print - txt_output.write(knudsen_number_state10e_print + '\n') + txt_output.write(knudsen_number_state10e_print + '\n') + # if solver in ['eq','pg-eq']: + # freestream_species1 = 'Species in the freestream state ({0}) at equilibrium (by {1}):'.format(cfg['test_section_state'], + # states[cfg['test_section_state']].outputUnits) + # print freestream_species1 + # txt_output.write(freestream_species1 + '\n') + # + # freestream_species2 = '{0}'.format(states[cfg['test_section_state']].species) + # print freestream_species2 + # txt_output.write(freestream_species2 + '\n') + + # added ability to get the species in the post-shock condition # last bit is just to make sure that state 10e is actually an equilibrium state like it always should be! if cfg['shock_over_model'] and 's10e' in states.keys() and isinstance(states['s10e'], Gas): species1 = 'Species in the shock layer at equilibrium (s10e) (by {0}):'.format(states['s10e'].outputUnits)