Is All G0 need to be calculated in CALCACT?

Hi, there :blush:
I have been optimize AERO for a while, and my concentration is ISOROPIA.
After some research upon the code and some ISOROPIA-II paper, some questions occurs and these question may become optimize points in time consume performance.
Let me introduce some BACKGROUND i learned from the code and paper first:
1、ISOROPIA treat different cases according to W(1-8),use different ISRP-N-F subroutines.
2、subroutine ISRP-N-F treat different cases according to SULFATE, RH and ion concentrations, use different calc cases( such as CALCAN, CALCBN…), we define them as CALC-CASE subroutines.
3、CALC-CASE call related funcs(we define them as FUNC-CASE funtions latter) in their bisection routine, like CALCA2 will call FUNCA2 to get the F(x) in its bisection routine. The bisection routine has an exit condition of ABS(X2-X1) .LE. EPS*X1
4、In FUNC-CASE functions, there exist an iteration routine to solve the ION balance problem, the ION balance problem rely on the activity coef, so every func will call CALCACT subroutine, which contains activity calculation.
Let take FUNCO7 as example to see the relation of func and activity coef. CMAQ/CCTM/src/aero/aero6/isofwd.f at 93099d8159f50e525120c790df674fe837a57edf ¡ USEPA/CMAQ ¡ GitHub
In line 7441 to 7443, we can found that var A4,A5,A6 rely on the Bromley equation result(GAMA), which is calculated in CALCACT. In the code we can count which GAMA is used in FUNCO7, the result is GAMA(5),GAMA(10),GAMA(11).
THE exit condition in FUNC-CASE functions’ iteration is CALAOU and CALAIN which is updated in CALCACT.
5、CALCACT treat different cases according to W(1-8), to call CALCACT1-4.
different CALCACT-N subroutines update different numbers of GAMA(N), and CALCACT4 update most(From GAMA(1) to GAMA(23)), CALCACT1 update least.
As a test result, I found that if branch goto FUNCO7, CALCACT always call CALCACT4, sometimes call CALCACT1.
As observed before, FUNCO7 only need GAMA(5),GAMA(10),GAMA(11) to update it’s A4,A5,A6.But the code in CALCACT4 calculated all the GAMA(1) - GAMA(23) using inquiry schedule in KMTAB.

Most of background is above. Now we can ask a question:
QUESTION:sailboat:
In case FUNCO7, is all GAMA or G0 need to be updated?
MY opinion
In my opinion, some FUNC-CASEs do exist some redundant calc in the call of CALCACT from the code.
But in theorial, this redundancy need to be proved.
Any opinion wil be appreciated :blush:
Thank you for you reading.

Hello,

Its seems like you are very interested in improving the computation efficiency of CMAQ, which is absolutely great! The specific ISORROPIA case you are currently investigating would probably be a good candidate for further examination. I would personally need to go through the code a bit more carefully to try to understand the questions you are posing, but while I try to find time for that, I want to bring your attention to the existence of ISORROPIA-Lite. This is a newer interpretation of the thermodynamics that that might have share the same goals that you have. There are several papers out on this, but here is one you may want to start with for further details:

DOI: 10.16993/tellusb.33

Sergey

Hi, D.R. sergey.
Thank you for your reply~
First, let me introduce the optimize thoughts in my post. It acctually has been applied in cmaq, as CALCACT1, CALCACT2, CALCACT3, CALCACT4 is used to solve different cases and avoid redundancy calculation. The core point is that i think the solution about this redundancy avoid in cmaq code still has more potential.
Second,I read the paper today, and its theory and engineering implementation are both excellent which enlight me a lot.
The papar is based on a metastable solution, which may simplify the conditions in thermodynamic modules(remove stable state solution), i think this is the most optimize point. But it may be difficult for me to apply this in my work because basicly i am solving an engineering issue, but not a scientific issue, because i have no qualification to tell if this change in code is reasonable in theory. Anyway, i will follow this case continuously, try to improve the performance of cmaq~
I’m basicly a new fish in polution field, and i want to ask some more detailed question about the precision. The paper says"the discrepancies between the ISORROPIA-lite and ISORROPIA-II predictions for the concentrations of the various semivolatile aerosol components are all less than 25%", which is in PMCAMx who was applied over Europe during May 2008.It did not mention about how much simulation time is executed after which the diff is produced, but i guess is a month? It says the metastable solution may reflect better the ambient aerosol state so i don’t care about the precision of the paper itself, but i wonder how much diff during amount of simulation time is tolarancable in polution field.
As i test ITP in cmaq, the relative diff is 1e-2 in 24hour.
Cheers, rzbbc.

I think i may found another optimize way.
As we can see in the binary search root method, the code only requires func’s positive or negative sign. What about if early stop iteration in function when the result is too far from zero? I tested this optimize with an eps 0.1, and it get good performance.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.