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

UDF to store initial velocity components in UDM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 15, 2018, 05:06
Default UDF to store initial velocity components in UDM Segmentation error
  #1
New Member
 
Simon
Join Date: Aug 2018
Posts: 2
Rep Power: 0
simonmcintyre is on a distinguished road
Hi,

As the title says I'm trying to write a UDF to store the initial velocity components from a solution in a UDM variable (I need these intial velocities for a VG source term model I'm trying to implement). To do this I'm trying to use DEFINE_ON_DEMAND.

Currently I'm having trouble interpreting the UDF and receiving a segmentation error. Can anyone shed some light on why this might be happening?

I'm basing my code on the post here (Udm value on the walls).

I have already allocated 8 UDM locations and am running in serial, though would like to convert to parallel if I can get it working.


Code:

#include "udf.h"

int ID1 = 13;
int ID2 = 14;
int ID3 = 15;

DEFINE_ON_DEMAND(allocate_vel_initial)
{
Domain *d;
Thread *tc;
Thread *tf;
Thread *tA;
Thread *tB;
Thread *tC;
cell_t c;
face_t f;
d = Get_Domain(1);
tA = Lookup_Thread(d,ID1);
tB = Lookup_Thread(d,ID2);
tC = Lookup_Thread(d,ID3);
/* Loop through all the cell threads in the domain */
thread_loop_c(tc,d)
{
/* Loop through the cells in each cell thread */
begin_c_loop(c,tc)
{
C_UDMI(c,tc,0) = 1;
C_UDMI(c,tc,1) = 2;
C_UDMI(c,tc,2) = 3;
C_UDMI(c,tc,3) = 4;
}
end_c_loop(c,tc)
}

/* loops over all face threads in a domain*/
thread_loop_f(tf,d)
if (tf == tA) continue;
if (tf == tB) continue;
if (tf == tC) continue;
{
tc = THREAD_T0(tf); /*unique cell thread next to boundary face thread*/
/* Loop over faces in a face thread to get the information stored on faces. */
begin_f_loop(f,tf)
{
c = F_C0(f,tf); /*index of cell next to given face on boundary*/
F_UDMI(c,tf,4) = 5;
F_UDMI(c,tf,5) = 6;
F_UDMI(c,tf,6) = 7;
F_UDMI(c,tf,7) = 8;
}
end_f_loop(f,tc)
}
}


Error:

Error: received a fatal signal (Segmentation fault)
Error object: #f

Last edited by simonmcintyre; August 15, 2018 at 10:10.
simonmcintyre 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
Problem with chtMultiregionFoam radiation boundary condition baran_foam OpenFOAM Running, Solving & CFD 10 December 17, 2019 17:36
Foam::error::printStack after large bounding epsilon events StoneCFD727 OpenFOAM Running, Solving & CFD 1 January 1, 2018 17:04
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 05:49
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
Problems with simulating TurbFOAM barath.ezhilan OpenFOAM 13 July 16, 2009 05:55


All times are GMT -4. The time now is 12:27.