Hello,
I find my question should fit in this discussion.
I am implementing convective heat loss added to the 1D freely propagating flame model. It works fine with C++, now I want to use the python interface and am looking for some hints on how to modify the sources.
ABOUT THE MODEL :
It is expressed as alpha_loss*(T - T0). alpha_loss being a convective heat loss coefficient and T0 a reference temperature (to be set to the initial temperature in most cases).
HERE IS WHAT I DID regarding C++ :
I installed the sources and made some modifications to the following files:
1) /include/cantera/oneD/StFlow.h
I defined a new function,
+ // setConvectiveHeatLossesParameters
+ void setConvectiveHeatLossesParameters(double alpha_loss, double T0) {
+ m_alpha_loss = alpha_loss;
+ m_T0 = T0;
+ }
And set-up the defaut values
+ // alpha_loss and T0 for convective heat losses
+ double m_alpha_loss = 0.0;
+ double m_T0 = 300.0;
2) /src/oneD/StFlow.cpp
I added this term to the energy equation (slightly modified to have convenient dimensions)
+ rsd[index(c_offset_T, j)] -= (m_alpha_loss / (m_rho[j] * m_cp[j])) * ( T(x,j) - m_T0);
In conclusion:
I ran successfully such computation from c++ programs, e.g. I modified one of the samples
/samples/cxx/flamespeed/flamespeed.cpp
+ // heat losses
+ double alpha_loss = 5.0E3;
+ double T0 = 300.0;
+ flow.setConvectiveHeatLossesParameters(alpha_loss, T0);
and got what intended.
QUESTIONS regarding the python interface :
I would like to use a similar function within my python run, something like:
+ flame.set_convective_heat_losses_parameters(alpha_loss,T0)
before solving the case.
I have a hard time understanding how to make c++ sources understand that such a declaration in my python run would correspond to the function "setConvectiveHeatLossesParameters" of the sources.
I looked for an example of such process in the file present in /build/python/cantera/ but did not find how to do.
Which files should I modify and how ?
Best,
Kévin