|
[Sponsors] |
May 1, 2012, 18:36 |
convergence criteria
|
#1 |
New Member
ramila.h
Join Date: Dec 2010
Posts: 29
Rep Power: 15 |
I am trying to write a convergence criteria for a code ans I really need your help to do so
it's like (tempnew-tempold) less than 1e-6 do k=1,mstep do i=0,n do j=0,n temp(0,0)=0.0 temp(i,j)=th(i,j) diff=temp(i,j)-temp1(i,j) enddo enddo temp1=temp if (diff.lt.temp1e-6)then stop endif enddo Last edited by afnene; May 1, 2012 at 18:40. Reason: error |
|
May 1, 2012, 22:48 |
|
#2 |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
Your logic doesn't make sense.
do k=1,mstep do i=0,n do j=0,n temp(0,0)=0.0 <-- Why is this inside the loop; doesn't depend on i, j, or k temp(i,j)=th(i,j) <-- What is "th"? It is never used diff=temp(i,j)-temp1(i,j) <-- You calculate "diff" inside the loop and do nothing with it; it's not an array so it will be erased each time the loop is incremented enddo enddo temp1=temp <-- What is this supposed to do? if (diff.lt.temp1e-6)then <-- "diff" is meaningless here since it is only that value for i=j=n stop endif enddo To check time convergence you could do something like: maxdiff=0.0 do i=0,n do j=0,n diff=abs(tempnew(i,j)-tempold(i,j)) if (diff>maxdiff) then maxdiff=diff end if end do end do if (maxdiff<1.0e-6) then stop end if |
|
May 2, 2012, 15:40 |
|
#3 |
New Member
ramila.h
Join Date: Dec 2010
Posts: 29
Rep Power: 15 |
Thank you so much for your precious help
I am just a beginner in CFD computation, The first step I did was to try how convergence can be written in a code Please tell me how to read the old a new value of temperature inside iterrations? |
|
May 2, 2012, 15:47 |
|
#4 | |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
Quote:
1. Initialize T and TO 2. According to your numerical model find a new temperature field T 3. Check convergence between T and TO (see my previous post) 3a. If converged, exit 3b. If not converged, transfer T to TO and go to step 2 |
||
May 2, 2012, 16:05 |
|
#5 |
New Member
ramila.h
Join Date: Dec 2010
Posts: 29
Rep Power: 15 |
Thanks again,
I will do what you explained and let you know if it works for me |
|
May 2, 2012, 18:36 |
|
#6 |
New Member
ramila.h
Join Date: Dec 2010
Posts: 29
Rep Power: 15 |
Well, It sounds working,but I really want that you check that with me and of course if you don't mind
the subroutine which compute temperature is as following: subroutine tcalcu(f,temp,temp1,n,m) real f(0:8,0:n,0:m),temp(0:n,0:m),temp1(0:n,0:m) temp1=temp do j=0,m do i=0,n sum=0.0 do k=0,8 sum=sum+f(k,i,j) end do temp(i,j)=sum enddo enddo I called 'temp1' the new temperature value and insert it inside the subroutine and 'temp' as an old value......does it make sense? return end |
|
May 6, 2012, 23:52 |
|
#7 |
Senior Member
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 17 |
Your subroutine seems to be doing what you intend, but I can't really say if it is "correct" without knowing a bit more about what sort of algorithm you are using. So you are filling in temp1 with the existing temp array, i.e. as an old value. Then you update temp as the sum of all the local elements of f. If that is what you intend, then you are good.
|
|
May 7, 2012, 19:21 |
|
#8 |
New Member
ramila.h
Join Date: Dec 2010
Posts: 29
Rep Power: 15 |
It worked fine, I checked that by printing old and new values of temperature.
Thanks again Cdegroot, you were very helpful. Afnene |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convergence | Centurion2011 | FLUENT | 48 | June 15, 2022 00:29 |
SIMPLE algorithm, convergence criteria | bbasal | Main CFD Forum | 3 | December 3, 2011 00:24 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 23:03 |
What value shall I set for the Convergence criteria? | steventay | CFX | 7 | May 14, 2010 13:44 |
Convergence Criteria | edwin | FLUENT | 1 | February 14, 2008 20:24 |