Hopper
Likes Dirt
I'm doing some university work at the moment and we are learning about programming in Fortran.
What I am mainly having trouble with is how to find the root of a function (which is set in a function module).
I'm trying to work out the width of a channel in Manning's equation (y)
The equation is 0=(1/n)*wy*((wy)/(w+2y))^(2/3)*s^.5-Q
If I know all the variables except y how do I find y using the Bisection Method?
Generally this is what I will have
<Main Program which calls upon subroutine which intern calls upon my finction>
function func(Q,w,y,s,n) (here is where my problem is, how do I specify later that I will be finding y?)
<set variables here>
<above function>
endfunction func
subroutine Bisection
implicit none (will this effect already set values for the same variables used earlier?)
<set variables here>
<use the code that will determine where graph intersects line>
write(6,*) <above answer>
end subroutine Bisection
To people who do know fortran, if you don't get what I mean sorry, I will try to state my question again if asked.
What I am mainly having trouble with is how to find the root of a function (which is set in a function module).
I'm trying to work out the width of a channel in Manning's equation (y)
The equation is 0=(1/n)*wy*((wy)/(w+2y))^(2/3)*s^.5-Q
If I know all the variables except y how do I find y using the Bisection Method?
Generally this is what I will have
<Main Program which calls upon subroutine which intern calls upon my finction>
function func(Q,w,y,s,n) (here is where my problem is, how do I specify later that I will be finding y?)
<set variables here>
<above function>
endfunction func
subroutine Bisection
implicit none (will this effect already set values for the same variables used earlier?)
<set variables here>
<use the code that will determine where graph intersects line>
write(6,*) <above answer>
end subroutine Bisection
To people who do know fortran, if you don't get what I mean sorry, I will try to state my question again if asked.