Skip to content

Commit

Permalink
Add variable rescaling for aerosol species (#1339)
Browse files Browse the repository at this point in the history
This is a draft PR for additions to chem_diagb.h that could allow for a
variable rescaling (rs) for each aerosol species. It does not yet
include a way to read the values in from a yaml or config file. The it
compiles and runs, but I have not yet tested it using 3dvar. And it
still has lots of print statements used for testing. It runs in about 40
seconds at C96, and is probably slowed down by the print statements. Any
comments will be helpful.

Also, note the if statement. I was unsure of the dimensions of an array,
so I put in a test. I'll remove it along with the print statements.
  • Loading branch information
andytangborn authored Nov 20, 2024
1 parent 71aef36 commit 15c29b1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
21 changes: 20 additions & 1 deletion parm/aero/berror/aero_diagb.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,26 @@ variables:
- mass_fraction_of_sea_salt003_in_air
- mass_fraction_of_sea_salt004_in_air

rescale: {{ aero_diagb_rescale }} # rescales the filtered std. dev. by "rescale"
global rescale:
geometry:
fms initialization:
namelist filename: ./fv3jedi/fmsmpp.nml
field table filename: ./fv3jedi/field_table
akbk: ./fv3jedi/akbk.nc4
layout:
- {{ layout_x }}
- {{ layout_y }}
nxp: {{ npx_rescale }}
npy: {{ npy_rescale }}
npz: {{ npz_ges }}
field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_restart.yaml
rescale stddev:
filetype: fms restart
skip coupler file: true
dateapath: ./stddev
filename_trcr: rescale.fv_tracer.res.nc
filename_cplr: rescale.coupler.res

number of halo points: {{ aero_diagb_n_halo }}
number of neighbors: {{ aero_diagb_n_neighbors }}
simple smoothing:
Expand Down
25 changes: 20 additions & 5 deletions utils/chem/chem_diagb.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,27 @@ namespace gdasapp {
}
}

// Rescale
if (fullConfig.has("rescale")) {
double rescale;
fullConfig.get("rescale", rescale);
util::multiplyFieldSet(bkgErrFs, rescale);
// Rescale
if (fullConfig.has("global rescale")) {
const eckit::LocalConfiguration GlobalRescaleConfig(fullConfig, "global rescale");
const eckit::LocalConfiguration GlobalRescaleGeomConfig(GlobalRescaleConfig, "geometry");
const fv3jedi::Geometry GlobalRescaleGeom(GlobalRescaleGeomConfig, this-> getComm());
fv3jedi::Increment global_rescale(GlobalRescaleGeom, chemVars, cycleDate);
global_rescale.zero();
const eckit::LocalConfiguration GlobalRescaleStdConfig(GlobalRescaleConfig,
"rescale stddev");
global_rescale.read(GlobalRescaleStdConfig);
// interpolate to background resolution
fv3jedi::Increment global_rescale_interp(geom, global_rescale);
atlas::FieldSet xrsFs;
global_rescale_interp.toFieldSet(xrsFs);
oops::Log::info() << "global rescaling coefficients:" << std::endl;
oops::Log::info() << xrsFs << std::endl;
util::multiplyFieldSets(bkgErrFs, xrsFs);
}



bkgErr.fromFieldSet(bkgErrFs);

// Hybrid B option
Expand Down Expand Up @@ -274,6 +288,7 @@ namespace gdasapp {
double rescale_staticb;
ClimBConfig.get("staticb rescaling factor", rescale_staticb);


// Combine diagb and climatological background errors
fv3jedi::Increment stddev_hybrid(geom, chemVars, cycleDate);
stddev_hybrid.zero();
Expand Down

0 comments on commit 15c29b1

Please sign in to comment.