Skip to content

Commit

Permalink
vert e-fold
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Nov 18, 2024
1 parent 304defa commit 5f56af7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions parm/soca/berror/soca_diagb.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ background error:
variables:
name: [tocn, socn, uocn, vocn, hocn, ssh, cicen, hicen, hsnon, mom6_mld]

vertical e-folding scale: 500.0 # vertical e-folding scale for the background error
rescale: 2.0 # rescales the filtered std. dev. by "rescale"
min sst: 0.0 # Added to sst bkg. err.
max ssh: 0.0 # Limits the amplitude of the unbalanced bkg err
Expand Down
32 changes: 26 additions & 6 deletions utils/soca/gdas_soca_diagb.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ namespace gdasapp {
stdDevFilt(jnode, level, nbz,
configD.depthMin, neighbors, nzMld,
viewHocn, bkg, viewBathy, stdDevBkg, true, 6);
}
} // end level
} // end 3D case
} // end jnode
} // end var
Expand Down Expand Up @@ -410,11 +410,31 @@ namespace gdasapp {
tmpArray(jnode, level+1)) / 3.0;
}
stdDevBkg(jnode, 0) = stdDevBkg(jnode, 1);
} // end jnode
} // end iter (vertical)
} // end vertical smoothing case
} // end var (loop through variables)
} // end simple smoothing

/// Impose an exponential decay to the background error
// ----------------------------------------------------
if (fullConfig.has("vertical e-folding scale")) {
double efold = 0.0;
fullConfig.get("vertical e-folding scale", efold);
for (auto & var : configD.socaVars.variables()) {
oops::Log::info()
<< "====================== apply exponential decay to the background error with e-folding scale "
<< " " << efold << " m for " << var << std::endl;
auto stdDevBkg = atlas::array::make_view<double, 2>(bkgErrFs[var]);
for (atlas::idx_t jnode = 0; jnode < xbFs["tocn"].shape(0); ++jnode) {
for (atlas::idx_t level = 0; level < xbFs[var].shape(1); ++level) {
if (viewDepth(jnode, level) >= 0.0) {
stdDevBkg(jnode, level) *= std::exp(-viewDepth(jnode, level) / efold);
}
}
}
}
}
} // end level
} // end jnode
} // end var (loop through variables)
} // end exponential decay

/// Use explicit diffusion to smooth the background error
// ------------------------------------------------------
Expand Down Expand Up @@ -451,7 +471,7 @@ namespace gdasapp {
// Apply the diffusion filtering
diffuse.setParameters(scalesFs);
diffuse.multiply(bkgErrFs, oops::Diffusion::Mode::HorizontalOnly);
}
} // end explicit diffusion

// Rescale
util::multiplyFieldSet(bkgErrFs, configD.rescale);
Expand Down

0 comments on commit 5f56af7

Please sign in to comment.