Is this possible? I have a basic equation:
Q = (pi*(Ta-Ts))/(((1/ha*Do))+(1/(2*k))*math.log(Do/Di)) * L
where;
ha = 8.14
k = 0.0026
Do = 0.2
Di = 0.003175
L = 0.25
F = 0.0704
Ta = 293
Ts = 113
pi = 3.14159265
I want to see how some of the variables affect the final output (and build a variable sensitivity table). I've already managed this in a graph format, but would like some descriptive statistics.
For example, I want to have Do (outer diameter) as a range np.arange(0.1,2,100) and keep the other variables constant.
I have the following code for creating some plots of this:
def enthalpy_mod1(ambient_temp, LNG_temp, Flow):
ha = 8.14
k = 0.0026
Do = 0.2
Di = 0.003175
L = 0.25
F = Flow
Ta = ambient_temp
Ts = LNG_temp
pi = 3.14159265
Q = (pi*(Ta-Ts))/(((1/ha*Do))+(1/(2*k))*math.log(Do/Di)) * L
e = (Q*3600)/F
results.append(e) # append the result to the empty list
df['Enthalpy Result']= e
plt.plot(Flow, e)
plt.rcParams.update({'font.size': 12})
plt.annotate('Flow rate effects', xy =(0.1,14000))
plt.show()
print df
print Flow_mod(df['Temp'], df['LNG'], df['Flow'])
ambient_temp = [293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,293]
Flow = np.linspace(0.04, 0.2, 18)
LNG_range = [113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113]
results = []
and put the results in a dataframe.. and plotting that way.
Sensitivity analysis is a methodology in itself so it should be independent of the language (of course you know that, just making a point) so you could just implement algorithms in python yourself. BUT as you asked about python, yes, people have done that. Take a look at SALib, a Python library for performing global sensitivity analyses with a variety of different methods.
The method you described moves one parameter at a time. This is a local sensitivity analysis and will not give you insights into interaction effects between variables, nor will you be able to measure non-linear effects in context. Given that your equation is quite simple, this may not matter, but this is very important in more complex models.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With