[Fortran] 纯文本查看 复制代码
!传递函数a
subroutine a(inc,theta0,point0,point2,point3)
implicit none
real :: inc
real :: aa(2,2)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
aa(1,1) = 1
aa(1,2) = -m23
aa(2,1) = 1
aa(2,2) = -tan(0.5*(theta0+inc))
return
end subroutine
!传递函数b
subroutine b(inc,theta0,point0,point2,point3)
implicit none
real inc
real :: bb(2)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
bb(1) = point3(4)-m23*point3(3)
bb(2) = point0(2)-tan(0.5*(theta0+inc))*point0(1)
return
end subroutine
!左行壁面进程
subroutine wall_plus(theta0,point0,point2,point3)
include "link_fnl_shared.h"
use numerical_libraries
use linear_operators
use operation_ix
use operation_t
real theta0,point0(2),point2(4),point3(4)
real theta_new,point_new(2),old_theta,old_point(2)
real th,tol
real results(2)
th = 1.0e-7
tol = 1.0e3
theta_new = theta0
point_new(1) = point0(1)
point_new(2) = point0(2)
do while(tol>th)
old_point = point_new
old_theta = theta_new
inc = theta_new
call a(inc,theta0,point0,point2,point3)
call b(inc,theta0,point0,point2,point3)
point_new = aa .ix. bb
theta_new = point2(1)+sqrt(((point_new(1)-point2(3))**2+(point_new(2)-point2(4))**2)/&
((point3(3)-point2(3))**2+(point3(4)-point2(4))**2))*(point3(1)-point2(1))
tol=max(abs(point_new(1)-old_point(1)),abs(point_new(2)-old_point(2)))
tol=max(tol,abs(theta_new-old_theta))
end do
results(1) = theta_new
results(2) = .t. point_new
end subroutine
[Fortran] 纯文本查看 复制代码
module dataMod
implicit none
real :: inc,aa(2,2),bb(2)
contains
!传递函数a
subroutine a(theta0,point0,point2,point3)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
aa(1,1) = 1
aa(1,2) = -m23
aa(2,1) = 1
aa(2,2) = -tan(0.5*(theta0+inc))
end subroutine a
!传递函数b
subroutine b(theta0,point0,point2,point3)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
bb(1) = point3(4)-m23*point3(3)
bb(2) = point0(2)-tan(0.5*(theta0+inc))*point0(1)
end subroutine b
!左行壁面进程
subroutine wall_plus(theta0,point0,point2,point3,theta_new,point_new)
include "link_fnl_shared.h"
use linear_operators
implicit none
real theta0,point0(2),point2(4),point3(4)
real theta_new,point_new(2),old_theta,old_point(2)
real , parameter :: th = 1.0e-7
real tol
tol = 1.0e3
theta_new = theta0
point_new(:) = point0(:)
do while(tol>th)
old_point = point_new
old_theta = theta_new
inc = theta_new
call a(theta0,point0,point2,point3)
call b(theta0,point0,point2,point3)
point_new = aa .ix. bb
theta_new = point2(1)+sqrt(((point_new(1)-point2(3))**2+(point_new(2)-point2(4))**2)/&
((point3(3)-point2(3))**2+(point3(4)-point2(4))**2))*(point3(1)-point2(1))
tol=max(abs(point_new(1)-old_point(1)),abs(point_new(2)-old_point(2)))
tol=max(tol,abs(theta_new-old_theta))
end do
end subroutine wall_plus
end module dataMod