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

UDF for time-step

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By p.b+cfd

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 12, 2020, 11:47
Default UDF for time-step
  #1
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 7
franc1 is on a distinguished road
Hi everybody,
i need a UDF for the time-step in which i have to assign 3 different time-steps at 3 different levels, respectively:
from 0 to 1s ---> TS=0.01
from 1s to 3s---> TS=0.004
from 3s to end---> TS=0.1

I tried this way but it didn't work

Code:
#include "udf.h"

DEFINE_DELTAT(ts, d)
{
	real time_step;
	real flow_time = CURRENT_TIME;
	if (flow_time < 1)
		time_step = 0.01;
	if (flow_time > 3)
		time_step = 0.1;
	else
		time_step = 0.004;
	return time_step;
}
Thank in advance
franc1 is offline   Reply With Quote

Old   September 18, 2020, 06:38
Default
  #2
New Member
 
Join Date: Sep 2020
Posts: 8
Rep Power: 7
p.b+cfd is on a distinguished road
Try this:

Code:
DEFINE_DELTAT(ts, d)
{
    real time_step;
    real flow_time = RP_Get_Real("flow-time");

#if PARALLEL
    host_to_node_real_1(flow_time);
#endif

    if (flow_time < 1.0)
    {
        time_step = 0.01;
    }
    else if (flow_time > 3)
    {
        time_step = 0.1;
    }
    else
    {
        time_step = 0.004;
    }

    return time_step;
}
But I guess you have to compile it!
franc1 likes this.
p.b+cfd is offline   Reply With Quote

Reply

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
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 10:10
time step continuity problem in VAWT simulation lpz_michele OpenFOAM Running, Solving & CFD 5 February 22, 2018 20:50
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50
calling result of a UDF into current time step Komon Fluent UDF and Scheme Programming 1 April 1, 2012 20:53


All times are GMT -4. The time now is 16:51.