Turning off chemistry mechanism in CMAQ

Hi everyone. I’m using CMAQv5.3.1 to simulate Ozone concentration. As I’m using the local emission inventory, I have to generate emission files by myself instead of using SMOKE. I’ve successfully generate the emission files and they can be read by CMAQ. However I got very low O3 concentration and I doubted if my emissions are correct. In order to debug the issue, I want to turn off different features in CMAQ. Can I turn off chemistry mechanism and only allow transport and advection going on? Thanks!

2 Likes

One way to do this is to comment out the call to CHEM in sciproc.F.

Thanks! Should I modify it in src directory then recompile the BLD, or just change it in my previous BLD directory and re-make the executable file?

Either could work, but I would recommend:
cp sciproc.F sciproc.F.orig
Then edit sciproc.F.
Then invoke make. You may need to source config_cmaq.csh first

I commented out line 281 in sciproc.F and tried to run cmaq. The compilation reported no error. But when I ran the model, it gave me the following error:

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
CCTM_s07tic_noche  00000000009AF90D  Unknown               Unknown  Unknown
libpthread-2.18.s  00002AF0F5B4B6D0  Unknown               Unknown  Unknown
CCTM_s07tic_noche  00000000006F3A8A  Unknown               Unknown  Unknown
CCTM_s07tic_noche  0000000000605EF2  Unknown               Unknown  Unknown
CCTM_s07tic_noche  00000000005FEC8C  Unknown               Unknown  Unknown
CCTM_s07tic_noche  00000000005FD619  Unknown               Unknown  Unknown
CCTM_s07tic_noche  0000000000406D9E  Unknown               Unknown  Unknown
libc-2.18.so       00002AF0F6464D65  __libc_start_main     Unknown  Unknown
CCTM_s07tic_noche  0000000000406CA9  Unknown               Unknown  Unknown

Do you think it’s caused by commenting out the CHEM?

Rebuild the model in debug mode, so that the stack trace gives you human-readable information about where the error occurs. Also relevant: does it crash immediately, or after running for some time?

It almost crashed immediately, after it called chemistry.

 ================================
 |>---   TIME INTEGRATION   ---<|
 ================================

 Processing Day/Time [YYYYDDD:HHMMSS]: 2010264:000000
   Which is Equivalent to (UTC): 0:00:00  Tuesday,  Sept. 21, 2010
   Time-Step Length (HHMMSS): 000500
             VDIFF completed...   20.5 seconds
            COUPLE completed...    1.1 seconds
              HADV completed...   24.9 seconds
              ZADV completed...    4.5 seconds
             HDIFF completed...    2.8 seconds
          DECOUPLE completed...    1.1 seconds
              PHOT completed...   13.0 seconds
           CLDPROC completed...    3.5 seconds
              CHEM completed...    0.4 seconds
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
CCTM_s07tic_noche  0000000001A61C1D  Unknown               Unknown  Unknown
libpthread-2.18.s  00002B8D9E0FC6D0  Unknown               Unknown  Unknown
CCTM_s07tic_noche  0000000001551229  aero_                     503  aero_driver.F
CCTM_s07tic_noche  0000000000E617C1  sciproc_                  298  sciproc.F
CCTM_s07tic_noche  0000000000E48385  cmaq_driver_              679  driver.F
CCTM_s07tic_noche  0000000000E40B84  MAIN__                     96  cmaq_main.F
CCTM_s07tic_noche  0000000000406D9E  Unknown               Unknown  Unknown
libc-2.18.so       00002B8D9EA15D65  __libc_start_main     Unknown  Unknown
CCTM_s07tic_noche  0000000000406CA9  Unknown               Unknown  Unknown

Thanks

Oops, when using the saprc07 mechanisms (or at least saprc07tic_ae7i_aq), commenting out the call to chem leads to a seg fault in aero_driver. (This approach works when using cb6.)

Go back to the original version of sciproc.F. Instead modify hrdriver.F. At the end of the IF (LFIRST) block, insert an ELSE RETURN statement. Now chemistry will be called exactly once.

IF (LFIRST) THEN
...
ELSE
    RETURN
END IF

If you don’t want CHEM to be called even once, other than the initializations being done in the LFIRST block, then instead change to

IF (LFIRST) THEN
...
END IF
RETURN

This assumes you are using the EBI solver. If you’re using ros3 or smvgear, you may have to do something analogous in rbdriver.F or grdriver.F.

Thanks! I also saw in the script, LFIRST is set as .TRUE. Should I just keep it there and only add RETURN to IF (LFIRST)?

Just add a RETURN statement immediately after the END IF statement ending the LFIRST block.

Hi, I just tested it. It still reported the same error. I attached my bldit_cctm.csh settings below for your reference.

set CompileBLDMAKE
set CopySrc
set ParOpt
set Debug_CCTM

set ModGrid   = grid/cartesian             #> grid configuration module
set DepMod    = m3dry                      #> m3dry or stage
set ModAdv    = wrf_cons                   #> 3-D Advection Scheme [Options: wrf_cons (default), local_cons]
set ModHdiff  = hdiff/multiscale           #> horizontal diffusion module
set ModVdiff  = vdiff/acm2_${DepMod}       #> vertical diffusion module (see $CMAQ_MODEL/CCTM/src/vdiff)
set ModDepv   = depv/${DepMod}             #> deposition velocity calculation module
                                           #>     (see $CMAQ_MODEL/CCTM/src/depv)
set ModEmis   = emis/emis                  #> in-line emissions module
set ModBiog   = biog/beis3                 #> BEIS3 in-line emissions module
set ModPlmrs  = plrise/smoke               #> in-line emissions plume rise
set ModCgrds  = spcs/cgrid_spcs_nml        #> chemistry species configuration module
                                           #>     (see $CMAQ_MODEL/CCTM/src/spcs)
set ModPhot   = phot/inline                #> photolysis calculation module
                                           #>     (see $CMAQ_MODEL/CCTM/src/phot)
set Mechanism = saprc07tic_ae7i_aq         #> chemical mechanism (see $CMAQ_MODEL/CCTM/src/MECHS)
set ModGas    = gas/ebi_${Mechanism}       #> gas-phase chemistry solver (see $CMAQ_MODEL/CCTM/src/gas)
                                           #> use gas/ros3 or gas/smvgear for a solver independent
                                           #  of the photochemical mechanism
set ModAero   = aero/aero7                 #> aerosol chemistry module (see $CMAQ_MODEL/CCTM/src/aero)
set ModCloud  = cloud/acm_ae7              #> cloud chemistry module (see $CMAQ_MODEL/CCTM/src/cloud)
set ModUtil   = util/util                  #> CCTM utility modules
set ModDiag   = diag                       #> CCTM diagnostic modules
set Tracer    = trac0                      #> tracer configuration directory under
                                           #>   $CMAQ_MODEL/CCTM/src/MECHS [ default: no tracer species ]
set ModPa     = procan/pa                  #> CCTM process analysis
set ModPvO3   = pv_o3                      #> potential vorticity from the free troposphere
set ModISAM   = isam                       #> CCTM Integrated Source Apportionment Method

Thanks!

Sorry, my mistake.
Starting from the release version of the code, modify hrdriver.F:

  1. Change the end of the LFIRST block (around line 249) so that it reads:

    IF (LFIRST) THEN

    ELSE
    RETURN
    END IF

  2. Add a RETURN after the call to HETCHEM_RATES.

    CALL HETCHEM_RATES( TA, PRES, QV CGRID, DENS )
    RETURN

I just tested this in CMAQv5.3.1 with the saprc07tic_ae7i_aq mechanism, and it worked for me.

1 Like

Thanks! It works now!

Hi, can I ask a further question? Would turning off chemistry also disable particle matter production? Thanks!

I believe that other processes contribute to PM2.5 including transport, so turning off chemistry would not necessarily eliminate PM2.5 production.

1 Like

I see. But aerosol chemistry is already turned off in this case, right?

Hello there.

Im also trying to run CMAQ without chemistry. Im using CMAQ v4. 5 and the cb6r3_ae7_aq mechanism.

Reading this topic I thought that commenting this line

diff sciproc.F sciproc_orig.F 
285c285
<       #CALL CHEM ( CGRID, JDATE, JTIME, TSTEP )
---
>       CALL CHEM ( CGRID, JDATE, JTIME, TSTEP )

in sciproc.F would be enough (I see that with saprc07 mechanism other things should be done).

But then I get the following error when trying to build the .exe

sciproc.F(285): error #5082: Syntax error, found POUND_BASE '' when expecting one of: <LABEL> <END-OF-STATEMENT> ; <IDENTIFIER> TYPE MODULE ELEMENTAL IMPURE NON_RECURSIVE ...
      #CALL CHEM ( CGRID, JDATE, JTIME, TSTEP )
------^
/tmp/iforttaJtHz.i: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem>
compilation aborted for sciproc.F (code 1)
make: *** [Makefile:457: sciproc.o] Error 1

What I am doing wrong here?

Thank you in advance
Sol

Catastrophic compiler errors are just that – errors in the compiler itself, not something that can be fixed in the source code.
The first thing I would try is make clean; make.
If that does not work, then update your compiler.
If you still have difficulties, please post your message in a new thread.

2 Likes