Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Trying to read a variable (for tracer_opt) I added into the met_em*.nc files

kwchang

New member
Hello, I am interested in using the tracer_opt=2 option, and currently I am trying to give the tracer initial and boundary conditions by injecting the values into the met_em*.nc files generated by metgrid.exe. My problem as of now is that the tracer variables' values in wrfinput_d01 and wrfbdy_d01 are all zero, and I am not sure what I am doing wrong.

Below are the things I have done leading up to this point:
  1. My met_em* files have the contents as shown in the attached met_em_ncdump, and the injected variables are TR17_1, TR17_2, and PV (it's called PV but I'm just using it as a tracer). I added these variables after metgrid.exe generated them. I'd like for real.exe to read these variables and interpolate it onto the WRF grid so I can use it as initial and boundary conditions.
  2. Edited Registry.EM_COMMON:
    • At lines 81-83 I added variables pv_gc, tr17_1_gc, and tr17_2_gc, for example
    • Code:
      state    real   tr17_1_gc      igj      dyn_em      1        Z     i1  "TR17_1" "tracer 17_1"    "kg kg-1"
  3. Edited Registry.EM:
    • Here I added line 36 for the pv variable, and
    • Code:
      package   tracer_test1   tracer_opt==2       -             tracer:tr17_1,tr17_2,pv
    • Code:
      package   realonly       use_wps_input==1            -
      Code:
      state:u_gc,v_gc,t_gc,rh_gc,ght_gc,p_gc,xlat_gc,xlong_gc,ht_gc,tsk_gc,tavgsfc,tmn_gc,pslv_gc,sct_dom_gc,scb_dom_gc,greenfrac,albedo12m,lai12m,pd_gc,psfc_gc,intq_gc,pdhs,sh_gc,cl_gc,cf_gc,qv_gc,qr_gc,qc_gc,qs_gc,qi_gc,qg_gc,qh_gc,qni_gc,qnc_gc,icefrac_gc,prho_gc,pdrho_gc,qnr_gc,qns_gc,qng_gc,qnh_gc,soil_layers,soil_levels,st,sm,sw,soilt,soilm,sm000007,sm007028,sm028100,sm100255,st000007,st007028,st028100,st100255,sm000010,sm010040,sm040100,sm100200,sm010200,soilm000,soilm005,soilm020,soilm040,soilm160,soilm300,sw000010,sw010040,sw040100,sw100200,sw010200,soilw000,soilw005,soilw020,soilw040,soilw160,soilw300,st000010,st010040,st040100,st100200,st010200,soilt000,soilt005,soilt020,soilt040,soilt160,soilt300,qntemp,qntemp2,hgtmaxw,pmaxw,tmaxw,umaxw,vmaxw,hgttrop,ptrop,ttrop,utrop,vtrop,urb_param,tr17_1_gc,tr17_2_gc,pv_gc
  4. Edited module_initialize_real.F:
    At lines 4407-4453 I added three calls to vert_interp, I'm trying to interpolate the met_em variables (which I assume are grid%tr17_1_gc, grid%tr17_2_gc, etc.) to the tracer array, but I don't know if I am doing this correctly.
I attached all the files I edited. At the moment, WRF compiles and I can run real.exe, and it produced the wrfinput_d01 and wrfbdy_d01; the ncdump of wrfinput_d01 is attached and you can see the new variables like tr17_1. But all the values are zero.
 

Attachments

  • tmp.zip
    158.5 KB · Views: 1
Hi,
The tracer option is written in the WRF code to initiate when real.exe is run. Instead of modifying the met_em* files, which will create a lot more coding work for you, can you just modify the wrfbdy and wrfinput files after running real? Then the tracers will still have the initial and boundary conditions you are interested in.
 
I am looking into this and was able to modify wrfinput. I have two questions regarding wrfbdy:
  1. I see from a previous thread (Definitions of _BTXE and _BXE in wrfbdy output) Dave Gill writes that the the fields in the bdy files are "mass weighted". Does that mean I have to consider this when I write the tracer values in wrfbdy?
  2. I want to use pressure for interpolation, but I don't see it available in wrfbdy. Is it possible to calculate it with what's already in wrfbdy?
Thanks.
 
Top