New Reply

programming trouble with fortran optimization code

 
Share Thread Thread Tools
Jul18-12, 10:35 AM   #1
 

programming trouble with fortran optimization code


Hi everyone,

I have some trouble adapting an existing fortran code for my application.

In the following Module I am optimizing a value for two planes ( i = iplan one&two).
In order to do that, I need to assign ten certain values from an external inp. file for each plane.

I have two loops, the first one selecting iplan one, respectively two.
In this loop is the second one, which is supposed to read in value one (dcp(i,kl)) to ten.
One value for each run in the secon loop. That means each plane is assign with ten optimization runs, and each run with a certain value.

My problem is, that: read (iread,*) dcp(i,kl) doesn´t work. The read command is linked to
the correct variable in the external inp. file, but I think that there is something wrong with the declaration
of dcp(i,kl)?

Is there anyone who can help me with that problem?
Code:
! note: module inout for iread
    use inout
    integer :: kl, i, iplan, nscwmi=100, determdcp
    real :: xnscwmi, dcp(2,10), fractionvor
    dimension dcp(i,kl)

!for iplan=1 & iplan=2; nscwmi from differnet module 
    i = 1,iplan
        xnscwmi = nscwmi
! determdcp from external inp with determdcp=1
        read(iread,*) determdcp
        if (determsp .eq. 1) go to 501
    continue

    501
    do 502 kl=1, 10
       READ (iread,*)dcp(i,kl)

        fractionvor = xnswmi
        xnscwmi = fractionvor/10

        ai   = xnscwmi*d(i,kl)+0.75
        imax = int(ai)
        ..
        ....
        b0(i) = 0.
        a0(i) = imax
        a1 (i)    = a1(i)+ a0(i)

Thanks!
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Heat-related deaths in Manhattan projected to rise
>> Dire outlook despite global warming 'pause': study
>> Sea level influenced tropical climate during the last ice age
Jul26-12, 07:56 AM   #2
 
The declaration here seems strange.

Code:
! note: module inout for iread
    use inout
    integer :: kl, i, iplan, nscwmi=100, determdcp
    real :: xnscwmi, dcp(2,10), fractionvor
    dimension dcp(i,kl)
Try instead

Code:
! note: module inout for iread
    use inout
    integer :: iplan, determdcp
    integer, parameter :: kl = 10
    integer, parameter :: i = 2
    integer, parameter :: nscwmi = 100

    real :: xnscwmi, fractionvor
    real, dimension(i,kl) :: dcp
Let me know how that works out.
 
New Reply
Thread Tools


Similar Threads for: programming trouble with fortran optimization code
Thread Forum Replies
Optimization of C code: smoothing an image. Engineering, Comp Sci, & Technology Homework 25
Optimization of C Code Loop Unrolling Engineering, Comp Sci, & Technology Homework 10
Checking programming code: fortran 95 Programming & Comp Sci 2
Convert latex code to fortran code? Math & Science Software 1
Optimization Code Mechanical Engineering 7