Skip to content

Commit 3699359

Browse files
authored
Remove default value constituent overwrite (#374)
Tag name (required for release branches): sima0_04_001 Originator(s): peverwhee Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): Removes the behavior in read_data that overwrites constituent values that aren't found on the snapshot file with the default value. @boulderdaze ran into this problem - it was overwriting the constituents she had initialized in the init phase. Also removes some diagnostic variables from the Hack shallow snapshot test output - closes #375 Describe any changes made to build system: none Describe any changes made to the namelist: none List any changes to the defaults for the input datasets (e.g. boundary datasets): none List all files eliminated and why: none List all files added and what they do: none List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) M cime_config/testdefs/testmods_dirs/cam/outfrq_hack_shallow_derecho/user_nl_cam - remove diagnostic variables that do not have history_out_field calls in the source code (scheme not part of test SDF) M src/data/write_init_files.py - remove the "if (has_default)" block (instead, do nothing because the constituent object routines will have already initialized the constituent to the default. M test/unit/python/sample_files/write_init_files/physics_inputs_*.F90 - fix tests to match new output If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: All PASS derecho/gnu/aux_sima: SMS_Ln2.ne3pg3_ne3pg3_mg37.FPHYStest.derecho_gnu.cam-outfrq_hack_shallow_derecho (Overall: DIFF) - this PR established new baseline due to change in test name (+ removed history fields) - confirmed that the non-reproducible output issue has been resolved. If this changes climate describe any run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced: n/a CAM-SIMA date used for the baseline comparison tests if different than latest:
1 parent ba6d73a commit 3699359

18 files changed

+18
-162
lines changed

cime_config/testdefs/testlist_cam.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<option name="comment">Test for Zhang McFarlane physics</option>
5353
</options>
5454
</test>
55-
<test compset="FPHYStest" grid="ne5_ne5_mg37" name="SMS_Ln2" testmods="cam/outfrq_hack_shallow_derecho">
55+
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_hack_shallow_derecho">
5656
<machines>
5757
<machine name="derecho" compiler="gnu" category="aux_sima"/>
5858
</machines>

cime_config/testdefs/testmods_dirs/cam/outfrq_hack_shallow_derecho/user_nl_cam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ hkconv_c0 = 1.0e-4
2929
! history fields for CAM4 Hack shallow convection
3030
hist_output_frequency;h1: 1*nsteps
3131
hist_max_frames;h1: 1
32-
hist_add_inst_fields;h1: CMFDT,CMFDQ,CMFDLIQ,CMFDICE,CMFDQR,DQP,ICWMRSH,CMFSL,CMFLQ,FREQSH,EVAPTCM,FZSNTCM,EVSNTCM,HKNTPRPD,HKNTSNPD,HKFLXPRC,HKFLXSNW,HKEIHEAT,EVAPQCM,PRECSH,CMFMCSH,CMFMC,CLDTOP,CLDBOT,PCLDTOP,PCLDBOT,ZMDLF,SHDLF
32+
hist_add_inst_fields;h1: CMFDT,CMFDQ,CMFDLIQ,CMFDICE,CMFDQR,DQP,ICWMRSH,CMFSL,CMFLQ,FREQSH,EVAPTCM,FZSNTCM,EVSNTCM,HKNTPRPD,HKNTSNPD,HKFLXPRC,HKFLXSNW,HKEIHEAT,EVAPQCM,PRECSH,CMFMCSH
3333
hist_precision;h1: REAL64

src/data/write_init_files.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,16 +1133,7 @@ def write_phys_read_subroutine(outfile, host_dict, host_vars, host_imports,
11331133
outfile.write("if (constituent_errflg /= 0) then", 4)
11341134
outfile.write("call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)", 5)
11351135
outfile.write("end if", 4)
1136-
outfile.write("if (constituent_has_default) then", 4)
1137-
outfile.write("call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)", 5)
1138-
outfile.write("if (constituent_errflg /= 0) then", 5)
1139-
outfile.write("call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)", 6)
1140-
outfile.write("end if", 5)
1141-
outfile.write("field_data_ptr(:,:,constituent_idx) = constituent_default_value", 5)
1142-
outfile.write("if (masterproc) then", 5)
1143-
outfile.write("write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value", 6)
1144-
outfile.write("end if", 5)
1145-
outfile.write("else", 4)
1136+
outfile.write("if (.not. constituent_has_default) then", 4)
11461137
outfile.comment("Intialize to constituent's configured minimum value", 5)
11471138
outfile.write("call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)", 5)
11481139
outfile.write("field_data_ptr(:,:,constituent_idx) = constituent_min_value", 5)

test/unit/python/sample_files/write_init_files/physics_inputs_4D.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_bvd.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_cnst.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_ddt.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_ddt2.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_ddt_array.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
204204
if (constituent_errflg /= 0) then
205205
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
206206
end if
207-
if (constituent_has_default) then
208-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
209-
if (constituent_errflg /= 0) then
210-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
211-
end if
212-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
213-
if (masterproc) then
214-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
215-
end if
216-
else
207+
if (.not. constituent_has_default) then
217208
! Intialize to constituent's configured minimum value
218209
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
219210
field_data_ptr(:,:,constituent_idx) = constituent_min_value

test/unit/python/sample_files/write_init_files/physics_inputs_host_var.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,7 @@ subroutine physics_read_data(file, suite_names, timestep, read_initialized_varia
201201
if (constituent_errflg /= 0) then
202202
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
203203
end if
204-
if (constituent_has_default) then
205-
call const_props(constituent_idx)%default_value(constituent_default_value, constituent_errflg, constituent_errmsg)
206-
if (constituent_errflg /= 0) then
207-
call endrun(constituent_errmsg, file=__FILE__, line=__LINE__)
208-
end if
209-
field_data_ptr(:,:,constituent_idx) = constituent_default_value
210-
if (masterproc) then
211-
write(iulog,*) 'Constituent ', trim(std_name), ' initialized to default value: ', constituent_default_value
212-
end if
213-
else
204+
if (.not. constituent_has_default) then
214205
! Intialize to constituent's configured minimum value
215206
call const_props(constituent_idx)%minimum(constituent_min_value, constituent_errflg, constituent_errmsg)
216207
field_data_ptr(:,:,constituent_idx) = constituent_min_value

0 commit comments

Comments
 (0)