CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

"cx-interrupt" not Interrupting

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Baden
  • 1 Post By pakk
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2017, 14:53
Default "cx-interrupt" not Interrupting
  #1
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 9
Baden is on a distinguished road
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:



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



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.
kele likes this.

Last edited by Baden; February 15, 2017 at 22:12.
Baden is offline   Reply With Quote

Old   February 13, 2017, 04:28
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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 likes this.
pakk is offline   Reply With Quote

Old   February 13, 2017, 20:38
Default
  #3
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 9
Baden is on a distinguished road
Quote:
Originally Posted by pakk View Post
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).
Baden is offline   Reply With Quote

Old   February 14, 2017, 02:45
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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 likes this.
pakk is offline   Reply With Quote

Old   February 15, 2017, 22:25
Default
  #5
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 9
Baden is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.

Baden is offline   Reply With Quote

Old   February 16, 2017, 03:42
Default
  #6
Senior Member
 
Kevin
Join Date: Dec 2016
Posts: 138
Rep Power: 9
KevinZ09 is on a distinguished road
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/
KevinZ09 is offline   Reply With Quote

Old   February 16, 2017, 11:18
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by Baden View Post
Pressing control-C twice gives the following message which I was unable to replicate with the latter of the two codes posted above.

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.
pakk is offline   Reply With Quote

Old   February 16, 2017, 15:06
Default
  #8
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 9
Baden is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Baden is offline   Reply With Quote

Old   February 17, 2017, 03:53
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If you can go to Fluent support, it might not be a dead end.
pakk is offline   Reply With Quote

Old   February 27, 2017, 21:27
Default
  #10
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 9
Baden is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Baden is offline   Reply With Quote

Old   September 12, 2022, 08:14
Default
  #11
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
Quote:
Originally Posted by Baden View Post
I have encountered the same issue. Unless anyone on the forums knows any better, I believe this is a dead end.
Hi,
I wrote this command in the 'Execute Command' dialog box to stop a transient simulation. (I initially took the value of 'interrupt/flag' as 5).

Code:
(if(>(rpgetvar 'interrupt/flag) 0) (set! mstop? #t))
Apparently, it's working, and the solution stops as soon as the condition is violated. I found this on youtube. But I don't have any further information about this command.

Also, if possible, could you guide me on the UDF part. I'm encountering some problem with the DEFINE_ADJUST UDF I wrote.
Siba11 is offline   Reply With Quote

Old   September 13, 2022, 02:02
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I believe that instead of
Code:
rpgetvar
should be
Code:
%rpgetvar
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 12, 2023, 09:49
Default
  #13
New Member
 
Join Date: Oct 2023
Posts: 3
Rep Power: 2
kele is on a distinguished road
[QUOTE=Siba11;835714]Hi,
I wrote this command in the 'Execute Command' dialog box to stop a transient simulation. (I initially took the value of 'interrupt/flag' as 5).

Hey friend, have you solved this problem yet? Currently, I am experiencing this issue. I am looking for help to solve the problem, here is my code. Run the code but FLUENT does not stop running.

[CODE](rp-var-define 'interrupt/flag 0 'integer #f)
(define (interrupt)
(if (> (%rpgetvar 'interrupt/flag) 0)
(cx-interrupt)))
kele is offline   Reply With Quote

Reply

Tags
cx-interrupt, scheme


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interrupting calculation at value aalansari FLUENT 0 August 22, 2014 08:03
Interrupting a run in progress austin.m SU2 4 October 4, 2013 09:55
Interrupting a Journal File svp FLUENT 2 February 16, 2011 08:00
Interrupting Gambit w/o leaving CPU busy? Chris Bailey FLUENT 0 January 26, 2005 16:29


All times are GMT -4. The time now is 21:10.