ESCOMP / ESCOMP/CTSM

0.01_r8 appears as a magic number in numerous places in the code.

Open
#2,049 0 comments 0 reactions 1 assignee Claimed by @glemieux View on GitHub
code health enhancement
Dominant language
Fortran
Stars
352
Forks
361
Avg merge
6d 6h
Merged PRs (30d)
8

Description

The constant 0.01_r8 is used in multiple places in the code as a magic number. To make the context of the meaning behind the number more obvious it would be good to turn it into a parameter.

There is a defined parameter that might make sense for this in a few files:

src/biogeochem/CNGapMortalityMod.F90: mort_max = 0.01_r8 ! original value for all patches
src/biogeophys/CanopyFluxesMod.F90: real(r8), parameter :: dtmin = 0.01_r8 ! max limit for temperature convergence [K]
src/biogeophys/LakeCon.F90: real(r8), public, parameter :: cur0 = 0.01_r8 ! min. Charnock parameter
src/biogeophys/LunaMod.F90: PARi10 = 0.01_r8
src/biogeophys/LunaMod.F90: PARi10 = 0.01_r8
src/biogeophys/SnowHydrologyMod.F90: real(r8), public, parameter :: scvng_fct_mlt_dst3 = 0.01_r8 ! scavenging factor for dust species 3 inclusion in meltwater [frc]
src/biogeophys/SnowHydrologyMod.F90: real(r8), public, parameter :: scvng_fct_mlt_dst4 = 0.01_r8 ! scavenging factor for dust species 4 inclusion in meltwater [frc]
src/main/atm2lndType.F90: lapse_rate = 0.01_r8)
src/main/clm_varcon.F90: real(r8), public :: watmin = 0.01_r8 ! minimum soil moisture (mm)

There's about 100 references in about 22 files.

I think it's likely that many of these references really refer to watmin.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.