OpenFOAM Tutorial for Extrudate in a Die Assembly

Assumptions on steps that are already completed:
Step 1:  Copy the files you need from an example problem in OpenFOAM.
This tutorial will use the files from the "/run/tutorials/incompressible/simpleFoam/pitzDaily" directory in your user directory.  Copy the directorys within pitzDaily and all sub-files and sub-directories.  For the sake of this example, we will assume the directories and files are copied from the pitzDaily directory to a directory called "ExtrudateExample".

Strictly speaking, simpleFoam is a turbulent solver.  It is possible to turn off the turbulence model, allowing the solver to be used as a laminar solver.  Flow in extruder dies tend to be well within the laminar range.

Step 2: Import your geometry.
A good place to start is to delete all files within ExtrudateExample/constant/polyMesh.  Those files would be blockMeshDict, boundary, faces, neighbour, owner, and points.  By emptying the directory, it removes the chance that you will use the incorrect files for your solution.  For this example, it will be assumed the .unv file to be used has been copied into the ExtrudateExample directory.  To import your geometry into the example:
Step 3: Identify your faces.
Go into the ExtrudateExample/constant/polyMesh directory and edit the "boundary" file.  Each face will have an entry in the file.  For each face, change the line that reads "type      patch:" to read the appropriate patch type.  For example, the face that will be in inlet side of your die will need to read "type     inlet:" outlet and wall are other patch types you are likely to use.

Step 4: Change the problem to be laminar.
 In the "constant" directory, open RASProperties and edit it.  Change the lines that read

RASModel        kEpsilon;

turbulence      on;

to read:

RASModel        laminar;

turbulence      off;


It should only be necessary to change one of the two lines, but changing them both will not hurt.

Step 5: Enter the power law parameters
In the "constant" directory, open transportProperties and edit it.  Change the transportModel line to read:


transportModel  powerLaw;

And add the following lines:

powerLawCoeffs
{
    k             k [0 2 -1 0 0 0 0] 2800;
    n             n [0 0 0 0 0 0 0] 0.4;
    nuMin         nuMin [0 2 -1 0 0 0 0] .1;
    nuMax         nuMax [0 2 -1 0 0 0 0] 1000000;
}

k and n are pretty obvious from the standard terminology.  nuMin and nuMax are arbitrary limits.  Make sure nuMin is less than you are likely to have in your model and that nuMax is likely higher than you will see in you simulation.

The location the powerLawCoeffs lines are added should not matter greatly.  For my simulations, I tend to place it after the line for nu. 

Step 6: Change the initial pressure file.
Go into the ExtrudateExample/0/ directory.  Open the file for p. 

In p, the file will read (in part):

boundaryField
{
    inlet          
    {
        type            zeroGradient;
    }

    outlet         
    {
        type            fixedValue;
        value           uniform 0;
    }

    upperWall      
    {
        type            zeroGradient;
    }

    lowerWall      
    {
        type            zeroGradient;
    }

    frontAndBack   
    {
        type            empty;
    }
}


It will need to be changed to read:

boundaryField
{
    F1          
    {
        type            zeroGradient;
    }

    F2         
    {
        type            fixedValue;
        value           uniform 0;
    }

    Walls      
    {
        type            zeroGradient;
    }
}

This is assuming your faces are F1 for the inlet, F2 for the outlet, and Walls for the walls.  This file defines the outlet pressure to be 0 Pa.  If you are a purist and want absolute pressure instead of relative pressure, the value can be changed to 101325 (atmospheric pressure).  The simpleFoam example had more faces defined.

Step 7: Change the velocity file.
Go into the ExtrudateExample/0/ directory.  Open the file for U. 

In U, the file will read (in part):

boundaryField
{
    inlet          
    {
        type            fixedValue;
        value           uniform (10 0 0);
    }

    outlet         
    {
        type            zeroGradient;
    }

    upperWall      
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    lowerWall      
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    frontAndBack   
    {
        type            empty;
    }
}


It will need to be changed to read:

boundaryField
{
    F1          
    {
        type            fixedValue;
        value           uniform (.016 0 0);
    }

    F2         
    {
        type            zeroGradient;
    }

    Walls      
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
}

This is assuming your faces are F1 for the inlet, F2 for the outlet, and Walls for the walls.  The simpleFoam example had more faces defined.  In the F1 value, 0.016 is the velocity velocity in m/sec in the x direction, the y and z values are 0 m/sec.  0.016 was chosen as a not atypical value for a small extruder (50 mm twin screw, for example) feeding 2 die buttons with an inlet diameter of 1 1/4" (31 mm or so) at a total feed rate of 100 kg/hr.  You can calculate your values as suitable.

Step 8: Change the fvSchemes file.
Go into the ExtrudateExample/system/ directory.  Open the file for fvSchemes. 

In fvSchemes, the file will read (in part):

ddtSchemes
{
    default         steadyState;
}


Change it to read:

ddtSchemes
{
    default         Euler;
}

This is a solver that seems to work better for extrudate problems.  The change may not be necessary. 


Step 9: Change the fvSchemes file.
Go into the ExtrudateExample/system/ directory.  Open the file for controlDict. 

This file, as written, is suitable for relatively simple problems.  The file as it exists, will write output (the line reading "writeInterval   50;") from simpleFOAM every 50 time steps.  That is 20 directories with all output parameters.  For large meshes, this can add up to a lot hard drive space.  For a steadystate solution, the final result is the only one likely to be of interest, so 50 could be changed to 1000 (the final time step) without any loss of your results. 

Step 10: Run simpleFoam and see if it converges.
Run simpleFoam and see if the solution will converge.

Open a terminal in your ExtrudateExample directory. 
Type in "simpleFoam" (without the quotation marks).
Wait.  Perhaps for a very long time.

Possible outputs include
  • "timestep continuity error".  This means the problem will very much not converge as it is set up.
  • Failure to converge.  The final error estimates for Ux, Uy, Uz, or pressure is greater than 10^-5 units.  Basically, this indicates the the problem is not able to solve the problem very well.  Much of the solution may be correct, but there may be some areas with poor calculations.  Treat these solutions with suspicion.  See Step 11 to see how to get a solution for this type of problem.
  • Success.  The final error estimates for Ux, Uy, Uz, and pressure are less than 10^-5 units.
If you get convergence, type "paraFoam" to start ParaView.  See ParaView for pointers on how to display the results.

Step 11: Solutions for shear thinning problems.
If you have a problem using a shear thinning fluid (n<1) that fails to converge, one approach is to solve the simulation for a newtonian fluid, then feed the results for that problem into the shear thinning simulation.  A simplified version of what you need to do:
  • Change the value of n to 1.  See Step 5 above for how to do this.
  • Run the simulation.  See Step 10 above for how to do this.
  • If the solution converges, copy the p and U files from your final time to the 0 directory.  You will replace the U and p files described in Steps 6 and 7.  The files from your final time will have values for all points in your mesh.
  • Change the value of n to your value (0.4 for corn extrudate, as an example)
  • Run the simulation.  See Step 10 above for how to do this.
  • Hopefully your problem converges and you can view the results with paraFoam/ParaView.
  • It may be necessary to run the solution in an iterative manner, perhaps running Newtonian first (n=1), then incremental steps until you reach your value for n.  For example you may need to feed the Newtonian output to a problem with n=0.8, take that output and feed it into a simulation with n=0.6, and finally feed that output into a simulation with n=0.4, which will finally give you a solution.  Even smaller steps for n may be needed.
As this approach is "cookbook", it is well suited to being automated with shell scripts.  Look here in the future for a shell script for the iterative problem with n changing in steps.

Good luck with any simulations you choose to run.