changeset 2587:1a0cb8716c66

app/pitot: fixed bug which caused rs calculation to fail the normal_shock_wrapper stuff which I made didn't work for the reflected shock, so I added some of that to the rs_calculation function could do more there, but that is for another day, fixed a small issue...
author Chris James (c.james4@uq.edu.au)
date Tue, 11 Jun 2019 19:28:59 +1000
parents 627134cf3c2c
children 23f78eeddb57
files app/pitot/pitot_flow_functions.py
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/pitot/pitot_flow_functions.py	Tue Jun 11 17:22:38 2019 +1000
+++ b/app/pitot/pitot_flow_functions.py	Tue Jun 11 19:28:59 2019 +1000
@@ -1559,7 +1559,18 @@
     #first build state 5 as a clone of state 2
     states['s5'] = states['s2'].clone()
     # then perform the reflected shock
-    cfg['Vr'] = reflected_shock(states['s2'], V['s2'], states['s5'])
+    try:
+        cfg['Vr'] = reflected_shock(states['s2'], V['s2'], states['s5'])
+    except Exception as e:
+
+        print "{0}: {1}".format(type(e).__name__, e.message)
+
+        if e.message == "gas_flow.normal_shock() Newton-Rhapson solve did not converge after maximum iterations.":
+            print "Newton-Raphson solver did not converge in the reflected shock calculation."
+            print "Will try again with V2 as V2 + 0.1."
+
+            cfg['Vr'] = reflected_shock(states['s2'], V['s2']+0.1, states['s5'])
+
     cfg['Mr'] = (V['s2']+cfg['Vr'])/states['s2'].a #normally this would be V2 - Vr, but it's plus here as Vr has been left positive
     V['s5'] = 0.0
     M['s5']= V['s5']/states['s5'].a
@@ -1568,7 +1579,18 @@
     
     states['s5_d'] = states['s3'].clone()
     # then perform the reflected shock
-    cfg['Vr_d'] = reflected_shock(states['s3'], V['s3'], states['s5_d'])
+    try:
+        cfg['Vr_d'] = reflected_shock(states['s3'], V['s3'], states['s5_d'])
+    except Exception as e:
+
+        print "{0}: {1}".format(type(e).__name__, e.message)
+
+        if e.message == "gas_flow.normal_shock() Newton-Rhapson solve did not converge after maximum iterations.":
+            print "Newton-Raphson solver did not converge in the driver gas reflected shock calculation."
+            print "Will try again with V3 as V3 + 0.1."
+
+            cfg['Vr_d'] = reflected_shock(states['s3'], V['s3']+0.1, states['s5_d'])
+
     cfg['Mr_d'] = (V['s3']+cfg['Vr_d'])/states['s3'].a #normally this would be V2 - Vr, but it's plus here as Vr has been left positive
     V['s5_d'] = 0.0
     M['s5_d']= V['s5_d']/states['s5_d'].a
@@ -2615,7 +2637,7 @@
                 Vs += 0.1
                     
             elif e.message == "gas_flow.normal_shock() Newton-Rhapson solve did not converge after maximum iterations.":
-                print "Newton-Raphson solder did not converge in the normal shock calculation."
+                print "Newton-Raphson solver did not converge in the normal shock calculation."
                 print "Will try again with Vs as Vs + 0.1."
                 failure_counter += 1
                 Vs += 0.1