Fortran Fortran Forum for Programming Help: Resources, Tips, and Support

  • Thread starter Thread starter FUNKER
  • Start date Start date
  • Tags Tags
    Fortran Forum
AI Thread Summary
The discussion revolves around programming in Fortran, specifically addressing issues related to Fortran 77 and 90/95. A user seeking help with array declarations and common blocks encounters multiple errors in their code. Key points include the importance of correctly declaring arrays and understanding the limitations of common blocks in Fortran. It is emphasized that array dimensions must be defined using integer values, and the use of floating-point numbers for array sizes is incorrect. The conversation also touches on the need for proper syntax, such as starting code lines in the correct column to avoid compilation errors. Users are advised to break down their programming tasks into manageable steps, utilize pseudocode for clarity, and compile code frequently to identify errors early. Additionally, there are discussions about the inability to dynamically allocate memory in Fortran 77, contrasting it with more modern versions that allow for such flexibility. The thread concludes with inquiries about breaking loops in subroutines and plotting functions, indicating ongoing challenges faced by users in mastering Fortran programming.
  • #151
Hi.
I have a problem with getting started. I am using Linux (however its my first day) and Eclipse. I have Phortan installed. I was going step by step with:
http://wiki.eclipse.org/PTP/photran/documentation/photran6#Starting_a_New_Project
i got to point 15. I save that file. Then I don't know what do next. Here is the screenshot with console view, and with my error which pops up when I press "run" button:
[PLAIN]http://img638.imageshack.us/img638/3829/screenshotaqb.png

I used only MVS C# before, and I don't really know how that compiler stuff work... In C# was enough to press "build and run" button.

I hope someone can help me.

Tom :)
 
Last edited by a moderator:
Technology news on Phys.org
  • #152
Hi there,
I have a source code which I want to compile it on Windows.
I've tried the Intel Visual Compiler 11 but I got many errors.
here is code:
http://www.shahabfar.com/dragon.rar"
I wonder if somebody compile it on Windows and let me know my problem.
Thank you in advance
 
Last edited by a moderator:
  • #153
Hello. I am running a Fortran 90 code. It runs, but I get the following error messages. Does anyone know how to help me figure out where my mistake is? I think I am replying when what I want to do is post a new thread. Sorry about that. Thanks in advance for any help!


forrtl: severe (64): input conversion error, unit 10, file C:\Fem605\Wrk\ft10.d
Image PC Routine Line Source
FEM6.exe 004CCEB9 Unknown Unknown Unknown
FEM6.exe 004CCCEB Unknown Unknown Unknown
FEM6.exe 004CBEF4 Unknown Unknown Unknown
FEM6.exe 004CC329 Unknown Unknown Unknown
FEM6.exe 004BF5D1 Unknown Unknown Unknown
FEM6.exe 004BE91F Unknown Unknown Unknown
FEM6.exe 00433102 Unknown Unknown Unknown
FEM6.exe 004305F6 Unknown Unknown Unknown
FEM6.exe 0042E664 Unknown Unknown Unknown
FEM6.exe 00413CED Unknown Unknown Unknown
FEM6.exe 00443755 Unknown Unknown Unknown
FEM6.exe 004F1769 Unknown Unknown Unknown
FEM6.exe 004E5964 Unknown Unknown Unknown
kernel32.dll 7D4E7D42 Unknown Unknown Unknown

C:\Fem605\Wrk>del fname.d

C:\Fem605\Wrk>del mpower2.d

C:\Fem605\Wrk>del FT90.d

C:\Fem605\Wrk>del ft10.d

C:\Fem605\Wrk>del ft11.d

C:\Fem605\Wrk>del ft16.d

C:\Fem605\Wrk>del ft17.d

C:\Fem605\Wrk>del ft18.d

C:\Fem605\Wrk>del fort.19
Could Not Find C:\Fem605\Wrk\fort.19

C:\Fem605\Wrk>del C:\FEM605\Wrk\outp\mpower2.ft20
Could Not Find C:\FEM605\Wrk\outp\mpower2.ft20

C:\Fem605\Wrk>rem ////// FEMAXI-6 Calc. completed ! ///////

C:\Fem605\Wrk>
 
  • #154
Fortran 77 variables values can not be recognized

Hi,

I am writing a program that uses an external file 'parameter.f' to specify my inputs.

Example of parameter.f
PARAMETER (LA=6D-2)
PARAMETER (LB=6D-2)
PARAMETER (LC=6D-2) ...

In my main program:

DOUBLE PRECISION LA, LB, LC
INCLUDE 'parameter.f'
**** main program continues
CALL subroutineA(...)
***
END of main program

For my subroutineA, it will call another subroutineC that will take inputs LA, LB, LC
Example of subroutineA:
subroutineA()
INCLUDE 'parameter.f'
...
call subroutineC(LA, LB, LC)
...
END of subroutineA

I realize that the LA, LB, LC values specified as 0.06, will be recognized as zero value
in the subroutine. Hence, zero values will be past to the subroutineC when it is called by
subroutineA.

I have been trying to figure out the bug of this program... but
eventually how I solve the problem is change the variable names.

I have changed LA, LB, LC for my program to AL, BL, CL instead and it works!
There is no change in the calling of subroutine, main structure of program.

It is strange to me as the beginner of Fortran that I can ignore this and continue for my simulation. But I hardly accept the fact that I can simply solve this problem by just changing the name of variables...

I appreciate if anyone has the similar experience and please share with me. Thank you.
 
  • #155
hendraarkan said:
i'm heading a problem in mathematical equation about the initial condition, what methode should we used if there is an addition force, such as damping force. This equation will be applied to performed oscillatory system in fortran language programme .

What is your main concern about solving the differential equation? I thought with the differential equation, you can apply ODE methods like Euler, Runge-Kutta and etc. that can solve the initial value problem even though it has damping force.

Perhaps you concern is over the convergence of solution and its stability. you may refer to numerical recipe textbook for reference on solving this type of problem.
 
  • #156
How to solve this in fortran?

a=∏_(k=1)^(n-1)*((2x+10)/(k-3)) ^(2/k)
 
  • #157
Hi guys,
I'm working in some code for my PhD and I would like continue the calculi once it stoped. The point is that I am saving some information and I would like the continuation code would be able to find automatically the last file written. The structure of the backup file is "rra_00000.dat" where follow the format '(A,I5.5,A)' and I don't know how to say to the compiler that took the last file written
 
  • #158
Hi,
I have written a code, which is divided into 5 different files:
Element_data.f90, Check_criteria.f90, Read_in.f90, Service_subs.f90 and main.f90.

All files contain one module each, exept main.f90, which is the program and where
all the modules are referenced to via an include command.

I am trying to create a makefile for this. It seems to work, the program is compiled,
but when I change the order of the include commands in main.f90, suddenly Check_criteria cannot acces shared variables from element_data any more. This can't be right. Anybody can help?
Oh, I am using the f90 compiler for hp unix. This is my makefile so far, this is the first time I am trying to create one. I left the lines from previous tries in it. Thanks!:

Debugopts = -g

Main: Main.o
f90 Main.o -o $@

Main.o: Element_data.f90 Check_criteria.f90 Service_subs.f90\
Read_in.f90 Main.f90
f90 $(Debugopts) Main.f90


#Element_data.o: Element_data.f90
# f90 $(Debugopts) Element_data.f90

#Check_criteria.o: Element_data.f90 Check_criteria.f90
# f90 $(Debugopts) Check_criteria.f90
#
#Service_subs.o: Element_data.f90 Service_subs.f90
# f90 $(Debugopts) Service_subs.f90

#Read_in.o: Element_data.f90 Service_subs.f90 Read_in.f90
# f90 $(Debugopts) Read_in.f90

#Main.o: Element_data.f90 Check_criteria.f90 Service_subs.f90\
# Read_in.f90

#Element_data.o: Element_data.f90


#Check_criteria.o: Element_data.f90

#Service_subs.o: Element_data.f90


#Read_in.o: Element_data.o Service_subs.f90

clean:
rm *.o
cleanall:
rm *.o Main
 
  • #159


GohJQ said:
Hi,

I am writing a program that uses an external file 'parameter.f' to specify my inputs.

Example of parameter.f
PARAMETER (LA=6D-2)
PARAMETER (LB=6D-2)
PARAMETER (LC=6D-2) ...

In my main program:

DOUBLE PRECISION LA, LB, LC
INCLUDE 'parameter.f'
**** main program continues
CALL subroutineA(...)
***
END of main program

For my subroutineA, it will call another subroutineC that will take inputs LA, LB, LC
Example of subroutineA:
subroutineA()
INCLUDE 'parameter.f'
...
call subroutineC(LA, LB, LC)
...
END of subroutineA

I realize that the LA, LB, LC values specified as 0.06, will be recognized as zero value
in the subroutine. Hence, zero values will be past to the subroutineC when it is called by
subroutineA.

I have been trying to figure out the bug of this program... but
eventually how I solve the problem is change the variable names.

I have changed LA, LB, LC for my program to AL, BL, CL instead and it works!
There is no change in the calling of subroutine, main structure of program.

It is strange to me as the beginner of Fortran that I can ignore this and continue for my simulation. But I hardly accept the fact that I can simply solve this problem by just changing the name of variables...

I appreciate if anyone has the similar experience and please share with me. Thank you.

Statement PARAMETER in fortran is used just to assign a name to a number, but not to assign a value to identifier

So in your code you should not define LA, LB, LC as doubles, you should not define them at all.
At the beginning the following strings are complitely enough
PARAMETER (LA=6D-2)
PARAMETER (LB=6D-2)
PARAMETER (LC=6D-2)
You cannot use LA,LB,LC as formal arguments, as common block elements or as variables.
If you write in the any place of your code

RL=LA

it would be the same as if you have written

RL=6D-2

The substitution will be made by COMPILER during compilation. No other use for LA,LB,LC is allowed. Understand?

More tips: Parameter statement preseeds all other declarations, therefore if RR is declared then it CANNOT be used in parameter statement.

In you case you should remove parameter statements and use value assignment statements
LA=6D-2
LB=6D-2
LC=6D-2
instead (place it after all declarations)
 
  • #160
rfmergarejo said:
Hi guys,
I'm working in some code for my PhD and I would like continue the calculi once it stoped. The point is that I am saving some information and I would like the continuation code would be able to find automatically the last file written. The structure of the backup file is "rra_00000.dat" where follow the format '(A,I5.5,A)' and I don't know how to say to the compiler that took the last file written
During execution let your program open an additional ASCII file "My-states" and each time when you save the state of your data into file "rra_00000...dat" write down this name
into "My-states" file. Then the next time you run your code you can get info about the
last file written from the "My-states".
 
  • #161
Ma_He said:
Hi,
I have written a code, which is divided into 5 different files:
Element_data.f90, Check_criteria.f90, Read_in.f90, Service_subs.f90 and main.f90.

All files contain one module each, exept main.f90, which is the program and where
all the modules are referenced to via an include command.

I am trying to create a makefile for this. It seems to work, the program is compiled,
but when I change the order of the include commands in main.f90, suddenly Check_criteria cannot acces shared variables from element_data any more. This can't be right. Anybody can help?
Oh, I am using the f90 compiler for hp unix. This is my makefile so far, this is the first time I am trying to create one. I left the lines from previous tries in it. Thanks!:

Debugopts = -g

Main: Main.o
f90 Main.o -o $@

Main.o: Element_data.f90 Check_criteria.f90 Service_subs.f90\
Read_in.f90 Main.f90
f90 $(Debugopts) Main.f90


#Element_data.o: Element_data.f90
# f90 $(Debugopts) Element_data.f90

#Check_criteria.o: Element_data.f90 Check_criteria.f90
# f90 $(Debugopts) Check_criteria.f90
#
#Service_subs.o: Element_data.f90 Service_subs.f90
# f90 $(Debugopts) Service_subs.f90

#Read_in.o: Element_data.f90 Service_subs.f90 Read_in.f90
# f90 $(Debugopts) Read_in.f90

#Main.o: Element_data.f90 Check_criteria.f90 Service_subs.f90\
# Read_in.f90

#Element_data.o: Element_data.f90


#Check_criteria.o: Element_data.f90

#Service_subs.o: Element_data.f90


#Read_in.o: Element_data.o Service_subs.f90

clean:
rm *.o
cleanall:
rm *.o Main

If you have referenced (included) the source code of your subroutines into the end of your main program text then the command f90 Main.f90 -o name_for_my_prog
should create executable.
 
  • #162
hello friends,
i am new in Fortran programming. Actually i would like to read multiple data files. For reading a single file i have written a small pro-gramme as mentioned below

! PROGRAM FOR RANGE_RESIDUAL


! DEFINING COLUMNS
! // Number SampleTime Delay Code AmbF SpCF SpTF CorF KD-1 RecF ToneLevel CodeLevel PhaseError ToneLoopSN CDownModIndex
! C1 C2,C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16


!1110 ROWS AFTER HEADER AND 16 COLUMS AS DEFINED ABOVE

DOUBLE PRECISION :: C2,C3,C12,C13,C14,C15,C16,C10,C4
INTEGER :: C1,C5
CHARACTER :: C6*4,C7*6,C8*6,C9*6,C11*5,files
OPEN(1,file = 'M32ICL1L1A_RGX_041920603_00.RAW')
DO IROW=1,190
READ(1,*)
ENDDO


OPEN(2,FILE='FROW')
READ(2,*)FR
DO I=192,FR

READ(1,777)C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14, &
C15,C16
777 FORMAT(5x,I4,2x,F9.0,F10.3,E22.13,I6,A4,3(A6),E24.13,A5, &
F23.1,F22.3,F22.3,F22.12,F22.3)
write(*,778)C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14, &
C15,C16
778 FORMAT(I4,1x,F9.0,F10.3,E22.13,1X,I6,A4,3(A6),E24.13,A5, &
F23.1,F22.3,F22.3,F22.12,F22.3)


ENDDO


STOP
END

This is the file ( M32ICL1L1A_RGX_041920603_00.RAW) containing header information, like wise i have , multipal files. So is there anybody who can help me, by telling how to read number of files ?

Thanks in advance !

Ashok Verma
ashokverma.iitkgp@gmail.com
 
  • #163
Do somebody knows about fortran IV?
 
  • #164
Hello evryone, can you help me with this question in Fortran code... Thank you so much...

Is it possible if we use the same number for 2 different file as below (file 10 used for both "2d.in" and "gr.001"?
open(10,file='2din')

read(10,*) dx,dz
read(10,*) nx,nz
read(10,*) tmax,hifreq
close(10)

open(10,file='gr.001',form='unformatted',
* access='direct',recl=4*nz)
 
  • #165
Yes, this should work, because you close the first file before opening the second one.

It's been many years since I last programmed seriously in Fortran, but I'm pretty sure I did the same thing myself, sometimes.
 
  • #166
thank you so much...
Well, you had a great experience in programming... I'm just a baby in this field... I feel very confused... Why did they use the same name for 2 different file? I think there are some relations... Do you think so?
 
  • #167
Hello,

I would like to know if in sequential access mode to a file, it is possible to overwrite a given record in the middle of the file, while keeping all the subsequent records.

When I write a record in the middle of an existing file, it makes the file to terminate imediatly after the record I've just written.

Thanks in advance
 
  • #168
salparadise said:
Hello,

I would like to know if in sequential access mode to a file, it is possible to overwrite a given record in the middle of the file, while keeping all the subsequent records.

When I write a record in the middle of an existing file, it makes the file to terminate imediatly after the record I've just written.

Thanks in advance
Show us your code that does this.
 
  • #169
Nphung78 said:
Why did they use the same name for 2 different file? I think there are some relations... Do you think so?

I can't read minds, so I can only guess. It might be that the two files are simply parts of the same data set, so that they could have just as well been in one file to begin with. Or maybe the programmer simply preferred to use as few input unit numbers as possible.
 
  • #170
Mark44 said:
Show us your code that does this.

Hope this is comprehensible, I'm posting only the relevant part of the code. This code is intended to change parameters value in a file with following structure:

--------------------------------------------------------------------------------
...
Block Minpar

# comment:
# parameter_id parameter_value
3 23.45 # This parameter is...
...
---------------------------------------------------------------------------------




OPEN(file_id,FILE=file,STATUS='unknown',IOSTAT=ios,)

DO
READ(file_id,'(A100)',IOSTAT=ios),line

If((line(1:1)=='#').OR.(line(1:1)=='')) Cycle

IF (line(1:12)=='BLOCK MINPAR') THEN
DO
Read(file_id,'(a100)'),line
IF (line(1:5)=='BLOCK') EXIT
If ((line(1:1)=='#').OR.(line(1:1)=='')) Cycle
BACKSPACE(file_id)

READ(file_id,*) param_id,param_value
rest_line=line(INDEX(line,'#'):)

IF ((parameter_name=='m0').AND.(param_id==1)) THEN
BACKSPACE(file_id)
WRITE(file_id,'(A,I5,A)') achar(9),param_id,achar(9), new_parameter_value, achar(9)//TRIM(rest_line)

[...]
 
  • #171
jtbell said:
I can't read minds, so I can only guess. It might be that the two files are simply parts of the same data set, so that they could have just as well been in one file to begin with. Or maybe the programmer simply preferred to use as few input unit numbers as possible.

Yes, you are right, jtbell. After several days working on this, I also guess that programmer used "10" as a number for input file...
Thank you so much...:smile:

Now, I have problem with open "unformatted file". I can not open it by normal text editor as notepad... The output file is also in "unformatted"... What can I deal with them, pls give me some directions...

Thanks in advance!
 
  • #172
Hi
could u please help me out with following simple fortran programme
i am getting small error in calculating cosine of 270 deg, Ideally answer should be zero but i am getting -3.65E-08. how to get exact cosine of 270deg

I am using compaq visual fortran



Subroutine CONSTANTS()
REAL PI,RtoD,DtoR
PI=4.0*ATAN(1.0)
RtoD=180.0/PI
DtoR=PI/180.0

Print*,Cos(270.0*DtoR)
End

Answer = -3.65E-08
 
  • #173
Your variables are single-precision (4-byte) reals, so your answer isn't too far off from zero. For more precision, try using 8-byte reals, like this:
Code:
REAL*8 PI, RtD, DtR
You still might not get zero, but you should get something that is closer to zero than what you got.
 
  • #174
sine(270) give correct amnswer Why not cosine
 
  • #175
Is there any setting in compiler for example Math files needs to be included.
 
  • #176
Hi I have problems with passing arrays from module to the main code.My module:
module s2em
contains

c ---------------------------
subroutine sensd2emod_mod1(iper,as1,as2)
c ---------------------------
c Sensitivities of the E-mode impedances with respect to the
c conductivities of homogeneous subdomains of the 2D model. Here,
c geomagnetic transfer functions (induction arrows) are not considered!
c
use constants
use settings
use params
use mt2dmod
use fdsystem
use mt2ddat
use mt2dsens
c
implicit none
c
integer*4 iper,m2,ma1,iprd0,i,i1,i2,ik1,ik0,ik2,iprd,j
real*4 period,cof,spom,dw,k,e,e1
complex*8 sensv(nmax,(nmax-2)*(mmax-2)),sensw_t,sensw_c,sensw_b
complex*8 v((nmax-2)*(mmax-2)),rp((nmax-2)*(mmax-2))
complex*8 q0,q1,q2,hy,zxy,sens_zxy
complex*8 zpom(nmax)
real,dimension(20,21) :: apr1dsens,apr2dsens
real,dimension(20,21),intent(out) :: as1,as2
c
period=per(iper)
c
c Pre-compute the site and MT function-specific vectors for sensitivity
c computations first. Only the "sites of interest" are treated here which
c were specified on the input
cof=1250.*period/(pi*pi)
m2=m-2
ma1=ma-1
sensv=0.
iprd0=0
c write(50,'("---- E-mode impedance, period",f10.4)')period
do i=1,nsites
c
c Only sites from within the internal nodes of the mesh are considered.
c Sites on the margins (1, N) are omitted.
if(isit(i).gt.1.and.isit(i).lt.n)then
i1=isit(i)-1
i2=i1+1
ik1=(isit(i)-2)*m2+ma1
ik0=ik1-1
ik2=ik1+1
q0=imc*cof*sz(ma)/(sz(ma1)*(sz(ma1)+sz(ma)))
q2=-imc*cof*sz(ma1)/(sz(ma)*(sz(ma1)+sz(ma)))
spom=(sy(i1)*cond(ic(ma,i1))+sy(i2)*cond(ic(ma,i2)))/
& (sy(i1)+sy(i2))
dw=500.*sz(ma1)*sz(ma)*spom/(sz(ma1)+sz(ma))
q1=-(q0+q2)+dw
hy=q0*b(ik0)+q1*b(ik1)+q2*b(ik2)
c
c E-mode impedance
zxy=b(ik1)/hy
zmd2p(i,1)=prev_zunit*real(zxy)
zmd2p(i,2)=prev_zunit*aimag(zxy)
k=period/(2*mu0)
aprph1d(i,1)=k*(real(zxy)**2+aimag(zxy)**2)
aprph1d(i,2)=atan(aimag(zxy)/real(zxy))
rewind(41)
rewind(42)
read(41,*)data(i,1)
read(42,*)data(i,2)
dmf(i,1)=data(i,1)-aprph1d(i,1)
dmf(i,2)=data(i,2)-aprph1d(i,2)
write(116,*)dmf(i,1)
write(116,*)dmf(i,2)
e=(real(zxy)**2+aimag(zxy)**2)
e1=1/e
c
zpom(i)=zxy/hy
write(30,'(f12.4,2i5,2e15.6)')period,isit(i),iprd0,
& prev_zunit*zxy
sensv(i,ik0)=-zpom(i)*q0
sensv(i,ik1)=1./hy-zpom(i)*q1
sensv(i,ik2)=-zpom(i)*q2
if(ircpr.ne.0)then
v=0.
v(ik0)=sensv(i,ik0)
v(ik1)=sensv(i,ik1)
v(ik2)=sensv(i,ik2)
call gsres0el(v)
sensv(i,:)=v
endif
else
write(*,*)' Site positioned at a margin',isit(i)
endif
enddo
c write(51,'("---- E-mode sensits, period",f10.4)')period
c
c Loop over all conductivity domains flagged for sensitivity
c evaluations
do i=1,nc
if(ivarp(i).ne.0)then
iprd=ivarp(i)
call rp2emod(iprd,period,rp)
v=rp
if(ircpr.eq.0)call gsres0el(v)
do j=1,nsites
if(isit(j).gt.1.and.isit(j).lt.n)then
i1=isit(j)-1
i2=i1+1
ik1=(isit(j)-2)*m2+ma1
ik0=ik1-1
ik2=ik1+1
if(ircpr.eq.0)then
sens_zxy=sensv(j,ik0)*v(ik0)+
& sensv(j,ik1)*v(ik1)+
& sensv(j,ik2)*v(ik2)
else
sens_zxy=dot_product(conjg(sensv(j,1:nk)),v(1:nk))
endif
sensw_t=0.
sensw_c=0.
if(ic(ma,i1).eq.iprd)then
sensw_c=sensw_c+500.*sz(ma1)*sz(ma)*sy(i1)/
& ((sz(ma1)+sz(ma))*(sy(i1)+sy(i2)))
endif
if(ic(ma,i2).eq.iprd)then
sensw_c=sensw_c+500.*sz(ma1)*sz(ma)*sy(i2)/
& ((sz(ma1)+sz(ma))*(sy(i1)+sy(i2)))
endif
sensw_b=0.
c
c Sensitivity of the E-mode impedance with respect to the CONDUCTIVITY
c of the domain IPRD
sens_zxy=sens_zxy-zpom(j)*
& (sensw_t*b(ik0)+
& sensw_c*b(ik1)+
& sensw_b*b(ik2))
c
c If the sensitivity of the E-mode impedance with respect to the RESISTIVITY
c of the domain IPRD is required
if(.not.lcondder)then
sens_zxy=-sens_zxy/res(iprd)**2.
endif
c
c Sensitivity of the E-mode impedance with respect to IPRD on the output
c and then stored in ZMD1PSENS (indices 1,2)
write(31,'(f12.4,2i5,2e15.6)')period,isit(j),iprd,
& prev_zunit*sens_zxy
zmd1psens2(j,1,iprd)=prev_zunit*real(sens_zxy)
zmd1psens2(j,2,iprd)=prev_zunit*aimag(sens_zxy)
e=(real(zxy)**2+aimag(zxy)**2)
e1=1/e
apr1dsens(j,iprd)=2*e*(real(sens_zxy)*real(zxy)+
& aimag(sens_zxy)*aimag(zxy))
apr2dsens(j,iprd)=e1*(aimag(sens_zxy)*real(zxy)-
& aimag(zxy)*real(sens_zxy))
write(114,*)apr1dsens(j,iprd)
write(114,*)apr2dsens(j,iprd)
c
else
c
c Sites at any of the margins are not considered here
write(*,*)' Site positioned at a margin',isit(j)
c
endif
enddo
endif
enddo

as1=apr1dsens
as2=apr2dsens
return

end subroutine
end module
 
  • #177
It calculates arrays apr1dsens and apr2dsens over 2 loops,I do not how to define as1 and as2.This way It gives stupid results on the output.
 
  • #178
This thread is over five years old and has been resuscitated many many times by people finding it in Google searches or something. If you want to post a question about Fortran programming, please go to the parent forum

https://www.physicsforums.com/forumdisplay.php?f=165

and start a new thread (topic) by clicking the "New Topic" button. Give your new thread a suitably descriptive title.
 

Similar threads

Replies
16
Views
5K
Replies
13
Views
4K
Replies
14
Views
3K
Replies
5
Views
3K
Replies
4
Views
38K
Replies
11
Views
6K
Back
Top