Opened 7 years ago
Closed 7 years ago
#799 closed bug (Done)
VERY IMPORTANT: Corrected Bug in inp_decode.F
| Reported by: | arango | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Release ROMS/TOMS 3.7 |
| Component: | Nonlinear | Version: | 3.7 |
| Keywords: | Cc: |
Description (last modified by )
In src:ticket:798, I introduced a new routined inp_decode.F to decode ROMS KeyWord parameters from input script files. All the decoding routines are now inside a module to impose the strong typing capabilities of Fortran 1990, 1995, 2003, and beyond. Also, it allows having mixed precision in ROMS floating-point variables when the SINGLE_PRECISION is activated.
Its interface has been updated to include scalar arguments. It has the following module procedures:
INTERFACE load_i
MODULE PROCEDURE load_0d_i ! scalar integer
MODULE PROCEDURE load_1d_i ! 1D integer array
MODULE PROCEDURE load_2d_i ! 2D integer array
MODULE PROCEDURE load_3d_i ! 3D integer array
END INTERFACE load_i
INTERFACE load_l
MODULE PROCEDURE load_0d_l ! scalar logical
MODULE PROCEDURE load_1d_l ! 1D logical array
MODULE PROCEDURE load_2d_l ! 2D logical array
MODULE PROCEDURE load_3d_l ! 3D logical array
END INTERFACE load_l
INTERFACE load_r
#ifdef SINGLE_PRECISION
MODULE PROCEDURE load_0d_dp ! scalar real(dp)
MODULE PROCEDURE load_1d_dp ! 1D real(dp) array
MODULE PROCEDURE load_2d_dp ! 2D real(dp) array
MODULE PROCEDURE load_3d_dp ! 3D real(dp) array
#endif
MODULE PROCEDURE load_0d_r8 ! scalar real(r8)
MODULE PROCEDURE load_1d_r8 ! 1D real(r8) array
MODULE PROCEDURE load_2d_r8 ! 2D real(r8) array
MODULE PROCEDURE load_3d_r8 ! 3D real(r8) array
END INTERFACE load_r
There were bugs in nesting applications for the case that all the standard input parameters are not specified for each nested grid. In the past, we have the capability that if not all the needed values for an input parameter are not specified, it assumed the last value for the rest of the array.
This shorthand capability is restored. Many thanks to John Warner for bringing this to my attention. I didn't notice it since I always specify all the parameter for each grid for style and to indicate the user how many input parameters are needed.
For esample, load_3d_i now has:
!
! Local variable declarations.
!
integer :: i, ic
integer :: Nout, Nval
!
integer, dimension(Iout*Jout*Kout) :: Vwrk
!
!-----------------------------------------------------------------------
! Load 3D integer variable with input values.
!-----------------------------------------------------------------------
!
! If not all values are provided for variable, assume the last value
! for the rest of the 3D array.
!
ic=0
Nout=Iout*Jout*Kout
IF (Ninp.le.Nout) THEN
DO i=1,Ninp
ic=ic+1
Vwrk(i)=INT(Vinp(i))
END DO
DO i=Ninp+1,Nout
ic=ic+1
Vwrk(i)=INT(Vinp(Ninp))
END DO
ELSE
DO i=1,Nout
ic=ic+1
Vwrk(i)=INT(Vinp(i))
END DO
END IF
Vout=RESHAPE(Vwrk,(/Iout,Jout,Kout/))
Nval=ic
!
RETURN
Notice that everything is now processed in a local 1D vector (Vwrk) and then reshaped for the desired 3D vector Vout. This is similar to what Fortran 77 used to do but with modules checking the size and scope of the arguments. Modern Fortran is much better and allows compilers to check the arguments with strict compiling flags.
WARNING:
If you use nesting, I highly recommend updating your code. Otherwise, the input parameters will be wrong if you use shorthand specification of the input parameters.
Also, corrected WRF Perl script ESM/wrf_Conf.pl so the other of the HDF5 libraries is changed to -lhdf5_hl -lhdf5 instead of -lhdf5 -lhdf5_hl. The order matter in some computers operating systems.
Consolidated checkdefs.F in all the repositories. There are different versions in each repository and I keep reverting to the previous revision. This happens when you have many research repositories.
Updated cppdefs.h to add C-preprocessing EXCLUDE_SPONGE to exclude sponge points in export fields during coupling.
Change History (1)
comment:1 by , 7 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → Done |
| Status: | new → closed |
