Just a general answer : Fortran is "Turing complete", like many other programming languages. It means it can be used to program any programmable subject, including combustion.
Now, programming a combustion code is too vague. For instance, I programmed myself, in two different ways, H2...
I tried to compile your program
The compilation fails because of the two wrong statements :
open(unit=8, file=C:\Users\ema\Desktop\ema.txt)
open(unit=9, file=C:\Users\ema\Desktop\risultato.txt)
The right syntax is :
open(unit=8, file="C:\Users\ema\Desktop\ema.txt")
open(unit=9...
Please, try to start your home work alone. If you have difficulties, then show us what you have done and what troubles you meet. Maybe, somebody will provide advices...
For the moment, you have done nothing so do not expect any help at such insufficient stage !
François Jacq
Advice : do not allocate pointer variables. Allocate only allocatable variables. If you apply that carefully, then your memory leaks will disappear automatically.
Caution : I do not say that you cannot use pointer. You can of course but just to point to a memory zone already allocated...
Impossible to say without examing the code.
But in general, it is better to implement yourself parallel instructions using OpenMP for instance. This is much more efficient than automatic parallelization. But this is not easy to do.
François Jacq
@zmth END SUBROUTINE and END FUNCTION are REQUIRED in modules. Only the names of the subroutines or functions are optional ! For END MODULE, the keyword MODULE as well as the module name are optional.
Example with INTEL compiler :
module test
contains
subroutine titi
end
end...
@salgerman : the syntax rk=(2,0) is correct
program t
complex r
r=(2,0)
write(*,*) r
end program
root@pctoutou:/media/sda6/test # gfortran t.f90
root@pctoutou:/media/sda6/test # ./a.out
( 2.00000000 , 0.00000000 )
François Jacq
I think that the problem is just related 0**val . If val is an integer value greater that 0, then the result is 0 of course. But if val is a real value, then the compiler may interpret this expression as exp(val*log(0)) which is NaN.
In addition I find really strange the instruction "rk=2*0"...
@Bosse7 : making gx%bmperr private is no sense in OpenMP : what about the other data within gx ? gx is a whole. It must be either private or public.
François Jacq
@zmth : your examples are always wrong.
Instead of :
module
contains
subroutine sub1(i)
i=1
end
end
you should write :
module my_module
contains
subroutine sub1(i)
i=1
end subroutine
end module
=> a module must have a name. And within a module, a subroutine must...
Fortran deallocates automatically only allocatable objects, not pointers. So, if C has been allocated, then nullify(C) is not enough. You must first deallocate each sub-pointer (if allocated) and then deallocate C at the end of the process to free the memory.
@harphool it is usually better to...
Could you please show us an exact piece of your source file including spaces : you have an icon enabling to display the source code correctly.
François Jacq
The two message are quite explicit :
- PAUSE is an old statement which does not belong to the language anymore. But this is just a warning...
- you cannot have simultaneously a subroutine and a common block having the same name. This is really an error. Fix it please...
François Jacq
SkipVought is right : we don't intend to to your home work.
Anyway, I am less rigourous : If you show us what you have done up to now and if you are able to explain clearly the trouble you meet and all the attempts you have done to solve them, then perhaps, I could provide few advices...
Taking into account your declaration, the right loop to initialize the string is :
do cntr = 1, n
stars(cntr:cntr) = '*'
end do
They are other ways too. The simplest one :
stars=REPEAT('*',n)
Frantois Jacq
please, start you program with "implicit none"
I suspect that the variable cntr is not declared integer. In addition, I would like to see the declaration of "n"
Frantois Jacq
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.