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

How to correct this UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 3, 2020, 05:12
Default How to correct this UDF?
  #1
New Member
 
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9
mataus is on a distinguished road
Hai...
Here is the simplified UDF for single-phase conjugate problem. The UDF calculates some values in the solid region.
DEFINE_EXECUTE_AT_END(source_calculation)
{
Domain *d=Get_Domain(1);
int zone_id=6;
Thread *t = Lookup_Thread(d,zone_id);
cell_t c;
thread_loop_c(t,d)
...
...


How to transform this UDF for the multiphase simulation problem? I need to do the same calculation in the solid region.

I am running transient-eulerian-boling-RPI model

It shows segmentation faults after the end first-time step when I run the simulation on multiphase with the above UDF.

I checked the zone id.


Cheers,
mataus is offline   Reply With Quote

Old   January 3, 2020, 05:18
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
not enough information

you may try to find examples on multiphase simulations in Ansys Fluent Customization manual
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 5, 2020, 22:24
Default how can i edit this udf
  #3
New Member
 
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9
mataus is on a distinguished road
Thanks for the reply.
I can explain my simulation.
the domain consists of one solid and one fluid region.
a heat source is introduced in the solid region. the heat generated in the solid region is transferred to the flowing fluid and its temperature rises.
I have introduced a UDF( DEFINE_EXECUTE_AT_END) to calculate some values in the solid region.
the UDF works correctly and runs the simulation successfully.

#include "udf.h"
#define p 13.4
#define s 301.0024
#define m 4.12
DEFINE_EXECUTE_AT_END(pom_calculation)
{
Domain *d=Get_Domain(1);
int zone_id=6;
Thread *t = Lookup_Thread(d,zone_id);
cell_t c;
real dt=CURRENT_TIMESTEP;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,1)=C_T(c,t)/s;
C_UDMI(c,t,3)=C_T(c,t)/p;
{
if (C_UDMI(c,t,3)>C_UDMI(c,t,1))
{
C_UDMI(c,t,2)=C_T(c,t)*m;
}
else
{
C_UDMI(c,t,2)=0;
}
C_UDMI(c,t,0)=C_UDMI(c,t,0)+(C_UDMI(c,t,2)*C_T(c,t ));
}
end_c_loop(c,t)
}
}
}

later I need to introduce a phase change of fluid (liq-vap) due to the heat transfer from the solid region. I tried the same UDF but it shows segmentation fault at the end first-time step.
I successfully simulate without the UDF.

how can I edit above udf to run in multiphase flow condition?
mataus is offline   Reply With Quote

Old   January 6, 2020, 00:19
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
code is correct

this code is not related to source, so it can't work the way, you've told
actually it does nothing

most likely, you didn't allocate memory for your user defined memories
you should put 4 in fluent GUI
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 6, 2020, 01:07
Default
  #5
New Member
 
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9
mataus is on a distinguished road
thanks for your quick reply.
yes..you are correct the code does nothing with source term.
this is a simplified version of the UDF.
I have correctly allocated 4 memory locations.
mataus 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
Dynamic contact angle issue: fluent UDF couldn't set the correct contact angle FelixJJ FLUENT 2 October 20, 2021 03:39
udf for correct adjacent cell T Adam_PHD Fluent UDF and Scheme Programming 8 February 27, 2018 03:33
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 11:29
how to correct the error of (c) file after the compile of udf? mokrane FLUENT 0 April 23, 2015 14:40
how can I correct the udf? happyrabbit FLUENT 9 January 28, 2011 10:50


All times are GMT -4. The time now is 19:36.