Hi all,
I want to project a WRF 3d scalar variable (smoke tracer) to CMAQ grid definition. I know MCIP is a software which projects some WRF variables to CMAQ grid definition. Is it possible to project additional WRF scalar variable to CMAQ by using MCIP?
Yes, you can use MCIP to pass through another variable from WRF to CMAQ. It is fairly straightforward but also tedious to add a variable. You’ll need to change MCIP in numerous places, including:
alloc_ctm.f90
alloc_met.f90
alloc_x.f90
ctmproc.f90
ctmvars_mod.f90
dealloc_ctm.f90
dealloc_met.f90
dealloc_x.f90
init_ctm.f90
init_met.f90
init_x.f90
metvars2ctm.f90
metvars_mod.f90
rdwrfem.f90
xvars_mod.f90
If the variable is “optional” and you want to make your code more flexible, you may also need to modify:
outcm3io.f90
outncf.f90
outncfbdy.f90
Inside MCIP, there are three classes of grid definitions:
“met” which is the native grid from the meteorology model (which is WRF, here).
“x” which is the “transfer” (or “xfer” in shorthand) domain. This domain is the target domain for CMAQ including the boundary perimeter.
“ctm” which is the CMAQ output domain excluding the boundary perimeter.
For each of those classes of definitions, you’ll need to set up the new variable that you’d like to pass through. There are f90 modules associated with each of those classes, so you declare the variable there (either as an array or a pointer, depending on the setup that I already established).
After the new variable is declared for each grid size, you will need to set up to allocate memory, deallocate memory, and initialize each array or pointer. Where pointers are used (i.e., ctm variables), you will need to increase the appropriate counter by 1 and map the new variable to the next indexed value.
You read the variable on the “met” grid from WRF in rdwrfem.f90. Follow the pattern that I established in the routine.
You translate the variable from the “met” grid to the “x” grid in metvars2ctm.f90.
You translate the variable from the “x” grid to the “ctm” grid (and to the boundaries, if necessary) in ctmproc.f90.
Hi,
While MCIP does preprocess several variables from WRF, it would require additional modification to interpolate a new variable onto the CMAQ grid.
I think your best bet would be to use some other program for spatial interpolation. Sorry I don’t have any more specific suggestions; I haven’t tried CMAQ run similar to what you’re describing.
Thanks for your suggestion. I have a naive idea and I am not sure whether it is correct. I could use the smoke tracer variable to replace one scalar variable in WRF (say temperature). And I use the revised WRF to run MCIP. Will I have the projected smoke tracer as TA (air temperature) variable in MCIP by this way? Or it is not the correct method.
The easy way to get a WRF-output variable to a file of its own would be to use the M3Tools program wrftom3; if you wanted this variable to be in a MET_* file, you could then use m3merge to merge this variable into a new MET_* file.
I don’t follow what you are asking to do. I don’t think you want to replace temperature, but I don’t really know the purpose of adding a scalar. I would need more information.
Maybe. I think this could be another approach, but I’m not sure I fully understand what OP is trying to do here. I think your wrftom3 tool could be useful, but I would not characterize it as “easy” if you don’t have the GRIDDESC already created for the output file. If OP wants to add something to MCIP output, then your approach could be more efficient and straightforward. However, if this is a one-off application, then it may be worth the trouble to modify the source code.
Thank you for providing a potential alternate solution.
Sorry for the ambiguous. I want to project a tracer smoke result from WRF grid definition to CMAQ grid definition. Actually, I will not use the MCIP result to run CMAQ. What I need is only a smoke tracer under CMAQ grid definition and I hope the total mass is conserved as MCIP does for other WRF variables.
The reason I am thinking the method is the MCIP can transfer a scalar variable from WRF to CMAQ coordinate. For example, if MCIP uses a function f to do the projection for temperature from WRF to CMAQ, I think I can revise the temperature values as another scalar variable values and use the function directly through MCIP without changing any codes.
Blockquote I could use the smoke tracer variable to replace one scalar variable in WRF (say temperature). And I use the revised WRF to run MCIP. Will I have the projected smoke tracer as TA (air temperature) variable in MCIP by this way?
Maybe @cjcoats 's answer is an easier way in this situation, I could run MCIP firstly to generate GRIDDESC and then use the tool to project the smoke tracer from WRF coordinate to CMAQ coordinate.