top of page

Example: Maximize flow for a trench section


The F90 code is written by


program app_1

implicit none


real :: x, up, upp, u, dx

real,parameter :: pi = 3.1416

integer :: i


u(x) = (1+cos(x))*sin(x)


! finite difference to find derivative

up(x) = (u(x+dx)-u(x-dx))/2./dx

upp(x) = (u(x+dx)+u(x-dx)-2.*u(x))/dx**2


dx = 1.*pi/180.

x = 45*pi/180.


do i= 1,10

x = x - 0.1*up(x)/upp(x)

print*,'i=',i,'x=',x*180./pi,'u(x)=',u(x)

end do


end program




The solution converges in about 10 iterations, where Theta to maximize flow area is 54.68 degrees giving flow area 1.287 m2.

Recent Posts

See All
bottom of page