📄 fd2d_prb.f90
字号:
subroutine u_init ( alpha, beta, gamma, delta, m, n, x, y, u0 )!*****************************************************************************80!!! U_INIT supplies the initial value of U at each node.!! Modified:!! 01 August 2004!! Author:!! John Burkardt!! Parameters:!! Input, real ( kind = 8 ) ALPHA, BETA, GAMMA, DELTA, the parameters.!! Input, integer M, N, the number of rows and columns.!! Input, real ( kind = 8 ) X(M,N), Y(M,N), the X and Y coordinates! of the nodes.!! Output, real ( kind = 8 ) U0(M,N), the initial value of U at the nodes.! implicit none integer m integer n real ( kind = 8 ) alpha real ( kind = 8 ) beta real ( kind = 8 ) delta real ( kind = 8 ) gamma real ( kind = 8 ) u0(m,n) real ( kind = 8 ) ustar real ( kind = 8 ) x(m,n) real ( kind = 8 ) y(m,n) ustar = gamma * alpha / ( beta - gamma ) u0(1:m,1:n) = ustar - 2.0D-07 & * ( x(1:m,1:n) - 0.1D+00 * y(1:m,1:n) - 225.0D+00 ) & * ( x(1:m,1:n) - 0.1D+00 * y(1:m,1:n) - 675.0D+00 ) returnendsubroutine v_init ( alpha, beta, gamma, delta, m, n, x, y, v0 )!*****************************************************************************80!!! V_INIT supplies the initial value of U at each node.!! Modified:!! 30 November 2004!! Author:!! John Burkardt!! Parameters:!! Input, real ( kind = 8 ) ALPHA, BETA, GAMMA, DELTA, the parameters.!! Input, integer M, N, the number of rows and columns.!! Input, real ( kind = 8 ) X(M,N), Y(M,N), the X and Y coordinates! of the nodes.!! Output, real ( kind = 8 ) V0(M,N), the initial value of U at the nodes.! implicit none integer m integer n real ( kind = 8 ) alpha real ( kind = 8 ) beta real ( kind = 8 ) delta real ( kind = 8 ) gamma real ( kind = 8 ) ustar real ( kind = 8 ) v0(m,n) real ( kind = 8 ) vstar real ( kind = 8 ) x(m,n) real ( kind = 8 ) y(m,n) ustar = gamma * alpha / ( beta - gamma ) vstar = ( 1.0D+00 - ustar ) * ( alpha + ustar ) v0(1:m,1:n) = vstar - 3.0D-05 * ( x(1:m,1:n) - 450.0D+00 ) & - 1.2D-04 * ( y(1:m,1:n) - 150.0D+00 ) returnend
subroutine timestamp ( )
!*****************************************************************************80
!
!! TIMESTAMP prints the current YMDHMS date as a time stamp.
!
! Example:
!
! May 31 2001 9:45:54.872 AM
!
! Modified:
!
! 15 March 2003
!
! Author:
!
! John Burkardt
!
! Parameters:
!
! None
!
implicit none
character ( len = 40 ) string
call timestring ( string )
write ( *, '(a)' ) trim ( string )
return
end
subroutine timestring ( string )
!*****************************************************************************80
!
!! TIMESTRING writes the current YMDHMS date into a string.
!
! Example:
!
! STRING = 'May 31 2001 9:45:54.872 AM'
!
! Modified:
!
! 15 March 2003
!
! Author:
!
! John Burkardt
!
! Parameters:
!
! Output, character ( len = * ) STRING, contains the date information.
! A character length of 40 should always be sufficient.
!
implicit none
character ( len = 8 ) ampm
integer d
character ( len = 8 ) date
integer h
integer m
integer mm
character ( len = 9 ), parameter, dimension(12) :: month = (/ &
'January ', 'February ', 'March ', 'April ', &
'May ', 'June ', 'July ', 'August ', &
'September', 'October ', 'November ', 'December ' /)
integer n
integer s
character ( len = * ) string
character ( len = 10 ) time
integer values(8)
integer y
character ( len = 5 ) zone
call date_and_time ( date, time, zone, values )
y = values(1)
m = values(2)
d = values(3)
h = values(5)
n = values(6)
s = values(7)
mm = values(8)
if ( h < 12 ) then
ampm = 'AM'
else if ( h == 12 ) then
if ( n == 0 .and. s == 0 ) then
ampm = 'Noon'
else
ampm = 'PM'
end if
else
h = h - 12
if ( h < 12 ) then
ampm = 'PM'
else if ( h == 12 ) then
if ( n == 0 .and. s == 0 ) then
ampm = 'Midnight'
else
ampm = 'AM'
end if
end if
end if
write ( string, '(a,1x,i2,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) &
trim ( month(m) ), d, y, h, ':', n, ':', s, '.', mm, trim ( ampm )
return
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -