Skip to content

Add utgw and vtgw to variable output #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: nonlocal-gws
Choose a base branch
from

Conversation

ma595
Copy link
Collaborator

@ma595 ma595 commented Jun 17, 2025

Enables utgw and vtgw variable output.

Passes lchnk to gw_nlgw_dp_ml(state1,ptend,lchnk) as I was getting "block out of bounds" errors with ncol passed to outfld function.

This PR registers UTGW_NL and VTGW_NL in gw_nlgw_dp_init routine using addfld, and then outputs tendencies using outfld. The following changes need to be made to user_nl_cam:

nhtfrq=0,-24
mfilt=1,1400

fincl2 = 'U:I','V:I','T:I','UTGW_NL:I','VTGW_NL:I'

I believe 'I' corresponds to instantaneous and 'A' to time averaged. Care has to be taken to register the output variables properly. This is something I need to experiment with properly.

IMPORTANT: Then make sure to run ./preview_namelists.

NOTES: I tried with ncol and pcols passed to outfld and this led to the block error.

Output successfully reports write:

 file CAM_non-local-intel.cam.h0.1979-01-01-00000.nc to write         288
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-03600.nc to write         289
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-07200.nc to write         290
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-10800.nc to write         291
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-14400.nc to write         292
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-18000.nc to write         293
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-21600.nc to write         294
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-25200.nc to write         295
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-28800.nc to write         296
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-32400.nc to write         297
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-36000.nc to write         298
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-39600.nc to write         299
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-43200.nc to write         300
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-46800.nc to write         301
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-50400.nc to write         302
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-54000.nc to write         303
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-57600.nc to write         304
 Opened file CAM_non-local-intel.cam.h0.1979-01-01-61200.nc to write         305

And atm_in reports that UTGW and VTGW is properly registered.

TODO before merging:

  • Remove pcols experimentation.
  • Neaten

@ma595 ma595 force-pushed the ma595/nonlocal-gws branch from aba84ac to a484ca5 Compare June 26, 2025 19:14
@ma595
Copy link
Collaborator Author

ma595 commented Jun 27, 2025

 ncdump -h CAM_non-local-intel.cam.h2.1979-01-01-00000.nc
netcdf CAM_non-local-intel.cam.h2.1979-01-01-00000 {
dimensions:
	ncol = 48600 ;
	time = UNLIMITED ; // (4 currently)
	nbnd = 2 ;
	chars = 8 ;
	lev = 93 ;
	ilev = 94 ;
	trop_cld_lev = 84 ;
variables:
	double lat(ncol) ;
		lat:long_name = "latitude" ;
		lat:units = "degrees_north" ;
	double lon(ncol) ;
		lon:long_name = "longitude" ;
		lon:units = "degrees_east" ;
	double areawt(ncol) ;
		areawt:long_name = "physics column area weight" ;
	double area(ncol) ;
		area:long_name = "physics column areas" ;
	double lev(lev) ;
		lev:long_name = "hybrid level at midpoints (1000*(A+B))" ;
		lev:units = "hPa" ;
		lev:positive = "down" ;
	double hyam(lev) ;
		hyam:long_name = "hybrid A coefficient at layer midpoints" ;
		hyam:units = "1" ;
	double hybm(lev) ;
		hybm:long_name = "hybrid B coefficient at layer midpoints" ;
		hybm:units = "1" ;
	double ilev(ilev) ;
		ilev:long_name = "hybrid level at interfaces (1000*(A+B))" ;
		ilev:units = "hPa" ;
		ilev:positive = "down" ;
	double hyai(ilev) ;
		hyai:long_name = "hybrid A coefficient at layer interfaces" ;
		hyai:units = "1" ;
	double hybi(ilev) ;
		hybi:long_name = "hybrid B coefficient at layer interfaces" ;
		hybi:units = "1" ;
	double trop_cld_lev(trop_cld_lev) ;
		trop_cld_lev:long_name = "troposphere hybrid level at midpoints (1000*(A+B))" ;
		trop_cld_lev:units = "hPa" ;
		trop_cld_lev:positive = "down" ;
	double time(time) ;
		time:long_name = "time" ;
		time:units = "days since 1979-01-01 00:00:00" ;
		time:calendar = "noleap" ;
		time:bounds = "time_bnds" ;
	int date(time) ;
		date:long_name = "current date (YYYYMMDD)" ;
	int datesec(time) ;
		datesec:long_name = "current seconds of current date" ;
	double time_bnds(time, nbnd) ;
		time_bnds:long_name = "time interval endpoints" ;
	char date_written(time, chars) ;
	char time_written(time, chars) ;
	int ndbase ;
		ndbase:long_name = "base day" ;
	int nsbase ;
		nsbase:long_name = "seconds of base day" ;
	int nbdate ;
		nbdate:long_name = "base date (YYYYMMDD)" ;
	int nbsec ;
		nbsec:long_name = "seconds of base date" ;
	int mdt ;
		mdt:long_name = "timestep" ;
		mdt:units = "s" ;
	int ndcur(time) ;
		ndcur:long_name = "current day (from base day)" ;
	int nscur(time) ;
		nscur:long_name = "current seconds of current day" ;
	double co2vmr(time) ;
		co2vmr:long_name = "co2 volume mixing ratio" ;
	double ch4vmr(time) ;
		ch4vmr:long_name = "ch4 volume mixing ratio" ;
	double n2ovmr(time) ;
		n2ovmr:long_name = "n2o volume mixing ratio" ;
	double f11vmr(time) ;
		f11vmr:long_name = "f11 volume mixing ratio" ;
	double f12vmr(time) ;
		f12vmr:long_name = "f12 volume mixing ratio" ;
	double sol_tsi(time) ;
		sol_tsi:long_name = "total solar irradiance" ;
		sol_tsi:units = "W/m2" ;
	int nsteph(time) ;
		nsteph:long_name = "current timestep" ;
	float UTGW_NL(time, lev, ncol) ;
		UTGW_NL:mdims = 1 ;
		UTGW_NL:units = "m/s2" ;
		UTGW_NL:long_name = "Nonlinear GW zonal wind tendency" ;
	float VTGW_NL(time, lev, ncol) ;
		VTGW_NL:mdims = 1 ;
		VTGW_NL:units = "m/s2" ;
		VTGW_NL:long_name = "Nonlinear GW meridional wind tendency" ;

// global attributes:
		:ne = 30 ;
		:fv_nphys = 3 ;
		:Conventions = "CF-1.0" ;
		:source = "CAM" ;
		:case = "CAM_non-local-intel" ;
		:logname = "matta" ;
		:host = "deg0004" ;
		:initial_file = "/glade/campaign/cesm/cesmdata/inputdata/atm/cam/inic/se/cam7_FMT_ne30pg3_mg17_L93_c221118.nc" ;
		:topography_file = "/glade/campaign/cesm/cesmdata/inputdata/atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_20230105.nc" ;
		:model_doi_url = "not_set" ;
		:time_period_freq = "hour_3" ;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant