CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   residual storage in FLUENT (https://www.cfd-online.com/Forums/fluent/46096-residual-storage-fluent.html)

sophie September 20, 2007 21:45

residual storage in FLUENT
 
residual storage in FLUENT?

i can't find residual values in my dat files,what's wrong???

can anyone tell me why?

thanks a lot!

Joe September 21, 2007 05:08

Re: residual storage in FLUENT
 
you need to tell fluent to store the residuals in the dat file.

sophie September 21, 2007 05:11

Re: residual storage in FLUENT
 
how to tell fluent to store the residuals in the dat file?

i'm not so familar with the TUI,can you tell me?


mAx September 21, 2007 06:08

Re: residual storage in FLUENT
 
The following steps can be used to write the solution residuals to a text file.

1. Read the case/data files in FLUENT.

2. Read the Scheme file (init.scm) using the File-->Read-->Scheme command. The content of the Scheme file should be as follows (please copy the content between the dashed line into a text file and save it as 'init.scm'):

-------------------------------------------------------------- (define port) (set! port (open-output-file "residuals.dat"))

(do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (car (list-ref (solver-residuals) i))) ) (newline port) ---------------------------------------------------------------

3. Set the following execute command at every iteration using Solve --> Execute Commands:

file read-journal residual.jou

The content of the journal file (residual.jou) should be as follows (please copy the content between the dashed line into a text file and save it as 'residual.jou'):

--------------------------------------------------------------- (do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (cdr (list-ref (solver-residuals) i))) ) (newline port) ---------------------------------------------------------------

4. Now compute the solution using the Solve->Iterate command. This will write out a text file ('residuals.dat') containing the solution residual history.

sophie September 21, 2007 23:48

Re: residual storage in FLUENT
 
thanks a lot!

that really works well!

but how to write these scheme command lines?

or must i learn the scheme language?

i have some german document,but i don't say german...

any suggestions?

sophie September 24, 2007 21:02

Re: residual storage in FLUENT
 
new question:

now i have to execute the storage process through TUI, but it interrupts with the following error message:

Error: A journal is currently open for input or output. You cannot read and write a journal at the same time, or read two journals simultaneously. Error Object: #f

can anybody give me some advices?

urgent sophie

sophie September 24, 2007 21:17

Re: residual storage in FLUENT
 
now i want to describe me error exactly:

i want to store the residual which print in console to be a file,but my process is executed though TUI,i write these commands in my journal file:

;-------------------------------------------------------------- (define port) (set! port (open-output-file "residuals.dat"))

(do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (car (list-ref (solver-residuals) i))) ) (newline port)

(cx-gui-do cx-activate-item "MenuBar*SolveMenu*Execute Commands...")

(cx-gui-do cx-set-integer-entry "Execute Commands*IntegerEntry1(Defined Commands)" 1)

(cx-gui-do cx-activate-item "Execute Commands*IntegerEntry1(Defined Commands)")

(cx-gui-do cx-set-toggle-button "Execute Commands*Frame2*Table2*CheckButton6" #f)

(cx-gui-do cx-activate-item "Execute Commands*Frame2*Table2*CheckButton6")

(cx-gui-do cx-set-text-entry "Execute Commands*Frame2*Table2*TextEntry10" "(do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (cdr (list-ref (solver-residuals) i))) ) (newline port)")

(cx-gui-do cx-activate-item "Execute Commands*PanelButtons*PushButton1(OK)")

(cx-gui-do cx-activate-item "Solution Initialization*PanelButtons*PushButton2(Cancel)")

solve/initialize/compute-defaults/pressure-far-field

solve/iterate 20 ;--------------------------------------------------- but the error message:

Error: eval: unbound variable Error Object: ~a

Warning: An error or interrupt occurred while reading the journal file. Some commands may not have been completed.

if i change the line contain ~a to be:

(cx-gui-do cx-set-text-entry "Execute Commands*Frame2*Table2*TextEntry10" "file read-journal residual.jou")

and in the content of the residual.jou is as follows

;--------------------------------------------------------------- (do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (cdr (list-ref (solver-residuals) i))) ) (newline port) ;---------------------------------------------------------------

the error message: file read-journal Error: A journal is currently open for input or output. You cannot read and write a journal at the same time, or read two journals simultaneously. Error Object: #f residual.jou invalid command [residual.jou]

can you give me some advices?

thanks a lot!

sophie


mostafadehghani.62 May 12, 2014 02:24

i have this problem too. there is any alternative for using "" in scheme?

agari April 5, 2016 22:22

How to add time step or time flow before the residuals??
 
Quote:

Originally Posted by mAx
;145582
The following steps can be used to write the solution residuals to a text file.

1. Read the case/data files in FLUENT.

2. Read the Scheme file (init.scm) using the File-->Read-->Scheme command. The content of the Scheme file should be as follows (please copy the content between the dashed line into a text file and save it as 'init.scm'):

-------------------------------------------------------------- (define port) (set! port (open-output-file "residuals.dat"))

(do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (car (list-ref (solver-residuals) i))) ) (newline port) ---------------------------------------------------------------

3. Set the following execute command at every iteration using Solve --> Execute Commands:

file read-journal residual.jou

The content of the journal file (residual.jou) should be as follows (please copy the content between the dashed line into a text file and save it as 'residual.jou'):

--------------------------------------------------------------- (do ((i 0 (+ i 1))) ((= i (length (solver-residuals)))) (format port "~a ~2t" (cdr (list-ref (solver-residuals) i))) ) (newline port) ---------------------------------------------------------------

4. Now compute the solution using the Solve->Iterate command. This will write out a text file ('residuals.dat') containing the solution residual history.


=================
Thank you very much.
Doing the above commands writes a list of residuals without the time flow or time step. Is there a way to do that?

How to add time step or time flow before the residuals?? (Either one)

LuckyTran April 6, 2016 09:02

Quote:

Originally Posted by agari (Post 593582)
=================
Thank you very much.
Doing the above commands writes a list of residuals without the time flow or time step. Is there a way to do that?

How to add time step or time flow before the residuals?? (Either one)

You can just edit the scheme so far and tell it to print the time-step and flow-time. The scheme variable names for these are time-step and flow-time.

agari April 6, 2016 12:29

Quote:

Originally Posted by LuckyTran (Post 593662)
You can just edit the scheme so far and tell it to print the time-step and flow-time. The scheme variable names for these are time-step and flow-time.

Thanks. But not familiar with c++ prog so where to put it? Like this:

(do ((i 0 (+ i 1))) ((= i (length (flow-time, solver-residuals)))) (format port "~a ~2t" (car (list-ref (solver-residuals) i))) ) (newline port)

rarnaunot June 5, 2017 11:22

Quote:

Originally Posted by agari (Post 593716)
Thanks. But not familiar with c++ prog so where to put it? Like this:

(do ((i 0 (+ i 1))) ((= i (length (flow-time, solver-residuals)))) (format port "~a ~2t" (car (list-ref (solver-residuals) i))) ) (newline port)

Hello!

Did it work?

I have tried with:

(do ((i 0 (+ i 1))) ((= i (length (flow-time, solver-residuals)))) (format port "~a ~2t" (car (list-ref (flow-time, solver-residuals) i))) ) (newline port)

and

(do ((i 0 (+ i 1))) ((= i (length (time-step, solver-residuals)))) (format port "~a ~2t" (car (list-ref (time-step, solver-residuals) i))) ) (newline port)

and always get the same error:

Error: eval: unbound variable
Error Object: time-step

Error: eval: unbound variable
Error Object: flow-time

LuckyTran June 5, 2017 17:02

Btw folks, in Fluent v18 residuals are available as a report so that you don't need these silly workarounds to write the residuals to a file. You still need a reader though.

rarnaunot June 6, 2017 06:23

Quote:

Originally Posted by LuckyTran (Post 651785)
Btw folks, in Fluent v18 residuals are available as a report so that you don't need these silly workarounds to write the residuals to a file. You still need a reader though.

Thaks! Really good news!

I was searching for it in 18 version. I guess it may be on: Report Files> Create a new Report File > New Report Definitions..... but how to get the residuals of the continuity, velocities and my different UDS?

Should I create my own Report with DEFINE_REPORT_DEFINITION_FN ?

LuckyTran June 6, 2017 09:06

Quote:

Originally Posted by rarnaunot (Post 651871)
Thaks! Really good news!

I was searching for it in 18 version. I guess it may be on: Report Files> Create a new Report File > New Report Definitions..... but how to get the residuals of the continuity, velocities and my different UDS?

Should I create my own Report with DEFINE_REPORT_DEFINITION_FN ?

Oops. I might have confused myself after glancing at the original post. I was thinking you could write all cell residuals as a data file... by using
solve/set/expert n y n n (the defaults are n n n n)
This enable access to the cell residuals and then defining reports or using solution data export. A sum over all cells I think is what the Fluent window output is using (it might be another averaging operation), you should test it if you want to be sure.

This approach really should be doable in versions before 18 as well.

rarnaunot June 6, 2017 09:17

Sorry! Maybe I didn't explain myself correctly. As u said, I want to copy to a file the plotted residuals or the numbers appearing in the command window, for example:

iter continuity x-velocity y-velocity z-velocity uds-0 uds-1 uds-2 uds-3 uds-4 time/iter
! 116 solution is converged
116 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 4.5547e-08 6.3906e-07 4.5547e-08 5.2988e-08 1.5437e-08 0:00:00 20
117 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 4.3878e-08 1.5746e-03 4.3878e-08 2.5311e-04 4.0493e-05 0:00:00 19
! 118 solution is converged
118 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 4.5545e-08 6.3959e-07 4.5545e-08 5.0686e-08 1.2597e-08 0:00:00 18


All times are GMT -4. The time now is 18:24.