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

Combined Step+Exponential udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 20, 2021, 16:20
Default Combined Step+Exponential udf
  #1
New Member
 
Joel
Join Date: Jul 2021
Posts: 1
Rep Power: 0
Jotomize is on a distinguished road
Hey all,

I am trying to simulate a transient inlet pressure boundary condition that is a step function with an exponential decay using a udf codeIMG_1830.jpg. I am having trying to come up with a udf that best simulates this situation. I have attached an image to show what I am trying to say. The maximum peak pressure is 3000psi and it should settle at a pressure of around 50 psi at the end of the exponential decay. This is what I have so far:-

#include "udf.h"



DEFINE_PROFILE(unsteady_pressure,thread,position)
{

face_t f;
real ts= CURRENT_TIMESTEP;
real i;
real flow_time = RP_Get_Real("flow-time");

begin_f_loop(f, thread)
{
for(i=1;i<50;i++)
{

if (flow_time > 0 && flow_time < 0.0001)
{
F_PROFILE(f, thread, position)= 50.0;
}



else if (flow_time > 0.0001)
{
F_PROFILE(f, thread, position)=3000*exp(-flow_time);
}


else if (flow_time==0.0001)
{
F_PROFILE(f, thread, position)=3000;
}

}



end_f_loop(f, thread)

}
}

Is a for loop the best way to go about this or should I maybe use an array?
Thank you in adavnce
Jotomize is offline   Reply With Quote

Old   July 20, 2021, 19:26
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Your for loop doesn't do anything... You repeat the same code 50 times, I don't understand what you are trying to achieve with that. Why loop? Why 50 times?

It looks like you can just remove the loop...

Some remarks:
-the flowtime==0.0001 part is useless, remove it, you don't need it. If flowtime<0.0001 constant else exponential.
-your pressure profile equation for the exponential part is wrong. Should be 3000*exp(0.0001-flow_time).
-Fluent expects SI units by default. You have the right to use this silly psi unit, but be careful.
Jotomize likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Reply


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
LES, Courant Number, Crash, Sudden Alhasan OpenFOAM Running, Solving & CFD 5 November 22, 2019 03:05
time step continuity problem in VAWT simulation lpz_michele OpenFOAM Running, Solving & CFD 5 February 22, 2018 20:50
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 08:47
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 15:10.