|
[Sponsors] |
February 18, 2021, 07:29 |
Multiple UDFs in a single simulation
|
#1 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
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! |
|
February 18, 2021, 15:56 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
February 19, 2021, 03:02 |
|
#3 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
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! |
|
February 19, 2021, 14:22 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You read the velocity, which is not at set yet.
Solution: initialize without UDFs, then apply UDFs and run. |
|
February 20, 2021, 02:45 |
|
#5 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
Thank you so much for your help. It's working now!
|
|
February 25, 2021, 07:15 |
|
#6 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
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! |
|
February 25, 2021, 07:19 |
|
#7 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
Sorry, by mistake I attached pressure waveform twice.
|
|
February 25, 2021, 07:22 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Nevermind...
|
|
February 25, 2021, 08:50 |
|
#9 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I can't find an explanation for this, I'm sorry.
|
|
February 25, 2021, 08:52 |
|
#10 |
Member
Heer
Join Date: Oct 2020
Posts: 44
Rep Power: 6 |
Okay, thanks for your time!
|
|
Tags |
fluent - udf |
|
|
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 |