CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   MRFSimpleFoam simulate centrifugal pump (https://www.cfd-online.com/Forums/openfoam/188856-mrfsimplefoam-simulate-centrifugal-pump.html)

jock June 8, 2017 06:47

MRFSimpleFoam simulate centrifugal pump
 
Hi foamers
I meet some questions about simulation of centrifugal pump ,I can not output its head and efficiency.
Who's gonna send me this program?
thank you
jack

anttiad9000 June 9, 2017 08:51

Hello jack,

I do this by using swak4Foam and an the built-in forces function. Once you have installed the swak4Foam add these lines to your controlDict:

Code:

libs
(
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libforces.so" // this is for forces
);
functions
{
    forces
    {
        type forces;
        outputControl timeStep;
        outputInterval 1;
        enabled true;
        patches
        (
            add_all_wetted_rotating_hydraulic_surfaces_here
        );
        rhoName rhoInf;
        log true;
        rhoInf add_fluid_density_here;
        CofR (0 0 0);
    }
    totalHead
    {
        type expressionField;
        outputControl timeStep;
        outputInterval 1;
        fieldName Htot;
        redirectType Htot;
        expression "p/9.81+pow(mag(U),2)/(2*9.81)";
        autowrite true;
        dimension [0 1 0 0 0 0 0];
    }
    Himpeller
    {
          type patchExpression;
          outputControl timeStep;
          outputControlMode timeStep;
          outputInterval 1;
          enabled true;
          variables
          (
              "Houtlet{add_impeller_outlet_patch_here}=sum(phi*Htot)/sum(phi);"
              "Hinlet{add_impeller_inlet_patch_here}=sum(phi*Htot)/sum(phi);"
          );
          patches
          (
              add_one_of_the_patches_here
          );
          expression "Houtlet-Hinlet";
          verbose true;
          allowCoupled true;
          accumulations ( average );
    }
}

With these functions force and torque components will be printed to the log and also to separate file every timestep. The same happens with head. You get the inlet power by multiplying torque in shaft direction with angular velocity, omega. The efficiency is calculated with the equation eta = (rho*g*Q*H)/(Pinlet). I hope this helps.

If you already have already finished you simulation, add the lines above to your controlDict and run one more time-step to get the output.

Also, if you do not have swak4Foam or don't want to install it for some reason you could also grep the data from result fields manually or by creating a script. Though, the method above is a much simpler approach.

P.S. There might be typos as I did not test it. Also remember to replace the patch names.

I hope this helps you,
Antti

jock June 9, 2017 10:28

Thank you,Antti. I see.
I have some other questions.
I want to monitor the inlet and outlet pressure during the simulation. What should I do?May I use "foamCalc"?
thank you for much.
jack

anttiad9000 June 13, 2017 03:33

Hello jack,

To get proper monitors at every time step you can just change the Himpeller function from the previous post to two separate functions:

Code:

    Hinlet
    {
          type patchExpression;
          outputControl timeStep;
          outputControlMode timeStep;
          outputInterval 1;
          enabled true;
          variables
          (
"Hinlet{add_impeller_inlet_patch_here}=sum(phi*Htot)/sum(phi);"
          );
          patches
          (
              add_impeller_inlet_patch_here
          );
          expression "Hinlet";
          verbose true;
          allowCoupled true;
          accumulations ( average );
    }
    Houtlet
    {
          type patchExpression;
          outputControl timeStep;
          outputControlMode timeStep;
          outputInterval 1;
          enabled true;
          variables
          (
"Houtlet{add_impeller_outlet_patch_here}=sum(phi*Htot)/sum(phi);"
          );
          patches
          (
              add_impeller_outlet_patch_here
          );
          expression "Houtlet";
          verbose true;
          allowCoupled true;
          accumulations ( average );
    }

Personally, I have never used foamCalc but as far as I understand, foamCalc calculates a new field for a resolved timestep from another field. For example to get speed from velocity by calculating mag(U) from the field U. This would also mean that you have to save the data for each timestep you want to calculate it. It would not make sense here to use foamCalc.

Another point is that you need to calculate mass averaged value which reduces to volumetric average for incompressible flows which means that you have to combine two different fields which is exactly what the above function does with swak4Foam.

Antti

jock June 13, 2017 08:44

Hi Antti,
I am using swak4Foam,thank you for your help!
Jack

saleriCAE June 15, 2017 05:45

Hi,

is it possible to use swak4foam also for taking the flow rate through a ggi patch and through a desired section?

Thank you

anttiad9000 June 15, 2017 06:07

Hi saleriCAE,

Although this is a bit off-topic I will give you a simple answer. I assume that by 'taking the flow rate' you mean monitoring the flow rate through a certain patch. If so, yes, it is possible and very simple. swak4Foam is a very useful tool to learn that makes implementing all kinds of monitors possible. You could do this for example with this function:

Code:

    Qmonitor
    {
          type patchExpression;
          outputControl timeStep;
          outputControlMode timeStep;
          outputInterval 1;
          enabled true;
          patches
          (
              patch_you_want_to_monitor
          );
          expression "phi";
          verbose true;
          allowCoupled true;
          accumulations ( sum );
    }

There are some differences to the function before as no new variables are needed here. Also, the accumulation is changed from average to sum as it is more appropriate in this case. In the last case it does not actually matter which one it is. Basically, the function just sums all the phi's on each patch face and outputs the sum to a file and, the log.

Hope this helps,
Antti

saleriCAE June 15, 2017 10:46

Hi Antti,

thank you for your reply.

What if I want to take the flow rate through an arbitrary section of the model?
Let us assume I have a pipe from z=0 (patch inlet) to z=100 (patch outlet) and I want to take the flow rate at z=50 (where I have no patch defined). Is it possible with swak4foam?

Thank you very much.

anttiad9000 June 15, 2017 12:32

Hello saleriCAE,

yes that is at least somewhat possible. I have done this once over a year ago by creating an stl-surface file and used a swak4Foam function with some modifications. There should be an option that uses face zones/sets, when you would have to define the zone/set, but I am not familiar with it. Other options might exist as well but I haven't used them.

Also, unfortunately I cannot remember how to set up the function from the top of my head and I don't have time now to research the issue. I suggest that you search swak4Foam guides and examples, for instance here http://openfoamwiki.net/index.php/Contrib/swak4Foam

Antti


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