MIT-LAE / APCEMM

Aircraft Plume Chemistry, Emissions, and Microphysics Model
MIT License
8 stars 17 forks source link

Uninitialized aerArray causes failure of EPM #12

Closed sdeastham closed 5 months ago

sdeastham commented 9 months ago

https://github.com/MIT-LAE/APCEMM/blob/049fc9ff6218dcc7f531480f99950b5e8c7995f7/Code.v05-00/src/EPM/Integrate.cpp#L196

In tests on the Imperial HPC system, the EPM never finds water saturation. After some debugging I believe this line is the issue. The variable varSoot is important, but it relies on Soot_amb, which is set at

https://github.com/MIT-LAE/APCEMM/blob/049fc9ff6218dcc7f531480f99950b5e8c7995f7/Code.v05-00/src/EPM/Integrate.cpp#L180

That in turn relies on aerArray[ind_SOOT][0] - however, as far as I can tell, this is not set after first being declared. In LAGRIDPlumeModel the line in question is

https://github.com/MIT-LAE/APCEMM/blob/049fc9ff6218dcc7f531480f99950b5e8c7995f7/Code.v05-00/src/Core/LAGRIDPlumeModel.cpp#L155

although the same issue appears to affect PlumeModel. It looks like this error crept in when the line ambientData.getData( aerArray, nTime ); was deleted in the LAGRID update. Setting aerArray to be filled with zeros appears to at least let the code run but it would be good to get input from @michaelxu3 on a more robust solution that brings in the missing data (i.e. initial conditions from ambient data).

sdeastham commented 5 months ago

Resolved by b5ffad42b0b0fb50aaa9daf25e2f93bff3df1d4a.