|
[Sponsors] |
December 6, 2019, 06:56 |
Wall Distance
|
#1 |
Member
Join Date: Mar 2016
Posts: 73
Rep Power: 10 |
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? |
|
December 9, 2019, 00:52 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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) } } -> user defined -> memory
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 9, 2019, 04:29 |
|
#3 |
Member
Join Date: Mar 2016
Posts: 73
Rep Power: 10 |
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 |
|
December 9, 2019, 23:52 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
|
|
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 |