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

Make FLUENT stop calculations automatically

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 14, 2023, 09:04
Default Make FLUENT stop calculations automatically
  #1
New Member
 
Join Date: Oct 2023
Posts: 3
Rep Power: 3
kele is on a distinguished road
Hello everyone, I combined udf and scheme to make FLUENT automatically stop calculating when the wall temperature and pressure reach conditions. But it is not possible to realize it.here is my code with many references. thank you
Code:
#include "udf.h"
#include "math.h"
#include "var.h"

DEFINE_ADJUST(interrupt_1, d)
{

	cell_t cell;
	Thread* thread;
	Domain* domain;
	real temp, pressure, NV_VEC(dist);
	int ID = 12;  
	face_t f;
	Thread* t;
	cell_t c0, c1;

	domain = Get_Domain(1); 


	thread = Lookup_Thread(domain, ID);



	  begin_f_loop(f, thread)
	     {
		      c0 = F_C0(f, thread);
		      c1 = F_C1(f, thread);


		      if (THREAD_ID(thread) == ID)
		      {
			       t = THREAD_T0(thread);
			       if (c0 != -1)
			       {

				         temp = C_T(c0, t);
				         pressure = C_P(c0, t);

				         if (temp > 250.0 && pressure > 140)
				         {

							 RP_Set_Integer("interrupt/flag",5);  
							 Message("Temperature exceeds 2500K and Pressure exceeds 1.4MPa. Stopping simulation...\n");
				         }
			       }
		      }
	     }
	  end_f_loop(f, thread)			
}
schemem code
Code:
(rp-var-define 'interrupt/flag 0 'integer #f)
(define (interrupt-end-of-timestep)
  (if (> (%rpgetvar 'interrupt/flag) 0)
      (begin (cx-interrupt-end-of-timestep))))
kele is offline   Reply With Quote

Old   October 16, 2023, 01:18
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Automatic stop calculation
__________________
best regards


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

Reply

Tags
cx-interrupt, scheme, stop simulation, udf


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
[blastFoam] BlastFoam Question alimea OpenFOAM Community Contributions 17 January 28, 2023 11:50
how to run fluent from matlab without using aas toolbox? artemis96 ANSYS 7 May 23, 2022 13:16
How To Make MATLAB Apps For Fluent behest FLUENT 0 March 3, 2014 08:00
problem in using parallel process in fluent 14 aydinkabir88 FLUENT 1 July 10, 2013 03:00
2D Vs 3D VOF Fluent calculations sachinthakre FLUENT 0 February 5, 2013 12:35


All times are GMT -4. The time now is 12:15.