NOAA-OWP / snow17

Other
4 stars 10 forks source link

3 bug fixes and 2 documentation typos #40

Closed drakest123 closed 1 month ago

drakest123 commented 1 month ago

@SnowHydrology: 3 bug fixes and 2 documentation typos. The three bug fixes were documented in Issues 37, 38 and 39.

Bug fix 1

When compiling Snow-17 with an M3 Max CPU I get the following error: % make -f Makefile.local gfortran -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all -march=native -c ..//src/snow19//zero19.f ..//src/snow19//rout19.f ..//src/snow19//aesc19.f ..//src/snow19//melt19.f ..//src/snow19//SNEW.f ..//src/snow19//SNOWT.f ..//src/snow19//SNOWPACK.f ..//src/snow19//adjc19.f ..//src/snow19//aeco19.f ..//src/snow19//updt19.f ..//src/snow19//SNDEPTH.f ..//src/snow19//PACK19.f ..//src/snow19//exsnow19.f -I/opt/homebrew/include gfortran -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all -c ..//src/share//nrtype.f90 ..//src/share//constants.f90 ..//src/share//namelistModule.f90 ..//src/share//parametersType.f90 ..//src/share//forcingType.f90 ..//src/share//dateTimeUtilsModule.f90 ..//src/share//runInfoType.f90 ..//src/share//modelVarType.f90 ..//src/share//ioModule.f90 ..//src/share//runSnow17.f90 ..//src/bmi//bmi.f90 ..//src/bmi//bmi_snow17.f90 ..//src/driver//driver_bmi.f90 -I/opt/homebrew/include gfortran -fPIC -I/opt/homebrew/include -L/opt/homebrew/lib -o ..//bin//snow17.exe *.o Undefined symbols for architecture arm64: "_is_recursive.12.0", referenced from: ___forcingtype_MOD_initforcing in forcingType.o ___forcingtype_MOD_initforcing in forcingType.o ___forcingtype_MOD_initforcing in forcingType.o "_is_recursive.14.0", referenced from: ___modelvartype_MOD_initmodelvar in modelVarType.o ___modelvartype_MOD_initmodelvar in modelVarType.o ___modelvartype_MOD_initmodelvar in modelVarType.o ld: symbol(s) not found for architecture arm64 collect2: error: ld returned 1 exit status make: *** [link] Error 1

Resolution:

In share/forcingType.f90 change: class(forcing_type), intent(out) :: this to: class(forcing_type), intent(inout) :: this In share/modelVarType.f90 change: class(modelvar_type), intent(out) :: this to class(modelvar_type), intent(inout) :: this

These changes make these two class declarations consistent with similar files.

Bug fix 2

Building Snow-17 (standalone) on a PC in Visual Studio using the Intel Fortran compiler produces an error in updt19.f at line 50: Error #6633: The type of the actual argument differs from the type of dummy argument. [LIQW]

Resolution:

The error is caused because LIQW is implicitly INTEGER type. This error was fixed by add at line 25 of updt19.f:

REAL LIQW

Bug fix 3

When building Snow-17 (standalone) on a PC in Visual Studio using the Intel Fortran compiler, the program fails to read forcing data files and crashes. In file ioModule.f90, subroutine init_forcing_files(), the integer ios is not initialized and acquires an unrestricted value with this compiler.

Resolution:

Add at line 175: ios = 0

Typos

Testing

The 3 bug fixes were tested on MacOS and Windows computers by comparing the output of data in the ex1 directory. The output of the two runs was the same within roundoff error.

Target Environment support

SnowHydrology commented 1 month ago

@drakest123 I closed this PR because you were trying to merge changes from master into another branch called develop.

To make these changes you'll need to:

  1. Sync your fork with the upstream repo
  2. Pull any code updates to your computer (assumes you have your fork and the OWP set up as remotes)
  3. Check out a new branch from master
  4. Make and commit all necessary changes
  5. Push changes
  6. Open PR using GitHub