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 Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2014, 13: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: 12
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, 05:30
Default
  #2
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 12
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, 05:57
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 06:59
Default
  #4
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 12
ho3ein.agl is on a distinguished road
ok , Its work
ho3ein.agl is offline   Reply With Quote

Reply

Tags
define_deltat

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


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