How to Combine CCTM for Layer 2 and other layers in the CONC file

Dear @lizadams @bbaek @wong.david-c @tlspero @cjcoats

I want to combine CCTM results of LAYER 2 but couldn’t get it done. Below is what I got:

Value for IOAPI_LOG_WRITE not defined;returning default:   TRUE
     O3 written to OUTFILE for   2020059:000000
     NO written to OUTFILE for   2020059:000000
     NO2 written to OUTFILE for   2020059:000000
     SO2 written to OUTFILE for   2020059:000000
     NH3 written to OUTFILE for   2020059:000000
     CO written to OUTFILE for   2020059:000000
     PMOTHR written to OUTFILE for   2020059:000000
     Requested layer:    2
     Layers in the file:  1 ...    1
      
     >>--->> WARNING in subroutine READ3
     LAYER not available in file OUTFILE
     M3WARN:  DTBUF 0:00:00   Feb. 28, 2020

In the Species definition file, I have this:

**/#start   YYYYDDD  HHMMSS**
**/#end     YYYYDDD  HHMMSS**
**#layer         2**

I'll appreciate your guide in getting this done.

Thanks in anticipation.

Could you please provide the following information to help us troubleshoot this further?

  1. The full log file that shows which input and output files are opened and also displays some metadata for these files

  2. The species definition file specified in your combine run script

  3. The version of combine you are using

From the looks of it, I’d guess that the species defined just after PMOTHR in your species definition file references an input file that has only 1 layer, but I admit that I am stumped why the log file reports that layer 3 is requested when layer 2 was specified in the species definition file.

1 Like

Dear @hogrefe.christian,

Thanks for your prompt response and concerns. I use the same Species definition file for the average conc (ACONC) for LAYER 1 and it works well for the LAYER 1 of the CONC files too. But I want the results of other layers (LAYER 2 and above) too. I’m using CMAQv5.2 with Saprc07tic_ae6i.aq mechanism.

Attached are the files you requested for.

spec_def.pm.aero6.conc.v52.txt (8.9 KB) logfile.txt (100.3 KB)

Thanks in anticipation for the solution.

Thank you. I think I see now what is happening, and unfortunately I think it means you’ll have to edit your SpecDef file a bit to get around this error.

If I understand it correctly, the problem is that while the SpecDef syntax allows the use of [0] brackets to indicate that a previously-defined variable should be read from OUTFILE rather than INFILE1, INFILE2, etc. this feature which normally is very useful to avoid having to repeat previously-defined variables in subsequent expression breaks down when the input file(s) have multiple layers and you’re actually trying to reference layers above layer 1 since OUTFILE will always have 1 layer only.

The only way around this within the constraints imposed by combine is to avoid using [0] references to OUTFILE if you’re using it to process variables for layers other than layer 1.

In your case, you’d have to replace the reference to PMOTHR[0] in the definition of PM25 with the full expression for PMOTHR, i.e. APAH1J[1]+APAH2J[1]+APAH3J[1]
+APCSOJ[1]+ASIJ[1]
+ASO4I[1]+ASO4J[1]+ASQTJ[1]+ASVOO1I[1]
+ASVOO1J[1]+ASVOO2I[1]+ASVOO2J[1]+ASVOO3J[1]
+ASVPO1I[1]+ASVPO1J[1]+ASVPO2I[1]+ASVPO2J[1]
+ASVPO3J[1]+ATIJ[1]+ATOL1J[1]+ATOL2J[1]
+ATOL3J[1]+ATRP1J[1]+ATRP2J[1]+AXYL1J[1]
+AXYL2J[1]+AXYL3J[1]

Likewise, you’ll also have to replace all other instances of [0] references (e.g. APOCI[0], APOCJ[0]) with their actual expressions referencing the original INFILE1 variables instead.

Please let us know if this solves your problem.

1 Like

Dear @hogrefe.christian

I sincerely appreciate your responses and guide. Your suggestion has worked for me.

Thanks and best regards, sir.

Catalyst

Thanks for letting us know that this solved the problem.

On second thought, if your goal was to generate combined species for all the 18 layers present in your CONC file into a single 3D combine output file, you could have kept the original SpecDef file with all the [0] references and only commented out the line with the desired layer using a “/” as follows:

/#layer 2

Put differently, the problem with the [0] references only occurs if the SpecDef file is set up to extract species for a specific layer (i.e. the #layer line is not commented out) AND that layer is not equal to layer 1. If the #layer line is commented out, OUTFILE will have as many layers as INFILE1 and the [0] references work fine. In that scenario, it is important to make sure that any additional files potentially referenced by the SpecDef file (INFILE2, etc.) also have the same number of layers as INFILE1.

1 Like

Dear @hogrefe.christian,

I know I could get the whole layers combined in a 3D output file as you’ve stated. But when I did, I couldn’t get each layer extracted for the sites I wish to analyze, the reason I chose to combine each layer separately.

Thanks and kind regards, sir.

Catalyst

Dear @hogrefe.christian,

In CMAQ-5.2 and saprc07tic_ae6i_aq mechanism, below is the definition for this species:

ASOMI ,ug/m3 ,ALVOO1I[1] + ALVOO2I[1] + ASVOO1I[1] + ASVOO2I[1]
ASOMJ ,ug/m3 ,AXYL1J[1] + AXYL2J[1] + AXYL3J[1] + ATOL1J[1] + ATOL2J[1] + ATOL3J[1]
+ABNZ1J[1] + ABNZ2J[1] + ABNZ3J[1] + AISO1J[1] + AISO2J[1] + AISO3J[1]
+ATRP1J[1] + ATRP2J[1] + ASQTJ[1] + AALK1J[1] + AALK2J[1]
+AORGCJ[1] + AOLGBJ[1] + AOLGAJ[1]
+APAH1J[1] + APAH2J[1] + APAH3J[1] + AIETETJ[1] + AIEOSJ[1]+ ADIMJ[1]
+AIMGAJ[1] + AIMOSJ[1] + AMTNO3J[1] + AISOPNNJ[1] + AMTHYDJ[1]+AGLYJ[1]
+ALVOO1J[1] + ALVOO2J[1] + ASVOO1J[1] + ASVOO2J[1]
+ASVOO3J[1] + APCSOJ[1]

ASOMIJ ,ug/m3 ,ASOMI[0] + ASOMJ[0]

My question is that is SOMIJ same thing to SOA (Secondary Organic Aerosol)?

Thanks in anticipation.

Yes, ASOMIJ represents the total mass associated with the secondary organic aerosols simulated by CMAQ.

1 Like

Dear @hogrefe.christian,

Thanks so much for your usual prompt responses. They help a lot.

Hello, Christian Hogrefe,
I want to generate combined species for all the 23 layers into a single 3D combine output file. My INFILE1, INFILE2, INFILE3 have the same number of layers according to your comments. However, INFILE4 as define as below should be 2D and represents surface variables:

#> File [1]: CMAQ conc/aconc file
#> File [2]: MCIP METCRO3D file
#> File [3]: CMAQ APMDIAG file
#> File [4]: MCIP METCRO2D file

I followed your suggestions by using a “/” before #layer 2 in the combine run script. However, combine output only gives valid results at the first time step for each day as shown below. I have no idea what is wrong for combine program for all layers. I am looking forward to your inputs and resolution to this problem.

TFLAG =
2017091, 0,
2017091, 0,
2017091, 0,
2017091, 0,

2017091, 0,
2017091, 0,
2017091, 0,
_, _,
_, _,
_, _,

Could you please post your run script, species definition file, and log file? If you want to create an all-layer output file, all of the input files referenced by the species definition file need to have the same number of layers. Since INFILE4 only contains 1 layer, you cannot refer to any variable from this file in the scenario where you want to create a 3D output file.

Hi Christian,
Thanks for your response.
Please find run script, species definition, and run log file attached. I do notice that there are error messages such as “ERROR evaluating EXP of 1.5582E+02” in the log file.
If we can not use INFILE with only one layer for combine multiple layers, how can we provide requested 2D variables such as TEMP2 which is only included in METCRO2D file? METCRO2D only contains 1 layer. CMAQ users may need to develop their own post-processing program based on raw output files to get combined species such PM2.5 and PM10 for upper layers, otherwise. Am I right? Thank you very much.test_run_combine.wbdust.csh (5.6 KB) SpecDef_cb6r3_ae7_aq.PM10.txt (15.5 KB) combine.test.log.txt (55.1 KB)

Thanks for posting these files. The basic problem is indeed that INFILE1-INFILE3 have 23 layers while INFILE4 has only 1 layer so there just is no way to define new variables that pull variables from INFILE4 and combine it with other variables from INFILE1-INFILE3.

I am actually surprised that the run proceeded as far as it did. Given that OUTFILE contains 23 layers (based on INFILE1, if the layer to extract isn’t specified in the SpecDef file), I’d have expected that the run crashes once it encounters the first reference to a variable from INFILE4, i.e. when processing SFC_TMP which references TEMP2. Apparently the layer mismatch is not causing a crash there (though I expect that you only have SFC_TMP values for the first layer but not any of the remaining 22 layers in your partial OUTFILE), but once a reference to INFILE4 is used in a more complex expression like the one for “K”, a crash occurs.

As to your question about using combine to create 3D files, you can certainly do that, but you’ll have to make sure that the variables you want to include in that 3D file can all be computed from underlying variables in other 3D files. If you want a 3D file, there is no reason you’d want to include PBL height, surface temperature, radiation at the ground, etc. in that 3D file, since these by definition aren’t 3D variables . You’d probably also don’t want to do the FRM calculations towards the end of the specdef files since FRM monitors are deployed at the surface rather than at different altitudes.

Put differently, you need to create a different SpecDef file for 3D analysis, using your existing SpecDef file as a starting point. You can still include met variables for unit conversions from the METCRO3D file, you just can’t include any variables from the METRO2D file, and I can’t think of any reason why you’d want to. What you put in that new SpecDef file depends on what kind of analysis you plan to perform with the combined 3D file.

Hi Christian,
Thank you so much for the detail explanation and clarification of some key points.
I use combine to create 3D files is to study vertical profiles of PM2.5 and PM10.
I like you suggestion to create a different SpecDef file for 3D analysis using METCRO3D file. It is very helpful.
Thank you very much.

Christian,
I quickly updated run scrip and SpecDef file for 3D analysis. Everything works fine. I successfully get what I want, PM2.5 and PM10 profiles.
For surface parameters evaluation, I can easily switch to original combine.
Thank you again for your powerful support.