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

Define time step size with max or min of Temp in a domain

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2014, 14:33
Lightbulb Define time step size with max or min of Temp in a domain
  #1
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 13
ho3ein.agl is on a distinguished road
Hi cfd-online

I have a very very sensible unsteady simulation and it must run with small time step size.

I want to use DEFINE_DELTAT and set Deltat function of some cell variable in a domain.

for example
if max Temp < T1 then Deltat=a
if max Temp >= T1 then Deltat=b
if max Liquid fraction > 0 then Deltat=c
.
.
.


is it possible to do that?

I think "Looping Over Cell Threads in a Domain (thread_loop_c)" can help me if I use that in DEFINE_DELTAT macro.

thank you
ho3ein.agl is offline   Reply With Quote

Old   December 18, 2014, 06:30
Default
  #2
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 13
ho3ein.agl is on a distinguished road
my udf is:

Red number is line number in udf commands .
Code:
DEFINE_DELTAT(mydeltat, domain)
{
	real time_step;
	real T_max=0.0 ;
	real T1=303.0 ;
	real T2=300.5 ;
	real T3=304.0 ;
	Thread t;
    cell_t c;
54	thread_loop_c(t,domain)
	{
56		begin_c_loop(c,t)
		{
58			temp = C_T(c,t);
			if (temp > T_max || T_max == 0.0) T_max = temp;
		}
		end_c_loop(c,t)
	}
	if (T_max < T1) time_step = 1.0;
	else time_step = 0.00001;
	return time_step;
}

error after build in compiler window:

Done.

(chdir "libudf")(chdir "win64\2ddp")# Generating ud_io1.h
Paper_PCM_Prop_and_DeltaT_v2.c
..\..\src\Paper_PCM_Prop_and_DeltaT_v2.c(54) : error C2440: '=' : cannot convert from 'thread_struct *' to 'Thread'
..\..\src\Paper_PCM_Prop_and_DeltaT_v2.c(54) : error C2088: '!=' : illegal for struct
..\..\src\Paper_PCM_Prop_and_DeltaT_v2.c(54) : error C2232: '->next' : left operand has 'struct' type, use '.'
..\..\src\Paper_PCM_Prop_and_DeltaT_v2.c(56) : error C2232: '->nelements' : left operand has 'struct' type, use '.'
..\..\src\Paper_PCM_Prop_and_DeltaT_v2.c(58) : error C2232: '->storage' : left operand has 'struct' type, use '.'

Done.

whats wrong in udf?
ho3ein.agl is offline   Reply With Quote

Old   December 18, 2014, 06:57
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Instead of making "t" a thread variable, in
Code:
Thread t;
you should make it a pointer to a thread variable:
Code:
Thread *t;
ho3ein.agl likes this.
pakk is offline   Reply With Quote

Old   December 18, 2014, 07:59
Default
  #4
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 13
ho3ein.agl is on a distinguished road
ok , Its work
ho3ein.agl is offline   Reply With Quote

Reply

Tags
define_deltat


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
Transient simulation not converging skabilan OpenFOAM Running, Solving & CFD 14 December 17, 2019 00:12
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01
time step directories naming issue Andrea_85 OpenFOAM 3 April 3, 2014 09:38
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 08:21


All times are GMT -4. The time now is 22:07.