Open andreaperin opened 3 months ago
The phys.api.jet_flame_analysis
method is a wrapper. If you are doing analyses in the python backend, I would encourage you to look into the details of what that wrapper is doing. You are right, there can be overhead when using that wrapper.
Doing multiple flame analyses is fairly straightforward. One would create one or multiple upstream Fluid objects, one or multiple Orifice objects, an ambient (or possibly multiple) Fluid object(s), and then generate multiple Flame objects that would have the information in them.
Simple example:
import hyram
air = hyram.phys.Fluid('air', P = 101325, T = 295)
orifice = hyram.phys.Orifice(d = 0.001)
flames = []
for P in [10, 20]:
H2 = hyram.phys.Fluid('H2', P = P*1e5, T = 295)
flames.append(hyram.phys.Flame(H2, orifice, air))
for flame in flames:
print(f'for an upstream pressure of {flame.fluid.P/1e5:.0f} bar, the flame will be {flame.length():.2f} m long')
for an upstream pressure of 10 bar, the flame will be 0.42 m long
for an upstream pressure of 20 bar, the flame will be 0.59 m long
for flame in flames:
print(f'for an upstream pressure of {flame.fluid.P/1e5:.0f} bar, the heat flux at 3m, 3m, 3m is {flame.Qrad_multi(3,3,3, RH = .9):.2f} W/m^2')
for an upstream pressure of 10 bar, the heat flux at 3m, 3m, 3m is 2.96 W/m^2
for an upstream pressure of 20 bar, the heat flux at 3m, 3m, 3m is 6.88 W/m^2
I am inquiring about the function:
jet_flame_analysis(amb_fluid, rel_fluid, orif_diam, mass_flow, dis_coeff,
[...], analyze_flux=True, flux_coordinates[...])
I am already able to perform multiple analysis for obtaining the heat flux at different location, specified by flux_coordinates
. This heat flux matrix can only be obtained by setting the analyze_flux
parameter to True
, However, it's noteworthy that this same parameter also triggers the generation of a plot, which incurs computational demands. Hence, I am interested in exploring the possibility of separating the processes for generating the plot and creating the heat flux matrix.
The processes of plot generation and heat flux matrix generation are separate. That's what I was trying to point out above. The matrix generation is performed by the flame.Qrad_multi
method above, or the flame.generate_positional_flux
method, depending on how you want to define the positional coordinates. You are right, that there should probably be an additional flag about whether one wants to create a heat flux plot before the plot is generated here for the jet_flame_analysis
function. You could either add that flag or comment out the plot_heat_flux_sliced
command in the near-term (or use something more like the code I posted above, not using the jet_flame_analysis
function). We'll probably add in an additional flag about whether to generate the plot in the jet_flame_analysis
function for the next release.
You're absolutely right! My bad on not explaining properly. I did notice that the two processes are separate, but in api.phys.jet_flame_analysis
, they're both triggered by the same flag, unlike in api.phys.compute_overpressure
. It's great to hear you're adding this in the next release. Thank you so much for getting back to me so quickly!
Great to get feedback and know that people are using the software!
I may be mistaken, but it appears that the only parameter determining the activation of flux analysis at various locations is the
analyze_flux
parameter of thephys.jet_flame_analysis
function, which also generates a plot automatically. It would be beneficial to separate the flux plot from the analysis itself, particularly in scenarios where the model needs to be run multiple times (as plotting incurs computational expenses).