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

Multiple UDFs in a single simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2021, 07:29
Default Multiple UDFs in a single simulation
  #1
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Hello!

I am trying to write 2 UDFs in a single simulation:
1. Unsteady velocity profile at the inlet.
2. Calculation of flow rate at the outlet and further calculation of pressure from this by a relation.

The UDF goes as follows:
#include "udf.h"

#define R 12000 /*Value taken from literature*/

DEFINE_PROFILE (unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop (f, thread)
{
F_PROFILE (f, thread, position) = -0.086*(sin(7.54*t + 0.609)) + 0.0075;
}
end_f_loop (f, thread)
}


#include "mem.h"
#include "metric.h"
DEFINE_PROFILE(outlet_pressure, thread, position)
{
real A[ND_ND];
face_t f;
Thread *t;
real At, Vx;

begin_f_loop(f, thread)
{
F_AREA(A, f, thread);
At = NV_MAG(A); /* Used for the computation of the magnitude of the area vector */
Vx = F_U(f, thread);
F_PROFILE(f, thread, position) = R*Vx*At;
}
end_f_loop(f, thread)
}

The UDF is getting interpreted correctly but solution initialization gives me the following message:
Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f

I am not able to figure out the error. Can someone please help with this?

TIA!
msd is offline   Reply With Quote

Old   February 18, 2021, 15:56
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Locate the problem. It is in one of your UDFs. Which one? Just try! Disable one, see if the problem is still there.

Once you know which UDF is the problem, try a similar approach to find which part of the UDF is the problem.

I don't see real problems in your code.
pakk is offline   Reply With Quote

Old   February 19, 2021, 03:02
Default
  #3
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Thank you for your reply.

Actually, I tried figuring out the problem and I came to know that the problem lies in the second UDF. Because if I am disabling the second UDF, the solution is getting initialized. But I am not able to figure out what is the exact error in that. Can you please tell what can be the possible errors, as I am quite new to coding and writing UDFs.

Thanks in advance!
msd is offline   Reply With Quote

Old   February 19, 2021, 14:22
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You read the velocity, which is not at set yet.

Solution: initialize without UDFs, then apply UDFs and run.
pakk is offline   Reply With Quote

Old   February 20, 2021, 02:45
Default
  #5
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Thank you so much for your help. It's working now!
msd is offline   Reply With Quote

Old   February 25, 2021, 07:15
Default
  #6
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Can you please help me with this?

I am attaching the pressure and volumetric flow rate waveforms along. I am not able to understand why pressure is getting zero when the flow rate is negative. Ideally, according to the relation pressure should not be zero when flow rate is negative. Can you please tell is there some logical error in the code?

Thanks in advance!
Attached Images
File Type: jpg Pressure.jpg (63.4 KB, 4 views)
File Type: jpg Volumetric flow rate.jpg (63.4 KB, 3 views)
msd is offline   Reply With Quote

Old   February 25, 2021, 07:19
Default
  #7
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Sorry, by mistake I attached pressure waveform twice.
Attached Images
File Type: jpg Volumetric flow rate.jpg (70.6 KB, 4 views)
msd is offline   Reply With Quote

Old   February 25, 2021, 07:22
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Nevermind...
msd likes this.
pakk is offline   Reply With Quote

Old   February 25, 2021, 08:50
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I can't find an explanation for this, I'm sorry.
pakk is offline   Reply With Quote

Old   February 25, 2021, 08:52
Default
  #10
msd
Member
 
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6
msd is on a distinguished road
Okay, thanks for your time!
msd is offline   Reply With Quote

Reply

Tags
fluent - 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
How to run multiple cycle pulsetile flow simulation in Ansys fluent using UDF code? Md Al Amin Sheikh Fluent UDF and Scheme Programming 4 January 28, 2020 12:55
conformal multiple zone simulation in fluent cecilia_xiao559 FLUENT 0 July 13, 2015 11:44
Tecplot > Fluent transient single case multiple data files cct Tecplot 2 July 11, 2014 10:32
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 13:21
Simulation of a single passage and volute Suzzn CFX 1 January 5, 2010 08:05


All times are GMT -4. The time now is 11:34.