|
[Sponsors] |
April 24, 2018, 07:53 |
Segmentation error with F_PROFILE
|
#1 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Code:
DEFINE_ADJUST(functionName, domain_pointer) { Thread* thread_pointer = Lookup_Thread(domain_pointer, zone_index); face_t facet; cell_t c0; Thread* t0 = thread_pointer->t0; begin_f_loop(facet, thread_pointer) { c0 = F_C0(facet, thread_pointer); F_PROFILE(facet, thread_pointer, zone_index) = -1.0 * C_UDMI(c0, thread_pointer, var); } end_f_loop(facet, thread_pointer) } I get the zone_index from another UDF which represents the boundary at which I want to use this BC (using THREAD_ID). It retrieves the correct boundary (checked). Only on commenting or negating any assignment in the highlighted line does the error not persist. Any insight would be really appreciated. Thanks |
|
April 24, 2018, 10:03 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Let's start with the obvious: you should have a user defined memory (UDM) activated, do you?
Secondly: first you use "thread_pointer" as a pointer to a face-thread, but later it is a pointer to a cell-thread. That will give you problems... And finally: what are you actually doing with F_PROFILE here? The third variable that you give is the zone-index, but it should be an integer index to a variable. I have never seen a F_PROFILE used in a DEFINE_ADJUST, normally you use a DEFINE_PROFILE for that. From your code, I can not guess what you are trying to do, so I can not give a suggestion on what to do. |
|
April 24, 2018, 10:44 |
|
#3 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Thanks Pakk for your answer
(1) Yes, the UDM has been activated and the values successfully stored. (2) I'm not very sure where this is happening (could you let me know on which line of the code this happens). c0 is the pointer to the cell immediate to the boundary face. (3) the variable zone_index, is a global integer variable taken from another boundary UDF. The value has been checked and is unaltered. Also, when passing the boundary ID directly, the problem did persist. (4) DEFINE_ADJUST is also used to specify alternate/ conditional boundary conditions (Fluent UDF documentation) What I am trying to do is specify a flux through a boundary; which is supposed to replicate a membrane wall. |
|
April 24, 2018, 10:53 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
(2) I was talking about "thread_pointer", not about "c0". You use it two times in the line that you made bold-faced, and it has two different meanings.
(3) I believe that "zone_index" is the correct integer for the zone that you want to have. But in F_PROFILE, you should not give the integer for the zone that you want to have, the third integer should be an integer index to a variable. (4) It might be possible to use DEFINE_ADJUST for that, but it is a lot more complicated. Just use DEFINE_PROFILE... Then you almost automatically also solve the two problems above. |
|
April 24, 2018, 11:06 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
This might already work:
Code:
/* var defined somewhere above */ DEFINE_PROFILE(functionName, t, i) { face_t facet; begin_f_loop(facet, t) { F_PROFILE(facet, t, i) = -1.0 * F_UDMI(facet, t, var); } end_f_loop(facet, t) } |
|
May 14, 2018, 08:59 |
|
#6 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Thanks Pakk,
the suggested code did work. But I wonder if you could suggest how to get around the complete problem I have at hand. I'm simulating a 2D rectangular channel. The bottom surface is the membrane through which a fixed amount of the fluid is allowed to flow. Initially I was defining the membrane surface as a wall and hence was trying to use define_adjust to specify the flux on the boundary. However if I have to use DEFINE_PROFILE, I have to define the bottom membrane surface as a velocity inlet. This results in reversed flow and over prediction of the calculated flux coming into the channel rather than flowing out. Any suggestion as how to approach the problem assuming the UDF is correct? Thanks |
|
May 14, 2018, 12:35 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Check if you missed a minus sign.
|
|
May 17, 2018, 08:52 |
|
#8 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Hi Pakk,
Thanks for your reply. I have checked with the signs and they seem all good. Any suggestions on how to apply two boundary conditions on one boundary surface. (1) I need to set the flux at the surface (2) I need to calculate/ predict the solute concentration on the same surface (analytical solution available that I have used in the UDF) thanks |
|
May 17, 2018, 22:16 |
|
#9 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use two DEFINE_PROFILE macro in your UDF, one for flux, another for concentration
best regards |
|
May 18, 2018, 08:02 |
|
#10 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Hi Alexander,
Thanks for the reply. The boundary I am applying these conditions to is suppose to be a membrane through which there is an outflow. The objective is that I would want to know the effective flux and polarization layer on the membrane surface (both affect each other) The solute transport is solved by user defined scalar transport. if I have to use 2 DEFINE_PROFILE macros on the same boundary (for velocity out and scalar concentration) then I will need to define membrane as a velocity inlet : (1) to define a negative flux (2) define the UDS flux/value at the boundary using mass outlet/ pressure outlet only allows one to define the scalar BC and the gauge pressure Would defining the boundary (outflow) as an inlet with negative velocity be logically correct. Many at times I have had reversed flow when I have done this |
|
Tags |
boundary conditions, define_adjust, f_profile, segmentation error |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sigSegv error, segmentation error? | ollebapur | OpenFOAM Running, Solving & CFD | 1 | June 11, 2018 08:54 |
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel | francesco | OpenFOAM Bugs | 4 | May 2, 2017 22:59 |
Segmentation fault in SU2 V5.0 | ygd | SU2 | 2 | March 1, 2017 05:38 |
segmentation fault when installing OF-2.1.1 on a cluster | Rebecca513 | OpenFOAM Installation | 9 | July 31, 2012 16:06 |
Segmentation Violation | Corentin | FLUENT | 1 | February 13, 2011 02:07 |