地板怎么没有主型呢?

发布于 2024-12-07 23:54:44 字数 2054 浏览 0 评论 0原文

/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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2024-12-14 23:54:44

你没有看对错误!

变量 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文