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/)
-   -   how to calculate mass flow rate on patches and summation of that during the run? (https://www.cfd-online.com/Forums/openfoam-post-processing/115428-how-calculate-mass-flow-rate-patches-summation-during-run.html)

philippose February 2, 2017 14:22

Hello both of you,
@Bernhard: I think what Sridhar meant by "last step" is that he prepared his case, and setup everything, and as the "last step", started the simulation using the "mpirun ...." command, which then immediately caused the simulation to abort with the error he has shown.

Dont think he meant "last step" as in... last simulation iteration.

@ Bernhard, Sridhar:
I think the error can be found here...:

Code:

veloFlow
{
type swakExpression;
valueType internalField;
verbose true;
outputControl timeStep;
outputInterval 1;
aliases {alpha alpha.water;}
variables ("thres=0.60;")
expression "(alpha>thres) ? mag(U) : 0";
accumulations (max weightedAverage);

}


total
{
type swakExpression;
valueType internalField;
verbose true;
outputControl timeStep;
outputInterval 1;
aliases {alpha alpha.water;}
expression "vol()*alpha";
accumulations (sum);

}

There are missing ";" (semi-colons) at the end of the lines "aliases" (in both veloFlow and total) and "variables" (in veloFlow).

This is triggering the error.

Regards,
Philippose

shri@ February 2, 2017 23:36

Hello !

@ philippose sir,

Yes the error was in the missing semicolon at the end. I made the changes and it worked.


Thank you very much for reply.



@ Bernhard sir,

Here's the sequence of operations

1. blockMesh >> works fine
2. checkMesh >> "Mesh OK"
3. setFields >> works fine
4. decomposePar >> works fine
5. mpirun -np 8 renumberMesh -overwrite -parallel >> works fine
6. mpirun -np 8 interFoam -parallel >> this prompts the error I quoted above.


As philippose sir suggested the error prompts even before the first timestep is calculated.

I am working with OpenFoam 3.0.x and swak version is 0.4.1 and ubuntu 15.10. (I am able to use other functionalities of swak4Foam with current setup)


Thank you

Shridhar

Andrea23 February 16, 2021 08:20

Hi;

Maybe I am a bit late but I am trying to do something similar I want to calculate the output flow of a scalar, so I want to calculate phi*T (T is the volScalarField)

volFlow
{
type swakExpression;
valueType patch;
patchName OUTLET;
verbose true;

timeEnd 500;
outputControl timeStep;
outputInterval 5;
writeControl timeStep;
writeInterval 5;

expression "phi*T";
accumulation (sum);
}

I have swak4foam installed, I am using openFoam 8 and I loaded these libraries in controlDict

libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libgroovyBC.so"
"fieldFunctionObjects.so"
"libgroovyBC.so"
);

But openfoam does not write the output of this function. Do you know the problem?
"phi*T" is correct? I want the sum for all boundary cell of "outflow facecell phi * cellcenter value of T"

last thing "accumulation (sum)" sum values of all previous timesteps (so in time 3 the value is time1+time2+time3)?

lourencosm February 16, 2021 08:31

scalar flux only with OpenFOAM
 
Hey,
You don't need swak4Foam for this anymore:

Code:

fluxT
{
    type            surfaceFieldValue;
    libs            ("libfieldFunctionObjects.so");

    writeControl      timeStep;
    writeInterval    1;
    writeFields        false;
    writeArea          false;
    log                  false;
    surfaceFormat  none;

    regionType      patch;
    name            OUTLET;

    operation      weightedSum;
    weightField    T;
    fields            (phi);
    scaleFactor    -1;
}



Quote:

Originally Posted by Andrea23 (Post 796326)
Hi;

Maybe I am a bit late but I am trying to do something similar I want to calculate the output flow of a scalar, so I want to calculate phi*T (T is the volScalarField)

volFlow
{
type swakExpression;
valueType patch;
patchName OUTLET;
verbose true;

timeEnd 500;
outputControl timeStep;
outputInterval 5;
writeControl timeStep;
writeInterval 5;

expression "phi*T";
accumulation (sum);
}

I have swak4foam installed, I am using openFoam 8 and I loaded these libraries in controlDict

libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libgroovyBC.so"
"fieldFunctionObjects.so"
"libgroovyBC.so"
);

But openfoam does not write the output of this function. Do you know the problem?
"phi*T" is correct? I want the sum for all boundary cell of "outflow facecell phi * cellcenter value of T"

last thing "accumulation (sum)" sum values of all previous timesteps (so in time 3 the value is time1+time2+time3)?


Andrea23 February 16, 2021 08:46

Quote:

Originally Posted by lourencosm (Post 796329)
Hey,
You don't need swak4Foam for this anymore:

Code:

fluxT
{
    type            surfaceFieldValue;
    libs            ("libfieldFunctionObjects.so");

    writeControl      timeStep;
    writeInterval    1;
    writeFields        false;
    writeArea          false;
    log                  false;
    surfaceFormat  none;

    regionType      patch;
    name            OUTLET;

    operation      weightedSum;
    weightField    T;
    fields            (phi);
    scaleFactor    -1;
}


Thanks a lot, it works


All times are GMT -4. The time now is 15:25.