Skip to content

Commit 640ed8e

Browse files
committed
Add identity 3dvar test (old test). Add some halo exchanges when going
from increments to fieldset and vice versa.
1 parent 50d4dfc commit 640ed8e

File tree

7 files changed

+126
-2
lines changed

7 files changed

+126
-2
lines changed

src/orca-jedi/increment/Increment.cc

+6
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ void Increment::axpy(const double & zz, const Increment & dx, const bool check)
355355
std::string fieldName_dx = field_dx.name();
356356
oops::Log::debug() << "orcamodel::Increment::axpy:: field name = " << fieldName
357357
<< " field name dx = " << fieldName_dx
358+
<< " zz = " << zz
358359
<< std::endl;
359360
auto field_view = atlas::array::make_view<double, 2>(field);
360361
auto field_view_dx = atlas::array::make_view<double, 2>(field_dx);
@@ -550,6 +551,8 @@ void Increment::toFieldSet(atlas::FieldSet & fset) const {
550551

551552
fset = atlas::FieldSet();
552553

554+
incrementFields_.haloExchange();
555+
553556
for (size_t i=0; i < vars_.size(); ++i) {
554557
// copy variable from increments to new field set
555558
atlas::Field fieldinc = incrementFields_[i];
@@ -593,6 +596,9 @@ void Increment::fromFieldSet(const atlas::FieldSet & fset) {
593596
}
594597
}
595598
}
599+
600+
incrementFields_.haloExchange();
601+
596602
oops::Log::debug() << "Increment fromFieldSet done" << std::endl;
597603
}
598604

src/tests/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ ecbuild_add_test( TARGET test_orcamodel_3DVar_sic
9696
ARGS testinput/3dvar_sic.yaml
9797
COMMAND orcamodel_3DVar.x )
9898

99+
ecbuild_add_test( TARGET test_orcamodel_3DVar_sic_identity
100+
OMP 1
101+
ARGS testinput/3dvar_sic_identity.yaml
102+
COMMAND orcamodel_3DVar.x )
103+
99104
ecbuild_add_test( TARGET test_orcamodel_Dirac
100105
OMP 1
101106
ARGS testinput/dirac.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
cost function:
2+
cost type: 3D-Var
3+
time window:
4+
begin: '2021-06-29T00:00:00Z'
5+
length: P1D
6+
analysis variables: [ice_area_fraction]
7+
background error:
8+
covariance model: SABER
9+
saber central block:
10+
saber block name: ID
11+
geometry: &Geom
12+
nemo variables:
13+
- name: ice_area_fraction
14+
nemo field name: iiceconc
15+
model space: surface
16+
field precision: double
17+
- name: sea_surface_temperature
18+
nemo field name: votemper
19+
model space: surface
20+
field precision: double
21+
- name: sea_water_potential_temperature
22+
nemo field name: votemper
23+
model space: volume
24+
field precision: double
25+
- name: ice_area_fraction_background_error
26+
nemo field name: sic_tot_var
27+
model space: surface
28+
variable type: background variance
29+
field precision: double
30+
grid name: ORCA2_T
31+
number levels: 10
32+
extrafields initialisation: true
33+
background:
34+
date: 2021-06-29T12:00:00Z
35+
state variables: [ ice_area_fraction ]
36+
nemo field file: Data/orca2_t_nemo.nc
37+
set gmask: true
38+
observations:
39+
observers:
40+
- obs space:
41+
name: Sea Ice
42+
obsdatain:
43+
engine:
44+
type: H5File
45+
obsfile: Data/sic_obs_ideal.nc
46+
obsdataout:
47+
engine:
48+
type: H5File
49+
obsfile: testoutput/obsdataout_3dvar_sic_identity.nc
50+
simulated variables: [ice_area_fraction]
51+
get values:
52+
time interpolation: linear
53+
atlas-interpolator:
54+
type: unstructured-bilinear-lonlat
55+
# non_linear: missing-if-all-missing
56+
max_fraction_elems_to_try: 0.0
57+
adjoint: true
58+
obs operator:
59+
name: Composite
60+
components:
61+
- name: Identity
62+
obs filters:
63+
- filter: Background Check
64+
filter variables:
65+
- name: ice_area_fraction
66+
absolute threshold: 2.0
67+
action:
68+
name: reject
69+
obs error:
70+
covariance model: diagonal
71+
variational:
72+
minimizer:
73+
algorithm: DRPCG
74+
iterations:
75+
- ninner: 1
76+
gradient norm reduction: 1e-30
77+
geometry: *Geom
78+
test: on
79+
online diagnostics:
80+
write increment: true
81+
increment:
82+
state component:
83+
output path: testoutput/increments_3dvar_sic_identity.nc
84+
date: 2021-06-30T00:00:00Z
85+
final:
86+
diagnostics:
87+
departures: oman
88+
output:
89+
date: 2021-06-30T00:00:00Z
90+
state variables: [ ice_area_fraction ]
91+
nemo field file: testoutput/3dvar_sic_identity2.nc
92+
output nemo field file: testoutput/analysis_3dvar_sic_identity.nc
93+
test:
94+
reference filename: testoutput/test_3dvar_sic_identity.ref
95+
test output filename: testoutput/test_3dvar_sic_identity.out

src/tests/testinput/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ list( APPEND orcajedi_test_input
2020
test_name_map.yaml
2121
dirac.yaml
2222
3dvar_sic.yaml
23+
3dvar_sic_identity.yaml
2324
bump_nicas_setup.yaml
2425
)
2526

src/tests/testoutput/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ list( APPEND orcajedi_test_output
1313
test_hofx3d_nc_ssh_amm1.ref
1414
test_hofx3d_nc_ssh_amm1r.ref
1515
test_3dvar_sic.ref
16+
test_3dvar_sic_identity.ref
1617
test_dirac.ref
1718
test_bump_nicas.ref
1819
)

src/tests/testoutput/test_3dvar_sic.ref

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ CostFunction::addIncrement: Analysis:
2121

2222

2323

24-
CostJb : Nonlinear Jb = 0.00000e+00
24+
CostJb : Nonlinear Jb = -2.76549e-03
2525
CostJo : Nonlinear Jo(Sea Ice) = 7.87621e-01, nobs = 47, Jo/n = 1.67579e-02, err = 2.00000e+00
26-
CostFunction: Nonlinear J = 7.87621e-01
26+
CostFunction: Nonlinear J = 7.84855e-01
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CostJb : Nonlinear Jb = 0.0000000000000000e+00
2+
CostJo : Nonlinear Jo(Sea Ice) = 1.4687500000000000e+00, nobs = 47, Jo/n = 3.1250000000000000e-02, err = 2.0000000000000000e+00
3+
CostFunction: Nonlinear J = 1.4687500000000000e+00
4+
DRPCGMinimizer: reduction in residual norm = 7.2399282392205355e-01
5+
CostFunction::addIncrement: Analysis:
6+
Model state valid at time: 2021-06-29T12:00:00Z
7+
1 variables: ice_area_fraction
8+
atlas field norms:
9+
ice_area_fraction: 3.20155e-03
10+
11+
12+
13+
14+
CostJb : Nonlinear Jb = 0.00000e+00
15+
CostJo : Nonlinear Jo(Sea Ice) = 1.10491e+00, nobs = 47, Jo/n = 2.35087e-02, err = 2.00000e+00
16+
CostFunction: Nonlinear J = 1.10491e+00

0 commit comments

Comments
 (0)