CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   iteration of loop in FORTRAN language (https://www.cfd-online.com/Forums/main/131462-iteration-loop-fortran-language.html)

saida29 March 15, 2014 06:30

iteration of loop in FORTRAN language
 
Hello

how I can write in FORTRAN an iterative loop that stops when the convergence condition is satisfied. The convergence condition is: the difference between the two values ​​obtained by two successive iteration (X (iter2)-X (iter1)) is low in the order of [10] [-3].
thank you very much

cfdnewbie March 15, 2014 11:48

http://en.wikibooks.org/wiki/Fortran/Fortran_control

This should answer your question!

saida29 March 15, 2014 13:22

hello
thank you very much for the reply.
i calculate the velocity. I want to express the difference between two values ​​for two successive iteration if the difference is we stopped the iteration if not the calculated repeats

cfdnewbie March 15, 2014 13:28

Well, you have already described the algorithm:
compute the difference, compare it to some threshold and abort the computation or continue...
I'm not sure what it is that confuses you...

saida29 March 15, 2014 13:49

hello
yes that's what i want to calculate. i don't know how to write that the value of the velocity of the first iteration is the old one and the value of the second iteration is the new one and the convergence this the new - the old
thank you

cfdnewbie March 15, 2014 14:44

This is very basic stuff. I suggest you work through something like this: http://www.cs.mtu.edu/~shene/COURSES...S/fortran.html

This will enable you to do want you intend to do!


All times are GMT -4. The time now is 05:47.