CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   "cx-interrupt" not Interrupting (https://www.cfd-online.com/Forums/fluent-udf/183712-cx-interrupt-not-interrupting.html)

Baden February 11, 2017 15:53

"cx-interrupt" not Interrupting
 
Hello all.

I have defined a SCHEME variable using the following TUI command:
Code:

(rp-var-define 'interrupt/flag 0 'interger #f)
Initially, the variable "interrupt/flag" has a value of 0, but this value is changed to 1 via UDF based on a certain condition. I want the simulation to stop once the variable is changed to 1, so I implemented the following in Solve - Execute Command panels:

http://i.imgur.com/ExEak9W.png

However, when the value of ""interrupt/flag" is changed to 1, the following text appears in the console but the simulation continues without stopping.

http://i.imgur.com/8e6HFOK.png

Does anyone have any idea why the simulation is not properly being interrupted? There is remarkably little documentation on the SCHEME language and even less on cx-interrupt.

pakk February 13, 2017 05:28

I think you made a typo in your scheme command, it should be integer and not interger.

On the question you asked: I have no idea, but I am interested in this way of working, it looks useful if it works. Do you get the same behavior when you manually press control-C?
I see the command (cx-interrupt-client) also exists, maybe this could be what you need?

Baden February 13, 2017 21:38

Quote:

Originally Posted by pakk (Post 636897)
I think you made a typo in your scheme command, it should be integer and not interger.

On the question you asked: I have no idea, but I am interested in this way of working, it looks useful if it works. Do you get the same behavior when you manually press control-C?
I see the command (cx-interrupt-client) also exists, maybe this could be what you need?

The typo was not present when in the SCHEME command I used, but thank you for pointing that out.

Pressing control-C results in the same problem: the simulation says "Interrupting" but does not stop. However, pressing control-C twice properly stops the simulation. I also tried the "cx-interrupt-client" command, but it appeared to have no effect (the "Interrupting" text did not appear in the command window).

pakk February 14, 2017 03:45

If control-C twice works, did you try to put (cx-interrupt) twice?
Code:

(if (> (rpgetvar 'interrupt/flag) 0) (begin (cx-interrupt) (cx-interrupt)))

Baden February 15, 2017 23:25

Quote:

Originally Posted by pakk (Post 637038)
If control-C twice works, did you try to put (cx-interrupt) twice?
Code:

(if (> (rpgetvar 'interrupt/flag) 0) (begin (cx-interrupt) (cx-interrupt)))

I tried both of the following neither worked.
Code:

(if (> (rpgetvar 'interrupt/flag) 0) (begin (cx-interrupt) (cx-interrupt)))
Code:

(if (> (rpgetvar 'interrupt/flag) 0) (begin (cx-interrupt) (cx-interrupt-client)))
Pressing control-C twice gives the following message which I was unable to replicate with the latter of the two codes posted above.

http://i.imgur.com/IaYXFt2.png

KevinZ09 February 16, 2017 04:42

I've got little to no experience using the SCHEME language, but to me it almost seems like you need to interrupt twice because the first time it interrupts the iteration loop within the current time step and the second time it interrupts the time step loop. So perhaps there are different commands for that.

Did you consult the following website to get more information:

http://www.scheme.com/tspl4/

pakk February 16, 2017 12:18

Quote:

Originally Posted by Baden (Post 637335)
Pressing control-C twice gives the following message which I was unable to replicate with the latter of the two codes posted above.

http://i.imgur.com/IaYXFt2.png

It looks like it should be some combination of (cx-interrupt) and (cx-interrupt-client). I tried a little bit, and with (cx-interrupt) I get the same response, but with (cx-interrupt-client) I get "()" instead of "Interrupting client...". I tried to add parameters, as in (cx-interrupt-client 0), (cx-interrupt-client 'test), but the response was the same every time.

My conclusion: I don't know how to do this, and don't know how to find out. :(

Baden February 16, 2017 16:06

Quote:

Originally Posted by pakk (Post 637424)
It looks like it should be some combination of (cx-interrupt) and (cx-interrupt-client). I tried a little bit, and with (cx-interrupt) I get the same response, but with (cx-interrupt-client) I get "()" instead of "Interrupting client...". I tried to add parameters, as in (cx-interrupt-client 0), (cx-interrupt-client 'test), but the response was the same every time.

My conclusion: I don't know how to do this, and don't know how to find out. :(

I have encountered the same issue. Unless anyone on the forums knows any better, I believe this is a dead end.

pakk February 17, 2017 04:53

If you can go to Fluent support, it might not be a dead end.

Baden February 27, 2017 22:27

Quote:

Originally Posted by pakk (Post 637500)
If you can go to Fluent support, it might not be a dead end.

Unfortunately, this avenue is not available to me as a student user.


All times are GMT -4. The time now is 20:41.