CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Get access to the coordinates of a cell for post-processing of rising bubble (https://www.cfd-online.com/Forums/openfoam-post-processing/241831-get-access-coordinates-cell-post-processing-rising-bubble.html)

giano March 22, 2022 04:54

Get access to the coordinates of a cell for post-processing of rising bubble
 
Dear all, thank you very much in advance for your support.
I am trying to implement a function in my controlDict to calculate the center of mass of my bubble rising (solver interFOAM, version OF7). I managed to implement some functions for the computation of Volume integrals and weighted volume integrals, but since the quantity of interest in my case is:


c_{x}=\frac{\int \alpha x dV}{\int \alpha dV}
c_{y}=\frac{\int \alpha y dV}{\int \alpha dV}


I would like to get access to the x and y coordinates of the cells in order to obtain this quantity directly in my postProcessing folder.
So far, the changes I made are the implementation of these functions in my controlDict case:


Code:

functions
{
    volumeAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        log            true;
        writeControl    writeTime;
        writeFields    true;

        regionType      all;
        operation      volAverage;

        fields
        (
            p_rgh
            U
        );
    }

    weightedVolAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        log            true;
        writeControl    writeTime;
        writeFields    true;

        regionType      all;
        operation      weightedVolAverage;

        weightField    alpha.air;

        fields
        (
            U
        );
    }

 }


Do you know how to do it? If I go in the createFields.H directory of my interFoam solver and introduce new volScalarField I cannot get compile it for several errors trying different expressions for the positions (pol.(), cellI[1], etc). Any advice?




An alternative approach for the computation of the rising velocity is to calculate directly:


u_{xb}=\frac{\int \alpha u_{x} dV}{\int \alpha dV}
u_{yb}=\frac{\int \alpha u_{y} dV}{\int \alpha dV}


But in this case the output of the routine are not save as ASCII-files. Any suggestion on how to modify the outputs in order to make them post-processable in matlab for instance?


Thanks!!

ElizabethDauenaguer August 18, 2022 01:08

Hi! I have the same broblem. Did you find any solution?


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