changeset 2559:993be144ce8a

app/pitot: changes to pitot to fix some bugs it turns out that the condition builder no longer worked in nr-shock-tunnel mode due to a bug with the test time calculation being added, fixed now. my changes to get the proper eq mode working with CO2 didn't work in experiment mode, so I fixed that too
author Chris James <c.james4@uq.edu.au>
date Thu, 11 Jan 2018 19:08:05 +1000
parents 34f1dcd1363e
children 2719d01b748e
files app/pitot/pitot.py app/pitot/pitot_condition_builder.py app/pitot/pitot_flow_functions.py
diffstat 3 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/app/pitot/pitot.py	Thu Jan 04 19:06:21 2018 +1000
+++ b/app/pitot/pitot.py	Thu Jan 11 19:08:05 2018 +1000
@@ -314,7 +314,7 @@
 from pitot_output_utils import *
 from pitot_area_ratio_check import *
 
-VERSION_STRING = "04-Jan-2018"
+VERSION_STRING = "11-Jan-2018"
 
 DEBUG_PITOT = False
 
--- a/app/pitot/pitot_condition_builder.py	Thu Jan 04 19:06:21 2018 +1000
+++ b/app/pitot/pitot_condition_builder.py	Thu Jan 11 19:08:05 2018 +1000
@@ -10,7 +10,7 @@
 
 """
 
-VERSION_STRING = "25-Jul-2017"
+VERSION_STRING = "10-Jan-2017"
 
 import sys
 
@@ -399,7 +399,7 @@
             else:
                 print "Extra variable {0} was already in the results dict.".format(variable)
                 
-    if cfg['facility'] == 'x2':
+    if cfg['tunnel_mode'] == 'expansion-tube' and cfg['facility'] == 'x2':
         # calculate the basic test time also
         full_list += ['basic_test_time'] # microseconds
         
@@ -539,10 +539,15 @@
         print "Error {0}".format(str(e))        
         print "Test {0} failed. Result will not be printed to csv output.".format(cfg['test_number'])
         condition_status = False
-    if cfg['secondary'] and cfg['Vsd'] > cfg['Vs1']:
+    if cfg['secondary'] and not cfg['rs_out_of_sd'] and cfg['Vsd'] > cfg['Vs1']:
         print "Vsd is faster than Vs1, condition cannot be simulated by Pitot properly."
         print "Test {0} is considered failed, and result will not be printed to csv output.".format(cfg['test_number'])
         condition_status = False
+    if cfg['secondary'] and cfg['rs_out_of_sd'] and 'V' in locals() and V['sd2r'] > V['s3']:
+        print "Vsd2r is faster than V3, condition cannot be simulated by Pitot properly"
+        print "as the reflected shock should have been stronger to stop a non-physical unsteady compression occuring."
+        print "Test {0} is considered failed, and result will not be printed to csv output.".format(cfg['test_number'])
+        condition_status = False
     if condition_status:
         print "Simulation {0} was successful. Result will be added to the output.".format(cfg['test_number'])
         results = add_new_result_to_results_dict(cfg, states, V, M, results)
@@ -1161,7 +1166,7 @@
         for variable in results['extra_variables']:
             results[variable].append(cfg[variable])
             
-    if cfg['facility'] == 'x2':
+    if cfg['tunnel_mode'] == 'expansion-tube' and cfg['facility'] == 'x2':
         results['basic_test_time'].append(cfg['t_test_basic']*1.0e6)
                      
     return results
--- a/app/pitot/pitot_flow_functions.py	Thu Jan 04 19:06:21 2018 +1000
+++ b/app/pitot/pitot_flow_functions.py	Thu Jan 11 19:08:05 2018 +1000
@@ -713,8 +713,23 @@
             
     # if we run experiment based modes, we can just pop in here...
     if cfg['solver'] in ['eq', 'pg']:
-        # do a clone of state 1 here so we don't get floating point jumping around...
-        state1 = states['s1'].clone()    
+        # do a clone of state 1 here so we don't get a lot of floating point jumping around
+        # if the pressure is too low...
+        # we need to do some weird stuff here if we are in eq mode with CO2 in the test gas,
+        # (which is made even worse by being in a function, I chose to check if it has a reactants
+        # dict to check if it is eq, and then if CO2 is in that dict...)
+        # but this is simple otherwise...
+        if hasattr(states['s1'], 'reactants') and 'CO2' in states['s1'].reactants:
+            states['s1'].onlyList = states['s1'].reactants
+            states['s1'].with_ions = False
+            state1 = states['s1'].clone()
+            state1.onlyList = []
+            state1.with_ions = True
+            states['s1'].onlyList = []
+            states['s1'].with_ions = True
+        else:
+            state1 = states['s1'].clone()
+
         # first do the normal shock
         try:
             if cfg['gas_guess']: