Skip to content

Commit

Permalink
Add initial version of 3dvar and dirac ctest.
Browse files Browse the repository at this point in the history
  • Loading branch information
frld committed Jul 26, 2024
1 parent 0a98ddb commit c252483
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/mains/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ ecbuild_add_executable( TARGET orcamodel_ErrorCovarianceToolbox.x

oops_output_json_schema( "orcamodel_hofx.x" )
oops_output_json_schema( "orcamodel_hofx3D.x" )
oops_output_json_schema( "orcamodel_3DVar.x" )
oops_output_json_schema( "orcamodel_ErrorCovarianceToolbox.x" )
#oops_output_json_schema( "orcamodel_3DVar.x" )
#oops_output_json_schema( "orcamodel_ErrorCovarianceToolbox.x" )
5 changes: 3 additions & 2 deletions src/orca-jedi/state/State.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ State::State(const Geometry & geom,
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background",
stateFields_);
nemo_file_name = params.varianceFieldFile.value().value_or("");
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance",
stateFields_);
if (nemo_file_name != "") {
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance",
stateFields_); }
}
geom_->log_status();
oops::Log::trace() << "State(ORCA)::State created." << std::endl;
Expand Down
10 changes: 10 additions & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@ ecbuild_add_test( TARGET test_orcamodel_hofx3D_prof_2var
OMP 1
ARGS testinput/hofx3d_nc_prof_2vars.yaml
COMMAND orcamodel_hofx3D.x )

ecbuild_add_test( TARGET test_orcamodel_3DVar_ice
OMP 1
ARGS testinput/3dvar_ice_obs.yaml
COMMAND orcamodel_3DVar.x )

ecbuild_add_test( TARGET test_orcamodel_Dirac
OMP 1
ARGS testinput/dirac.yaml
COMMAND orcamodel_ErrorCovarianceToolbox.x )
1 change: 1 addition & 0 deletions src/tests/Data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ amm1_coords.nc
amm1_nemo.nc
amm1_atlas_grid_spec.yaml
amm_ssh_obs.nc
sic_obs_ideal.nc
)

foreach(FILENAME ${orcajedi_test_data})
Expand Down
3 changes: 3 additions & 0 deletions src/tests/Data/sic_obs_ideal.nc
Git LFS file not shown
122 changes: 122 additions & 0 deletions src/tests/testinput/3dvar_ice_obs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
cost function:
cost type: 3D-Var
time window:
begin: '2021-06-29T00:00:00Z'
length: P1D
analysis variables: [ice_area_fraction]
background error:
covariance model: SABER
saber central block:
saber block name: ID
saber outer blocks:
- saber block name: BUMP_StdDev
read:
general:
testing: true
io:
data directory: Data
files prefix: test
drivers:
compute variance: true
variance:
explicit stddev: true
stddev:
- variables:
- ice_area_fraction
value: 1
geometry :
nemo variables:
- name: ice_area_fraction
nemo field name: iiceconc
model space: surface
field precision: double
- name: sea_surface_temperature
nemo field name: votemper
model space: surface
field precision: double
- name: sea_water_potential_temperature
nemo field name: votemper
model space: volume
field precision: double
- name: ice_area_fraction_background_error
nemo field name: sic_tot_var
model space: surface
variable type: background variance
field precision: double
grid name: ORCA2_T
number levels: 10
background :
date: 2021-06-29T12:00:00Z
state variables: [ ice_area_fraction ]
nemo field file: Data/orca2_t_nemo.nc
observations:
observers:
- obs space:
name: Sea Ice
obsdatain:
engine:
type: H5File
obsfile: Data/sic_obs_ideal.nc
obsdataout:
engine:
type: H5File
obsfile: testoutput/test_3dvar.nc
simulated variables: [ice_area_fraction]
get values:
time interpolation: linear
atlas-interpolator:
type: unstructured-bilinear-lonlat
non_linear: missing-if-all-missing
max_fraction_elems_to_try: 0.0
# adjoint: true
obs operator:
name: Composite
components:
- name: Identity
obs error:
covariance model: diagonal
variational:
minimizer:
algorithm: DRIPCG
iterations:
- ninner: 1
gradient norm reduction: 1e-30
geometry :
nemo variables:
- name: ice_area_fraction
nemo field name: iiceconc
model space: surface
- name: sea_surface_temperature
nemo field name: votemper
model space: surface
- name: sea_water_potential_temperature
nemo field name: votemper
model space: volume
- name: ice_area_fraction_background_error
nemo field name: sic_tot_var
model space: surface
variable type: background variance
grid name: ORCA2_T
number levels: 10
test: on
online diagnostics:
write increment: true
increment:
state component:
datadir: Data
output path: testoutput/increments_ice
date: 2021-06-30T00:00:00Z
exp: 3dvar.iter1
type: in
final:
diagnostics:
departures: oman
output:
date: 2021-06-30T00:00:00Z
state variables: [ ice_area_fraction ]
nemo field file: testoutput/3dvar_ice
# exp: 3dvar
# steps: ["2021-06-29T12:00:00Z"] # state write not implemented

#test:
# reference filename: testoutput/test_3dvar_ice_obs.ref
2 changes: 2 additions & 0 deletions src/tests/testinput/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ list( APPEND orcajedi_test_input
odb_ice_query.yaml
odb_ice_mapping.yaml
test_name_map.yaml
dirac.yaml
3dvar_ice_obs.yaml
)

foreach(FILENAME ${orcajedi_test_input})
Expand Down
56 changes: 56 additions & 0 deletions src/tests/testinput/dirac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
background error:
covariance model: SABER
saber central block:
saber block name: ID
saber outer blocks:
- saber block name: BUMP_StdDev
read:
general:
testing: true
io:
data directory: Data
files prefix: test
drivers:
compute variance: true
variance:
explicit stddev: true
stddev:
- variables:
- ice_area_fraction
value: 1

dirac:
x indices: [20]
y indices: [10]
z indices: [1]

geometry:
nemo variables:
- name: ice_area_fraction
nemo field name: iiceconc
model space: surface
field precision: double
- name: sea_surface_temperature
nemo field name: votemper
model space: surface
field precision: double
- name: sea_water_potential_temperature
nemo field name: votemper
model space: volume
field precision: double
- name: ice_area_fraction_background_error
nemo field name: sic_tot_var
model space: surface
variable type: background variance
field precision: double
grid name: ORCA2_T
number levels: 10
background:
date: 2021-06-30T12:00:00Z
state variables: [ ice_area_fraction ]
nemo field file: Data/orca2_t_nemo.nc
output dirac:
output path: testoutput/dirac_cov_%id%

#test:
# reference filename: testoutput/test_dirac.ref

0 comments on commit c252483

Please sign in to comment.