Issuing in accessing phase fraction through F_VOF or C_VOF

Venky_94Venky_94 Member Posts: 3

Hi,

I've written a ADJUST UDF which requires accessing the volume fraction in each cell. Below is my code and the error statement I've received.

I tried debugging the error using print statements in between the various blocks and identified that the error occurs only when F_VOF or C_VOF macro is called upon. I'm unable to identify what the issue is. Please suggest. I'm also attaching a photo below of what I'm trying to achieve through this code.

/******************************************************************************************************************
UDM for storing the area averaged phase fraction of air and other terms required for calculating the source term
*******************************************************************************************************************/


#include "udf.h"


DEFINE_ADJUST(phase_fraction_udm, domain)		/* domain is defined as the mixture-level domain by default */
{
Thread *t, *tf;
cell_t c;
face_t f;


/* Define parameters for source term calculation */


real k;							/* interface curvature */
real ncapx;						/* x component of the unit normal vector */
real ncapy;						/* y component of the unit normal vector */
real nx;						/* n is the gradient of the phase fraction and nx is the x component*/
real ny;						/* n is the gradient of the phase fraction and ny is the y component*/


#if !RP_HOST						/* either serial or compute node process is involved */


/* Calculation of area-averaged air phase fraction */


thread_loop_c(t, domain)				/* loops over all cell threads in domain */
{
begin_c_loop(c, t)					/* loops over all cells in each cell thread */
{
real alphadenom = 0.0;
real A[ND_ND];
real alphanum = 0.0;
int i = 0;						/* resets the face index number */


c_face_loop(c,t,i)					/* loops over all faces of a cell */
{
tf = C_FACE_THREAD(c,t,i);				/* obtains the associated face thread */
F_AREA(A,f,tf);						/* computes area of each face */
alphadenom += NV_MAG(A);				/* computes total face area magnitude and sums as the loop runs */
alphanum += F_VOF(f,t)*NV_MAG(A);			/* F_VOF computes the phase fraction of air at each face, multiplies it with area of face and sums it over all faces of the cell as the loop runs*/
}


C_UDMI(c,t,0) = alphanum/alphadenom;			/* calculates and stores the area averaged volume fraction of air for each individual cell in the UDM */
}
end_c_loop(c, t)
}


PRF_GSYNC();						/* makes sure previous calculations are completed on all compute nodes before moving on to the forthcoming commands */


#endif


}


Error: Cortex received a fatal signal (unrecognized signal).
Error Object: ()


Error: %cx-set-label: wta[1](widget)
Error Object: #f




  iter  continuity  x-velocity  y-velocity     time/iter


==============================================================================


==============================================================================


==============================================================================


==============================================================================


Node 0: Process 49576: Received signal SIGSEGV.


==============================================================================


Node 1: Process 49588: Received signal SIGSEGV.


==============================================================================


Node 2: Process 49612: Received signal SIGSEGV.


==============================================================================


Node 3: Process 49636: Received signal SIGSEGV.


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


Answers

  • YasserSelimaYasserSelima Posts: 944Member

    Hello again,

    C_VOF or F_VOF is defined for the phase thread, not for the mixture thread. There is a DEFINE_INIT example in the manual that access C_VOF , you can see how to access C_VOF there.

    Also look at the multiphase macros, you can call the phase thread by thread_sub_thread if needed inside a loop

  • Venky_94Venky_94 Posts: 30Member

    Hey,

    Sorry I wasn't able to respond earlier as the site was in read-only mode. My earlier issue seemed to be a silly one, I had to forgot to declare UDMs. (My bad!)

    I changed my UDF however and called upon F_VOF with the phase thread using THREAD_SUB_THREAD command. My doubt is whether does FLUENT calculate VOF at the faces for the interior cells? As in does F_VOF have a valid value at the interior cells or is it only valid for the boundary faces? (I'm asking this because I read something like that in another forum and thought I'd confirm it with ANSYS people)

    Because my program ran perfectly with the above code but, the value stored in the UDMI seems to be 0 at all times. And I do not understand why that is.

  • YasserSelimaYasserSelima Posts: 944Member

    Fluent uses cell centred values for calculations. The face values is calculated because they are required in many operations. So, if you get F_VOF as zero, this means it is not calculated

  • Venky_94Venky_94 Posts: 30Member

    If you could look at the below section on my code, the I tried printing out the values of alphanum and the UDM they were both consistently turning out to be zero. So I just wanted to confirm if Fluent calculates the phase fraction at the faces at all.

    From what you said, I understand that in this case, it may not be calculated. But is there a way to obtain the phase fraction values at the faces at all? Or would that be a dead end?

    c_face_loop(c,t,i)					/* loops over all faces of a cell */
    {
    tf = C_FACE_THREAD(c,t,i);				/* obtains the associated face thread */
    F_AREA(A,f,tf);						/* computes area of each face */
    alphadenom += NV_MAG(A);				/* computes total face area magnitude and sums as the loop runs */
    alphanum += F_VOF(f,t)*NV_MAG(A);			/* F_VOF computes the phase fraction of air at each face, multiplies it with area of face and sums it over all faces of the cell as the loop runs*/
    }
    C_UDMI(c,t,0) = alphanum/alphadenom;			/* calculates and stores the area averaged volume fraction of air for each individual cell in the UDM */
    }
    end_c_loop(c, t)
    }
    
  • YasserSelimaYasserSelima Posts: 944Member

    @Venky_94


    Try adding this after the loop


    alphadenom = PRF_GRSUM1(alphadenom);
    alphanum = PRF_GRSUM1(alphanum);
    
  • Venky_94Venky_94 Posts: 30Member

    I understand that the PRF_GRSUM1 command sums the value of the variable over all compute nodes. But my idea here is to perform the operation at a cell level and since the cells are exclusively contained in their respective compute nodes, do you think this command will help?

  • YasserSelimaYasserSelima Posts: 944Member

    You have a point. It shouldn't help for most cells.

    So your option now is to interpolate between two cells to get face values. Search the manual for

    INTERIOR_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0,dr1)

    you might also find more useful macros in the same chapter, Connectivity macros.

Sign In or Register to comment.