Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitialized variables in NGEN/Snow-17 #50

Closed
drakest123 opened this issue Sep 7, 2024 · 2 comments
Closed

Uninitialized variables in NGEN/Snow-17 #50

drakest123 opened this issue Sep 7, 2024 · 2 comments

Comments

@drakest123
Copy link
Contributor

The values of precip_scf(nh) and forcing%pa are initialized as huge(1.0) but never overwritten in the NGEN/Snow-17 executable.

Current behavior

When compiling Snow-17 with NGEN, the precip_scf output value in the cat-*.csv file is "inf".

Expected behavior

The precip_scf output value should not be "inf"

Nature of the problem

The value of precip_scf(nh) is initialized as huge(1.0) in forcingType.f90::initForcing() but never overwritten:

this%precip_scf(:)     = huge(1.0)

forcingType.f90::initForcing(): this%precip_scf(:):    3.40282347E+38

When this value is multiplied by the catchment area, it becomes "inf".

In contrast, when snow-17 is run without NGEN, it calls read_areal_forcing(). This is where precip_scf and forcing_pa(nh) are initialized:

      forcing%precip_scf(nh) = forcing%precip(nh) * parameters%scf(nh)   ! scale input precip by snow correction factor
                                                                         ! (note: this is for output; model input
                                                                         ! precip is scaled in pack19()

      call sfc_pressure(parameters%elev(nh), forcing%pa(nh))             ! fill in the surface pressure field

Solution

Minimally, precip_scf(nh) must be initialized. For completeness, the surface pressure field should also be initialized although It is not clear that it is used.

@andywood
Copy link
Contributor

andywood commented Sep 7, 2024 via email

@drakest123
Copy link
Contributor Author

Yes, that is the same problem. I tested your file changes and they worked. I will close this comment. BTW, I'm working on another issue with units and I'll post that in case you've encountered it. I've seen some scuttlebutt on this issue but I don't know if it has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants