Skip to content

Commit

Permalink
Update value for checks%range (#345)
Browse files Browse the repository at this point in the history
# CABLE

Thank you for submitting a pull request to the CABLE Project.

## Description

Fixes #344. Update the namelist provided with the code for the changes
to check%range and other fixes for compatibility with GNU compiler.

## Type of change

Please delete options that are not relevant.

- [X] Bug fix

## Checklist

I have compiled the code and run the Tumbarumba test case with the
updated namelist. The test case finished:
```
 Finished.    36.78621      seconds needed for year
 Finished.    36.78769      seconds needed for        70128  hours
```

Please add a reviewer when ready for review.


<!-- readthedocs-preview cable start -->
----
📚 Documentation preview 📚:
https://cable--345.org.readthedocs.build/en/345/

<!-- readthedocs-preview cable end -->
  • Loading branch information
ccarouge authored Jul 16, 2024
2 parents e521096 + 5cc5ba4 commit c2a54da
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@ CABLE’s time step size is calculated from the first two values of the time var

## Checking ranges

It is possible to check that the ranges of the meteorological variables are physically possible using `check%ranges=.TRUE.` in the `cable.nml` namelist variable.
It is possible to check that the ranges of the meteorological variables are physically possible using `check%ranges=1` or`check%ranges=2` (see [explanation][nml_desc]) in the `cable.nml` namelist variable.

[nml_desc]: cable_nml.md#list-of-namelist-variables
4 changes: 3 additions & 1 deletion documentation/docs/user_guide/inputs/pft_params_nml.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ The CABLE default values of the vegetation parameters in Table 2 for the vegetat


The CABLE distribution provides the default vegetation parameter values from Table 3 in the namelist file pft_params.nml, including the vegetation types from Table 1 in the top part.
The chosen parameter values in offline cases can be checked against the pre-defined realistic parameter value ranges using the CABLE namelist variable check%ranges=.true. in cable.nml.
The chosen parameter values in offline cases can be checked against the pre-defined realistic parameter value ranges using the CABLE namelist variable [`check%ranges`][nml_desc] in cable.nml.

## Example pft_params.nml file

!!! Note "Namelist file format explanation"
Expand Down Expand Up @@ -243,3 +244,4 @@ vegin%zr=1.800000,3.000000,2.000000,2.000000,2.500000,5*0.500000,1.800000,3.1000
| vegin%wai | real | 0.0 – 5.0 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | Wood area index (stem+branches+twigs) (not used) \( (-) \) |
| vegin%xalbnir | real | 0.0 – 1.5 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 | ? (not used) |

[nml_desc]: cable_nml.md#list-of-namelist-variables
2 changes: 1 addition & 1 deletion src/offline/cable.nml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
output%params = .TRUE. ! input parameters used to produce run
output%patch = .TRUE. ! write per patch
output%balances = .TRUE. ! energy and water balances
check%ranges = .FALSE. ! variable ranges, input and output
check%ranges = 0 ! variable ranges, input and output
check%energy_bal = .TRUE. ! energy balance
check%mass_bal = .TRUE. ! water/mass balance
verbose = .TRUE. ! write details of every grid cell init and params to log?
Expand Down
2 changes: 1 addition & 1 deletion src/offline/cable_checks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ SUBROUTINE check_range_d1(vname, parameter_r1, parameter_range, ktau, met)

DO index = 1, SIZE(parameter_r1)
IF (parameter_r1(index) < parameter_range(1) .OR. parameter_r1(index) > parameter_range(2)) THEN
CALL range_abort(vname, ktau, met, parameter_r1(index), \
CALL range_abort(vname, ktau, met, parameter_r1(index), &
parameter_range, index, patch(index)%latitude, patch(index)%longitude)
END IF
END DO
Expand Down
5 changes: 3 additions & 2 deletions src/offline/cable_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ PROGRAM cable_offline_driver
USE cable_IO_vars_module, ONLY: logn,gswpfile,ncciy,leaps, &
verbose, fixedCO2,output,check,patchout, &
patch_type,landpt,soilparmnew,&
defaultLAI, sdoy, smoy, syear, timeunits, exists, calendar, set_group_output_values
defaultLAI, sdoy, smoy, syear, timeunits, exists, calendar, set_group_output_values, &
NO_CHECK
USE casa_ncdf_module, ONLY: is_casa_time
USE cable_common_module, ONLY: ktau_gl, kend_gl, knode_gl, cable_user, &
cable_runtime, filename, myhome, &
Expand Down Expand Up @@ -621,7 +622,7 @@ PROGRAM cable_offline_driver
casamet, casabal, phen, POP, spinup, &
CEMSOIL, CTFRZ, LUC_EXPT, POPLUC )

IF (check%ranges) THEN
IF (check%ranges /= NO_CHECK) THEN
WRITE (*, *) "Checking parameter ranges"
CALL constant_check_range(soil, veg, 0, met)
END IF
Expand Down
2 changes: 1 addition & 1 deletion src/offline/cable_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ SUBROUTINE get_met_data(spinup,spinConv,met,soil,rad, &
! initialise within canopy air temp
met%tvair = met%tk
met%tvrad = met%tk
IF(check%ranges) THEN
IF(check%ranges /= NO_CHECK) THEN
! Check ranges are okay:
CALL check_range("SWdown", met%fsd, ranges%SWdown, 0, met)
CALL check_range("LWdown", met%fld, ranges%LWdown, 0, met)
Expand Down

0 comments on commit c2a54da

Please sign in to comment.