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 use patch under loading UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2019, 09:42
Smile How to use patch under loading UDF?
  #1
New Member
 
lili
Join Date: May 2019
Posts: 12
Rep Power: 7
lilistar-8216 is on a distinguished road
Hi, I'm trying to make UDF for changing heat generation rate at the boundary between solid phase and liquid phase. In addition to it, I want to set temperature 300K at solid phase and 550K at liquid phase. My UDF could be compiled and be loaded but if this UDF is loaded at the boundary, I can't change the temperature using patch at initialization setting. (I can initialize without patch.)

This is the error when I try to use patch:
================================================== ============

Node 0: Process 6392: Received signal SIGSEGV.

================================================== ============
MPI Application rank 0 exited before MPI_Finalize() with status 2
The fl process could not be started.


What should I do to use patch setting under loading UDF at the boundary between liquid and solid phases?
lilistar-8216 is offline   Reply With Quote

Old   May 9, 2019, 23:51
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
what do you mean under heat generation rate at the boundary
it is applied to volume not boundary.

you should attach your udf here and explain in details each your step before you get the error, if you want to get help

best regards
AlexanderZ is offline   Reply With Quote

Old   May 15, 2019, 06:09
Default
  #3
New Member
 
lili
Join Date: May 2019
Posts: 12
Rep Power: 7
lilistar-8216 is on a distinguished road
Thank you for replying. Sorry I cannot attach all of my UDF but my UDF is like this,

#include "udf.h"
#include "unsteady.h"
#include "mem.h"

DEFINE_PROFILE(heat_profile, thread, i)
{
cell_t c;
Thread *c_thread;
real dt = CURRENT_TIMESTEP;
begin_c_loop(c, c_thread, i)
{
real c_volume = C_VOLUME(c, c_thread);
real dT = C_T_M1(c, c_thread);
.
.
.
F_PROFILE(c, c_thread, i) = (some values* c_volume/dt)*dT;
}
end_c_loop(c, c_thread)
}

I attached this UDF at the wall between fluid phase and liquid phase. I could compile and load this UDF but if I initialize and use patch, that error is occurred.
lilistar-8216 is offline   Reply With Quote

Old   May 15, 2019, 23:13
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:
#include "udf.h"
#include "unsteady.h"
#include "mem.h"

DEFINE_PROFILE(heat_profile, thread, i)
{
cell_t c;
real dt = CURRENT_TIMESTEP;
begin_c_loop(c, c_thread, i)
{
real c_volume = C_VOLUME(c, thread);
real dT = C_T_M1(c, thread);
.
.
.
F_PROFILE(c, thread, i) = (some values* c_volume/dt)*dT;
}
end_c_loop(c, thread)
}
real dT = C_T_M1(c, thread); return temperature from previous timestep so you should specify it for the first time step

Quote:
Note that data from C_T_M1 is available only if user-defined scalars are defined. It
best regards
AlexanderZ is offline   Reply With Quote

Old   May 17, 2019, 04:31
Default
  #5
New Member
 
lili
Join Date: May 2019
Posts: 12
Rep Power: 7
lilistar-8216 is on a distinguished road
AlexanderZ,

Thank you for replying. I tried to define the temperature for the first time step but it doesn't work. You told me that I need to define UDS for C_T_M1 but I don't know how to define it. Should I write the UDF for UDS to get C_T_M1 or just set UDS in fluent?

regards
lilistar-8216 is offline   Reply With Quote

Reply

Tags
fluent, patch by zone, 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
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 12:56
[Other] StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


All times are GMT -4. The time now is 20:41.