地板怎么没有主型呢?
/home/disk/p/atms380/xx/October-Runs/timeManMod/SourceMods/time_manager.F90(664):
error #6404: This name does not have a type, and must have an explicit
type. [FLOOR]
tmd = day_earth/PLANET_DAY_RATIO - floor(day_earth/PLANET_DAY_RATIO)
我正在使用 ifort 编译器运行 Fortran 90。据我所知,floor是Fortran 90中引入的函数
Using Fortran compiler: ifort -O -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/src/include -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/build/linux_intel -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/include -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/src/Infrastructure/mpiuni
Fortran Compiler version:
Intel(R) Fortran Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064
==
这就是我在子例程中定义PLANET_DAY_RATIO的方式:
subroutine get_curr_date(yr, mon, day, tod, offset)
! Return date components valid at end of current timestep with an optional
! offset (positive or negative) in seconds.
implicit none
! Arguments
integer, intent(out) ::&
yr, &! year
mon, &! month
day, &! day of month
tod ! time of day (seconds past 0Z)
integer, optional, intent(in) :: offset ! Offset from current time in seconds.
! Positive for future times, negative
! for previous times.
! Local variables
character(len=*), parameter :: sub = 'get_curr_date'
integer :: rc
type(esmf_date) :: date
type(esmf_time) :: off
integer :: ymd
integer :: leap_days
integer :: yZero
integer :: day_earth
float :: PLANET_DAY_RATIO
(stuff)
yr = ymd/10000
mon = mod(ymd, 10000) / 100
day = mod(ymd, 100)
PLANET_DAY_RATIO = 0.5 !0.5 is for spinning twice as fast, or 43200 seconds
yZero = start_ymd/10000
leap_days = (yr -yZero)/4
day_earth = day_earth + 365*(yr -yZero) + leap_days
tmd = day_earth/PLANET_DAY_RATIO - floor(day_earth / PLANET_DAY_RATIO)
end subroutine get_curr_date
/home/disk/p/atms380/xx/October-Runs/timeManMod/SourceMods/time_manager.F90(664):
error #6404: This name does not have a type, and must have an explicit
type. [FLOOR]
tmd = day_earth/PLANET_DAY_RATIO - floor(day_earth/PLANET_DAY_RATIO)
I'm running Fortran 90 with the ifort compiler. As far as I can tell, floor is a function introduced in Fortran 90
Using Fortran compiler: ifort -O -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/src/include -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/build/linux_intel -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/include -I/home/disk/eos11/bitz/cam3.1/cam1/models/utils/esmf/src/Infrastructure/mpiuni
Fortran Compiler version:
Intel(R) Fortran Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064
==
This is how I defined the PLANET_DAY_RATIO in the subroutine:
subroutine get_curr_date(yr, mon, day, tod, offset)
! Return date components valid at end of current timestep with an optional
! offset (positive or negative) in seconds.
implicit none
! Arguments
integer, intent(out) ::&
yr, &! year
mon, &! month
day, &! day of month
tod ! time of day (seconds past 0Z)
integer, optional, intent(in) :: offset ! Offset from current time in seconds.
! Positive for future times, negative
! for previous times.
! Local variables
character(len=*), parameter :: sub = 'get_curr_date'
integer :: rc
type(esmf_date) :: date
type(esmf_time) :: off
integer :: ymd
integer :: leap_days
integer :: yZero
integer :: day_earth
float :: PLANET_DAY_RATIO
(stuff)
yr = ymd/10000
mon = mod(ymd, 10000) / 100
day = mod(ymd, 100)
PLANET_DAY_RATIO = 0.5 !0.5 is for spinning twice as fast, or 43200 seconds
yZero = start_ymd/10000
leap_days = (yr -yZero)/4
day_earth = day_earth + 365*(yr -yZero) + leap_days
tmd = day_earth/PLANET_DAY_RATIO - floor(day_earth / PLANET_DAY_RATIO)
end subroutine get_curr_date
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你没有看对错误!
变量 PLANET_DAY_RATIO 未正确声明:float 不是有效的实数声明。请将float替换为real。
关于编译器的令人惊讶的警告,这仅仅是因为函数 FLOOR 是通用的:编译器需要知道参数的类型才能选择正确的 FLOOR 变体函数。由于参数不正确,编译器推断 FLOOR 是程序的标识符(是的!它被授权声明与 Fortran 内部函数名称匹配的变量或函数,因为 Fortran 是一种没有保留关键字的语言)。
You are not looking at the right mistake !
The variable PLANET_DAY_RATIO is not correctly declared : float is not a valid real number declaration. Replace float by real please.
About the surprising warning of the compiler, it is simply due to the fact that the function FLOOR is generic : the compiler needs to know the type of the argument to select the right FLOOR variant function. As the argument was incorrect, the compiler has deduced that FLOOR was an identifier of your program (yes ! it is authorized to declare variables or functions which match Fortran intrinsic function names because Fortran is a language without reserved keyword).