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

Wall Distance

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2019, 06:56
Default Wall Distance
  #1
Member
 
Join Date: Mar 2016
Posts: 73
Rep Power: 10
sufjanst is on a distinguished road
Hello everyone,

I am pretty new into UDF programming. I try to implement a model which is working with the cell wall distance. I can see the wall distance with a contour, but I can not use it in a UDF.

This is my example on how to save the wall distance as a user defined memory. I tried C_WALL_DISt and C_STORAGE_R which are both in the "mem.h"-file.

Here is my code:


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

DEFINE_ON_DEMAND(walldist)
{
Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1);
face_t f;


thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
//C_UDMI(c,t,1) = C_STORAGE_R(c,t,SV_WALL_DIST);
//C_UDMI(c,t,2) = C_WALL_DIST(c,t);
}
end_c_loop(c,t)
}
}

Compilation works. But whenever I try to execute the function I get a Segmentation Error. Can someone tell me what the problem is?
sufjanst is offline   Reply With Quote

Old   December 9, 2019, 00:52
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
the code you've shared does nothing, so it cant generate any problems.
show the code you are using next time

code you need:
Code:
#include "udf.h"

DEFINE_ON_DEMAND(walldist)
{
Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = C_WALL_DIST(c,t);
}
end_c_loop(c,t)
}
}
don't forget to allocate 1 udmi memory in Fluent GUI
-> user defined -> memory
__________________
best regards


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

Old   December 9, 2019, 04:29
Default
  #3
Member
 
Join Date: Mar 2016
Posts: 73
Rep Power: 10
sufjanst is on a distinguished road
Of course I tried my code without comments, first with C_STORAGE_R and afterwards with C_WALL_DIST...
The code you shared, which is my code without comments, does not work.
User defined memory is allocated
sufjanst is offline   Reply With Quote

Old   December 9, 2019, 23:52
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
I have no experience in using C_WALL_DIST(c,t) macro

you may try following:
make a loop in fluid zone only,
turn on any turbulence model, make few iterations
after that run on_demand function
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
Export Minimium Wall distance AshwaniAssam Pointwise & Gridgen 1 March 22, 2019 16:42
Normal distance from a complex shaped wall - initial conditions prashantvalluri CFX 3 September 20, 2017 14:26
wall distance definition mostanad Main CFD Forum 12 July 25, 2017 12:20
Compute/Extract cell wall distance Ionut G Fluent UDF and Scheme Programming 0 March 23, 2017 08:05
Wrong wall distance with cyclic boundaries sebastian OpenFOAM Bugs 4 October 31, 2012 11:24


All times are GMT -4. The time now is 18:09.