- #141
Anglea
- 89
- 0
please try to make your own thread, and upload your question there, anyway I think you need to compile by the following commaand
f95nag file_name
f95nag file_name
main_program
c
complex*16 A(m1,m2), Mat
EXTERNAL Mat
c
A = MainMat(n,m)
.
..
end
complex*16 function Mat(n,m)
c calculate the elemnts of Mat
Mat = A
.
end
complex*16 A, Mat
C then I call it as
A = MainMat(S1,S2)
do i = 1,N
do j = 1,M
write(7,*) A(i,j)
end do
end do
Mark44 said:What does the code for your function MainMat look like? When you say that your nested loop in your last code example "doesn't work" what does that mean? Does it produce any results or no results? Did you set N and M? You don't show these variables being initialized.
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 .
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.
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 namerfmergarejo 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
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
Show us your code that does this.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
Nphung78 said:Why did they use the same name for 2 different file? I think there are some relations... Do you think so?
Mark44 said:Show us your code that does this.
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.
REAL*8 PI, RtD, DtR