CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

VoF Volume detection

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By maHein

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2018, 10:08
Default VoF Volume detection
  #1
Member
 
Join Date: Jun 2012
Posts: 76
Rep Power: 13
maHein is on a distinguished road
Hello,

I am implementing a solver for the conversion of VoF droplets to Lagrangian particles. Therefore I need to identify all enclosed VoF droplets in order to convert them to particles with equal size / mass / momentum. Beginning with a certain cell, I recursively iterate over every neighbouring cell until I find no more liquid cell (marker_ functions as a variable to distinguish between gas and liquid).

The recursive function looks like the following:
Code:
// cellI - label of starting cell
// volID - ID for the resulting enclosed VoF droplet
// marker_ - volScalarField to check for gas (= 0) and liquid (= 1)
// volumeID_ - volScalarField, where connecting liquid cells have the same ID
void checkRecursive(label cellI, const scalar& volID)
{
    // get neighbours of cellI
    const labelList& neighbours = mesh_.cellCells()[cellI];

    // loop over all neighbouring cells of cellI
    forAll(neighbours,i)
    {
        // neighbour cell ID
        label neighbourI = neighbours[i];

        // check if neighbour cell is liquid
        if (marker_[neighbourI] > 0.5)
        {
            // set volume ID
	    volumeID_[neighbourI] = volID;
            // reset marker to avoid infinite loop
	    marker_[neighbourI] = 0.0;

            // repeat check for all neighbours recursively
            checkConnection(neighbourI, volID);
        }
    }
}
This function works up to a certain point (after checking thousands and thousands of cells on large meshes) when suddenly a segmentation fault occurs. Although, up to this point all cell and neighboring labels look reasonable. It looks like OpenFOAM tries to access data which is not available / outside of the stored field ranges. How could that be possible? I am just looking for the neighbors of a given cell?

Does someone has any advise to get rid of that error?

Regards

Martin
amolrajan likes this.
maHein is offline   Reply With Quote

Old   November 13, 2018, 06:19
Default
  #2
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
Quote:
Originally Posted by maHein View Post
Hello,

I am implementing a solver for the conversion of VoF droplets to Lagrangian particles. Therefore I need to identify all enclosed VoF droplets in order to convert them to particles with equal size / mass / momentum. Beginning with a certain cell, I recursively iterate over every neighbouring cell until I find no more liquid cell (marker_ functions as a variable to distinguish between gas and liquid).

The recursive function looks like the following:
Code:
// cellI - label of starting cell
// volID - ID for the resulting enclosed VoF droplet
// marker_ - volScalarField to check for gas (= 0) and liquid (= 1)
// volumeID_ - volScalarField, where connecting liquid cells have the same ID
void checkRecursive(label cellI, const scalar& volID)
{
    // get neighbours of cellI
    const labelList& neighbours = mesh_.cellCells()[cellI];

    // loop over all neighbouring cells of cellI
    forAll(neighbours,i)
    {
        // neighbour cell ID
        label neighbourI = neighbours[i];

        // check if neighbour cell is liquid
        if (marker_[neighbourI] > 0.5)
        {
            // set volume ID
	    volumeID_[neighbourI] = volID;
            // reset marker to avoid infinite loop
	    marker_[neighbourI] = 0.0;

            // repeat check for all neighbours recursively
            checkConnection(neighbourI, volID);
        }
    }
}
This function works up to a certain point (after checking thousands and thousands of cells on large meshes) when suddenly a segmentation fault occurs. Although, up to this point all cell and neighboring labels look reasonable. It looks like OpenFOAM tries to access data which is not available / outside of the stored field ranges. How could that be possible? I am just looking for the neighbors of a given cell?

Does someone has any advise to get rid of that error?

Regards

Martin
Quick question: does it crash when reaching a non-processor boundary?
guin 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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
[blockMesh] blockMesh error - Negative Volume Block adoledin OpenFOAM Meshing & Mesh Conversion 2 June 22, 2016 10:44
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
Fluent VOF Volume of Fluid Realistic Solution Problem wormik FLUENT 3 June 21, 2009 07:04


All times are GMT -4. The time now is 10:14.