CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Boundary condition based on cellZone values (https://www.cfd-online.com/Forums/openfoam-programming-development/224041-boundary-condition-based-cellzone-values.html)

dygu February 5, 2020 08:23

Boundary condition based on cellZone values
 
Hello,

I'd like to specify an inlet/outlet boundary condition for velocity using something like the flowRateInletVelocity condition where the massFlowRate is specified based on the mass flow rate measured at a cellZone elsewhere in the domain. I tried to achieve this using swak4Foam:

Code:

    outlet
    {
        type            flowRateInletVelocity;
        flowRateExpression "0";
        flowRate        swak
                        {
                        variables              ( "mass_in{cellZone'pump_zone}=sum(rhoPhi);" );
                        expression              "mass_in*-1";
                        valueType              patch;
                        patchName              outlet;
                        independentVariableName t;
                        };
        massFlowRate    $flowRate;
        value          uniform (0 0 0);
    }

but I get an error that rhoPhi is not in memory or on disc. If I instead use some patch in place of the cellZone, the simulation works.

Can swak4Foam access cellZone data for specifying boundary conditions? If that is not the case, would a coded BC help? Or is it possible to have an internal patch in place of the cellZone that is transparent to the flow and yet can measure the mass flow rate through it so that I can use that patch in the swak expression?

Thank you for any hints!

dygu February 5, 2020 12:57

I now realize that a cellZone does not have access to rhoPhi as that is a face-based value. I switched to a faceZone to resolve this problem:

Code:

variables              ( "mass_in{faceZone'f0}=sum(rhoPhi);" );
When using a dynamic mesh, I got an error "initSwakFunctionObject::movePoints isn't properly implemented". I am testing my luck by suppressing this as suggested by the message with the following in the controlDict:

Code:

    initSwak
    {
        // needed to allow DataEntry to work
        type initSwakFunctionObject;
        region region0;
        ignore_unimplemented_initSwakFunctionObject::movePoints true;
    }

Assuming that this works on a dynamic mesh, I wonder if I can recreate this functionality without swak4Foam to minimize the number of add-ons to install on remote compute nodes?

Thank you


All times are GMT -4. The time now is 04:57.