CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[Other] Injection molding solver for OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes
  • 8 Post By krikre
  • 1 Post By krikre
  • 1 Post By krikre
  • 1 Post By samiam1000
  • 2 Post By krikre

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2017, 07:44
Default Injection molding solver for OpenFOAM
  #1
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Hello everybody!

I'd like to invite anyone who's interested to try out our solver for injection molding https://github.com/krebeljk/openInjMoldSim. I'd be very grateful for any kind of feedback.

We implemented the Tait-equation of state and the Cross-WLF model in compressibleInterFoam from OpenFOAM version 3.0.1 and named it openInjMoldSim. Along the solver there are four cases: a demo case for filling and packing and three tests.

The demonstration of filling and packing compares the simulated pressures with experimental values. The cavity is modeled as a 2D case. The experimental pressure evolution from the first measuring position is imposed at one end of the cavity and the other two positions are compared.

The validations test
  • the Cross-WLF viscosity in a perfect shearing flow at a particular temperature,
  • the heat transfer coefficient in a quasi 1D dimensional heat conduction case and
  • the Tait equation for a confined material being heated and pressurized.

The cases include gnuplot and python scripts to plot the results.
elvis, samiam1000, y_jiang and 5 others like this.
krikre is offline   Reply With Quote

Old   June 8, 2017, 11:17
Default Trouble finding a converged solution
  #2
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Edit:
It looks like a common convergence issue. I'm looking into:
Convergence
How to use PIMPLE properly?
Also, I think there was a mistake in the fvSolution file, where under-relaxation for p was set instead of p_rgh.


Trouble finding a converged solution
I'd like to ask for some help with setting up the demo case. The simulation finishes but the solution looks invalid. So far I tried setting stricter convergence tolerances but with limited success.
I described the case and what I tried in a readme file in the repository on a new branch. Please see the link, because there are more images and details (plus all the files).

I first copied the demo case (fill_pack_00) and simplified it: made the flow practically single phase and more or less isothermal (cases pack_01 ... pack_04). The tolerances were made stricter in the cases pack_05 ... pack_09. This was then also attempted in the demo case: fill_pack_01.

In the following I try to state the relevant facts so the text is a bit dull, but please let me know if there's something else I can provide.

The case (fill_pack_00)
The solver used is basically compressibleInterFoam (OpenFOAM 3.0.1) but with some modifications. Cavity (2D) of 1.2 mm thickness and length of approx. 65 mm is being filled by polymer (melt temperature 230 degC) through the inlet - a pressure boundary condition is prescribed and the experimental pressure evolution P1 is imposed. When the cavity is full (t=0.15s), the outlet is closed and the pressure is still applied at the inlet forcing the material to compress. At the same time the polymer is cooling (mold temperature 50 degC) - heat transfer coefficient on the walls 1.25 kW/(m2K). At about 100 degC the material solidifies - the viscosity is increased to 100 MPas.
Note also, that the viscosity is pressure dependent. Removing the dependence appears to make the issue less severe but not vanish.
The packing phase is divided into pack1 phase with the result write frequency of 0.01s and pack2 phase starting at t=1s and the result write frequency of 0.1s finishing at t=6s.



The issue
The cavity pressure should not be greater than the injection pressure. A smoother solution is expected.


Simplification (cases: pack_01, ...)
The demo case is copied and the simulation of the filling stage is removed (skipped) by modifying the AllRun script. The call to setFields is also removed to simply start with a full cavity.
The mold temperature is set to 230 degC which is equal to the melt temperature making heat transfer insignificant, again eliminating complexity. The outlet patch still transfers heat (mold temperature 50 degC by mistake) but this has little effect.


Attempt to resolve

A fixed timestep of 1e-5s is prescribed - at least 10 times shorter than the automatically chosen in pack_04. One second of simulated time required almost 3h of calculation on a laptop. The result appears resonable.


Alternative attempt
The PIMPLE p_rgh tolerance set to 1e-5 Pa. Solution improved with respect to the case pack_04. Calculation takes 30 min on a regular laptop.
The value 1e-5 Pa made the solver do more iterations but has no physical significance.

Applying the alternative atempt to the demo case
The anomaly at the start of packing is resolved but the issue remains. Non-smoothness is evident at t=1s which is when the pack2 phase starts.


Setup for the pack_04 case
fvSolution
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    alpha.poly
    {
        nAlphaCorr      1;
        nAlphaSubCycles 1;
        cAlpha          1;
    }

    ".*(rho|rhoFinal)"
    {
        solver          diagonal;
    }

    pcorr
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;
            tolerance       1e-05;
            relTol          0;
            smoother        DICGaussSeidel;
            nPreSweeps      0;
            nPostSweeps     2;
            nFinestSweeps   2;
            cacheAgglomeration true;
            nCellsInCoarsestLevel 10;
            agglomerator    faceAreaPair;
            mergeLevels     1;
        }
        tolerance       1e-05;
        relTol          0;
        maxIter         100;
    }

    p_rgh
    {
        solver          GAMG;
        tolerance       1e-07;
        relTol          0.01;
        smoother        DIC;
        nPreSweeps      0;
        nPostSweeps     2;
        nFinestSweeps   2;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels     1;
    }

    p_rghFinal
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;
            tolerance       1e-07;
            relTol          0;
            nVcycles        2;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
            nPostSweeps     2;
            nFinestSweeps   2;
            cacheAgglomeration true;
            nCellsInCoarsestLevel 10;
            agglomerator    faceAreaPair;
            mergeLevels     1;
        }
        tolerance       1e-07;
        relTol          0;
        maxIter         20;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance       1e-06;
        relTol          0;
        nSweeps         1;
    }

    "(T|k|B|nuTilda).*"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-08;
        relTol          0;
    }
}

PIMPLE
{
    momentumPredictor no;
    transonic       no;
    nOuterCorrectors 1000;
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;

    residualControl
    {
        p_rgh
        {
                tolerance   1.0;
                relTol      0;
        }
        T
        {
                tolerance   0.01;
                relTol      0;
        }
        /*p
        {
                tolerance   1e6;
                relTol      1e-2;
        }*/
     }
}

relaxationFactors
{
    fields
    {
        p      0.3;
        pFinal   1;
        T      0.3;
    }
    equations
    {
        "U|k|epsilon|T"     0.3;
        "(U|k|epsilon|T)Final"   1;
    }
}


// ************************************************************************* //
fvSchemes
I haven't tried anything new in this file.
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         Gauss linear;
}

divSchemes
{
    div(phi,alpha)  Gauss vanLeer;
    div(phirb,alpha) Gauss linear;

    div(rhoPhi,U)  Gauss upwind;
    div(phi,thermo:rho.poly) Gauss upwind;
    div(phi,thermo:rho.air) Gauss upwind;
    div(rhoPhi,T)  Gauss upwind;
    div(rhoPhi,K)  Gauss upwind;
    div(phi,p)      Gauss upwind;
    div(phi,k)      Gauss upwind;

    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear uncorrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         uncorrected;
}

// ************************************************************************* //
Attached Images
File Type: jpg fill_pack_geom.jpg (25.5 KB, 556 views)
File Type: png fill_pack_00.png (83.7 KB, 544 views)
File Type: png pack_04.png (68.2 KB, 544 views)
File Type: png pack_05.png (58.5 KB, 541 views)
File Type: png fill_pack_01.png (87.7 KB, 545 views)
OpenFoamlove likes this.

Last edited by krikre; June 9, 2017 at 11:10.
krikre is offline   Reply With Quote

Old   September 13, 2017, 09:56
Default Solver does not work on me :(
  #3
New Member
 
Join Date: Jul 2017
Posts: 10
Rep Power: 9
OpenFoamlove is on a distinguished road
Hi thank you so much for sharing your solver.

I tried to work your solver but while executing Allwmake it shows me erros as below e.g.:

mojThermos.C:32:38: error: incompressiblePerfectGas.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:33:22: error: rhoConst.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:34:26: error: perfectFluid.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:35:29: error: PengRobinsonGas.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:36:35: error: adiabaticPerfectFluid.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:40:30: error: sensibleEnthalpy.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:41:36: error: sensibleInternalEnergy.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:42:20: error: thermo.H: Datei oder Verzeichnis nicht gefunden
mojThermos.C:55:25: error: heRhoThermo.H: Datei oder Verzeichnis nicht gefunden
In file included from mojThermos.C:56:
./crossWlfInSorodno/mojHeRhoThermo.H:39:22: error: heThermo.H: Datei oder Verzeichnis nicht gefunden
In file included from ./crossWlfInSorodno/mojFluidThermo.H:38,
from ./crossWlfInSorodno/mojRhoThermo.H:38,
from mojThermos.C:27:
./crossWlfInSorodno/mojBasicThermo.H: In static member function »static Foam::word Foam::mojBasicThermo:hasePropertyName(const Foam::word&, const Foam::word&)«:
./crossWlfInSorodno/mojBasicThermo.H:188: Fehler: »groupName« is not a member of »Foam::IOobject«
In file included from mojThermos.C:56:
./crossWlfInSorodno/mojHeRhoThermo.H: At global scope:
./crossWlfInSorodno/mojHeRhoThermo.H:53: Fehler: expected template-name before »<« token
./crossWlfInSorodno/mojHeRhoThermo.H:53: Fehler: expected »{« before »<« token
./crossWlfInSorodno/mojHeRhoThermo.H:53: Fehler: expected unqualified-id before »<« token
In file included from ./crossWlfInSorodno/mojHeRhoThermo.H:98,


the errors tell me that files e.g. incompressiblePerfectGas.H is not found.

are there missing some files or am I doing something wrong. Can you please help me to run the solver.
For your help I would be very thankful.

with best regards
Anna
OpenFoamlove is offline   Reply With Quote

Old   September 13, 2017, 12:48
Default
  #4
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Thank you for trying it out!

I think the compiler isn't finding all the source filles needed.

Are you sure your OpenFOAM 3.0.1 is properly set up?

Have you compiled other solvers before? Like icoFoam?
krikre is offline   Reply With Quote

Old   September 13, 2017, 16:43
Default
  #5
New Member
 
Join Date: Jul 2017
Posts: 10
Rep Power: 9
OpenFoamlove is on a distinguished road
I am trying it in OF 4. Is it incompatible in of4


Sent from my iPhone using CFD Online Forum mobile app
OpenFoamlove is offline   Reply With Quote

Old   September 13, 2017, 17:32
Default
  #6
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
I'm pretty sure it's incompatible with OF 4.

You can have multiple versions of OF on your computer using aliases.

Have a look at these (or google it):

Multiple OpenFOAM versions on one machine

http://openfoamwiki.net/index.php/In...nFOAM_versions

I hope you find it worth it!

I'll be updating the repository in the next week or two, if you're interested. I've improved the demo case to run reliably and added the possibility of tabulated thermal conductivity, specific heat and enthalpy. You can have at some of it already in the develop branch of the repository.
OpenFoamlove likes this.
krikre is offline   Reply With Quote

Old   September 15, 2017, 06:44
Default
  #7
New Member
 
Join Date: Jul 2017
Posts: 10
Rep Power: 9
OpenFoamlove is on a distinguished road
Thank you so much for your reply. It would be very kind of you to have the repository.

With best regards
Anna


Sent from my iPhone using CFD Online Forum mobile app
OpenFoamlove is offline   Reply With Quote

Old   September 4, 2020, 03:16
Default
  #8
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19
samiam1000 is on a distinguished road
Dear Krikre,

your software seems to be what I am looking for. I would like to ask you some questions, in order to understand is it is feasible what I do have in mind.

I do have a cavity (filled with an isotropic mat - I am going to simulate this with porous media, I guess) and I want to fill it with a liquid.

I would like to understand how the fluid front moves inside the cavity.

Is that what I can do, with your software? Would you mind explaining how it works and which version of OpenFOAM i shuould install?

Thanks a lot,
Samuele
Flip5 likes this.
samiam1000 is offline   Reply With Quote

Old   October 6, 2020, 09:29
Default
  #9
New Member
 
Héctor Sanmanuel
Join Date: Oct 2020
Posts: 1
Rep Power: 0
hectrodebac is on a distinguished road
Dear Krikre,
First of all I want to thank you for post this solver since I think it is exactly what I need. But I have a little problem, I'm following the steps that you state at Github and I am obtaining the following error when I run ./Allrun,
Code:
--> FOAM FATAL ERROR: 
cannot find file "/home/trial/Downloads/openInjMoldSim-master/tutorials/demo/fill_pack/system/dictionaryReplacement"

    From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 538.

I am using openFOAM 7, since is the last one that I see that this solver can work.



I tried to find the dictionaryReplacement on the repository but I'm unable to.
I'm sorry if this is a silly question, I'm quite new at OpenFOAM and I am not really familiar with the parameters.
Best regards.
hectrodebac is offline   Reply With Quote

Old   October 7, 2020, 05:06
Default
  #10
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
I'm in the middle of updating the tutorials to v7, since they were still at v3.0.1. Check the "develop" branch of the repo for the latest state.


Keep in touch!
hectrodebac and Harisha like this.
krikre is offline   Reply With Quote

Old   September 10, 2021, 03:51
Default
  #11
New Member
 
BAIRI SRI HARISHA
Join Date: Sep 2021
Posts: 1
Rep Power: 0
divyaa is on a distinguished road
what do those 2 tables in OPENINJMOLDSIM solver represent mate?
the table named fim_01_01_F_00_00_01_08.txt & fim_01_01_F_00_01_08.txt?


To be specific in my question, fim_01_01_F_00_00_01_08.txt has

((0. 293048.4625)
(0.010000000000000009 572789.025)
(0.020000000000000018 852526.165625)
what do those paired numbers represent? Please can i know?

similarly, in fim_01_01_F_00_01_08.txt, has

0. 293048.4625 100000. 100000.
0.010000000000000009 572789.025 100000. 100000.
0.020000000000000018 852526.165625 100000. 100000.

what does these numbers represent?

I am trying to apply this solver to my injection molding simulation, hence raised this doubt? sorry if this seemed too obvious of a question. I am just getting started.

Thank you.
divyaa is offline   Reply With Quote

Old   September 11, 2021, 10:44
Default
  #12
Member
 
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9
krikre is on a distinguished road
Quote:
Originally Posted by divyaa View Post
what do those 2 tables in OPENINJMOLDSIM solver represent mate?
the table named fim_01_01_F_00_00_01_08.txt & fim_01_01_F_00_01_08.txt?


To be specific in my question, fim_01_01_F_00_00_01_08.txt has

((0. 293048.4625)
(0.010000000000000009 572789.025)
(0.020000000000000018 852526.165625)
what do those paired numbers represent? Please can i know?

similarly, in fim_01_01_F_00_01_08.txt, has

0. 293048.4625 100000. 100000.
0.010000000000000009 572789.025 100000. 100000.
0.020000000000000018 852526.165625 100000. 100000.

what does these numbers represent?

I am trying to apply this solver to my injection molding simulation, hence raised this doubt? sorry if this seemed too obvious of a question. I am just getting started.

Thank you.

Hi,


the fim_01_01_F_00_00_01_08.txt sets the time dependence of the inlet pressure. It's called form here:

https://github.com/krebeljk/openInjM...ack/org0/p_rgh


the fim_01_01_F_00_01_08.txt contains the measured pressure evolutions and is only needed after your simulation is done and you want to compare the computed values with the measurements. This is the script that calls it:

the https://github.com/krebeljk/openInjM...l_pack/AllPlot


Regards!
krikre is offline   Reply With Quote

Reply

Tags
injection molding, solver


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting Fluent benefits and Injection Molding Software Jim87 FLUENT 1 August 6, 2023 17:06
fluent divergence for no reason sufjanst FLUENT 2 March 23, 2016 17:08
3d vof Smaras FLUENT 2 February 19, 2013 07:58
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 12:34
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 15:08


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