CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

T-junction simulation using interFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree8Likes
  • 2 Post By crubio.abujas
  • 1 Post By crubio.abujas
  • 2 Post By crubio.abujas
  • 1 Post By crubio.abujas
  • 1 Post By cmoreno98
  • 1 Post By crubio.abujas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 5, 2020, 13:25
Default T-junction simulation using interFoam
  #1
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Hello everybody,

I'm new to OpenFOAM and I'm trying to run a simulation of a T-junction (air entering through one inlet and water through the other) in microgravity conditions (g approximately 0). Since a picture is worth a thousand words, I show you the geometry and the mesh:





The mesh is done in Ansys and exported in .msh format. Then, the fluent3DMeshToFoam command is used to convert it from ASCII format to foam format.
The diameter of the channels is 1 mm, through the horizontal inlet (inlet1, walls1) enters air and through the vertical inlet (inlet2, walls2) enters water, both at 0.1 m/s.

I can consider the two flows to be incompressible, so I use interFoam solver. I know that the results should be something like this:





Air should advance through the horizontal pipe, meet the water at the junction and generate some bubbles. But when I run the simulation, air is not advancing through the channel and it's getting 'stucked' at the inlet like this:





I attach the three directories "0" (alpha.air, p_rgh and U files), "constant" (g, transportProperties and turbulenceProperties files) and "system" (controlDict, fvSchemes and fvSolution files) in the following link because I don't know where the problem is:
https://www.mediafire.com/file/60tv4...ction.rar/file

Some parameters:
  • inlet1 velocity: uniform (0.1 0 0); inlet2 velocity: uniform (0 -0.1 0)
  • deltaT = 5e-6; endTime = 0.2; writeInterval = 0.0016 (total of 125 directories)

How could I fix this problem? Thank you in advance,

Carlos.
cmoreno98 is offline   Reply With Quote

Old   March 6, 2020, 07:04
Default
  #2
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Hi Carlos,


The problem is on the boundary definition of the pressure. You have to tell OpenFOAM to calculate the required pressure to provide a specific flux, not just set it to 0.
Than can be done using fixedFluxPressure BC. You have to do it with both inlet1 and inlet2.


0/p_rgh:
Code:
    inlet1
    {
            type                 fixedFluxPressure;
            value                uniform 0;
     }

Hope it works!
ybapat and cmoreno98 like this.
crubio.abujas is offline   Reply With Quote

Old   March 6, 2020, 12:38
Default
  #3
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hi Carlos,


The problem is on the boundary definition of the pressure. You have to tell OpenFOAM to calculate the required pressure to provide a specific flux, not just set it to 0.
Than can be done using fixedFluxPressure BC. You have to do it with both inlet1 and inlet2.


0/p_rgh:
Code:
    inlet1
    {
            type                 fixedFluxPressure;
            value                uniform 0;
     }

Hope it works!
Thank you very much Carlos, now the air moves

But I have another problem: the simulation is not behaving as expected when the two fluids meet at the junction. These are the results at t = 0.0112 (everything is OK):




This is the last time step where the results are the ones that I expect. From this point on, air and water mix in a strange way (screenshot at t = 0.0192):




The Courant number blows up, causing the simulation to stop (the last directory that I obtain is t = 0.0272, when it should end at t = 0.2).

I don't know if the problem is that the mesh is not good enough or that some files are not OK. For instance, inside "system" directory, I don't know if decomposeParDict or setFieldsDict are mandatory files
I didn't include them... (soy nuevo en OpenFOAM y puede que haya cosas básicas que esté haciendo mal, no sé si el problema estará en el mallado o en alguno de los archivos)

Anyone knows how to solve this problem? Thanks
cmoreno98 is offline   Reply With Quote

Old   March 9, 2020, 04:19
Default
  #4
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Hello again Carlos,

It seems that you have some issues with the BC of the phases. On the file alpha.air you have fixed the value of the walls to always be 0 (water). I don't know if that is a design requirement but it seems that is blowing up your simulation. Try changing it to zeroGradient, that would make the simulation more stable.

You can check your mesh using the command checkMesh, that will tell you if some mesh metrics is wrong, altough if you use an external mesher you may have that information from it. The mesh do not seem to be too distorted, although the cell size can be too big to capture the interphase properly or other flux phenomenon. If you want to play around with mesh size you can use refineMesh to create a more resolute version of the current mesh.

Concerning the files you mentioned, the file decomposeParDict is for paralleling your simulation. It tells OF how to split your mesh in sections for each parallel process.

The file setFieldDict is for imposing a set of values inside your domain. Neither of these file is strictly mandatory.

Hope that helps you!
cmoreno98 likes this.
crubio.abujas is offline   Reply With Quote

Old   March 10, 2020, 18:39
Default
  #5
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Good night Carlos,


Quote:
Originally Posted by crubio.abujas View Post
It seems that you have some issues with the BC of the phases. On the file alpha.air you have fixed the value of the walls to always be 0 (water). I don't know if that is a design requirement but it seems that is blowing up your simulation. Try changing it to zeroGradient, that would make the simulation more stable.
Thanks, it makes sense to change it to zeroGradient. It is not a design requirement to have water at the walls.


Quote:
Originally Posted by crubio.abujas View Post
You can check your mesh using the command checkMesh, that will tell you if some mesh metrics is wrong, altough if you use an external mesher you may have that information from it. The mesh do not seem to be too distorted, although the cell size can be too big to capture the interphase properly or other flux phenomenon. If you want to play around with mesh size you can use refineMesh to create a more resolute version of the current mesh.
Regarding the mesh, I changed it a little bit in order to have smaller cells near the walls:







Using the command checkMesh on this mesh, the result is the following:

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 6-fa1285188035
Exec   : checkMesh
Date   : Mar 10 2020
Time   : 17:27:50
Host   : "carlos"
PID    : 4375
I/O    : uncollated
Case   : /home/carlos/OpenFOAM/carlos-6/run/prueba
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           42144
    internal points:  37871
    faces:            227803
    internal faces:   221109
    cells:            95071
    faces per cell:   4.72186
    boundary patches: 5
    point zones:      0
    face zones:       1
    cell zones:       1

Overall number of cells of each type:
    hexahedra:     7200
    prisms:        54228
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    33643
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology                  
    inlet1              582      500      ok (non-closed singly connected)  
    walls1              4174     2138     ok (non-closed singly connected)  
    inlet2              756      639      ok (non-closed singly connected)  
    walls2              600      640      ok (non-closed singly connected)  
    outlet              582      500      ok (non-closed singly connected)  

Checking geometry...
    Overall domain bounding box (0 -0.0005 -0.0005) (0.006 0.0015 0.0005)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (-3.83452e-17 -8.17958e-17 -2.72592e-17) OK.
    Max cell openness = 1.39693e-15 OK.
    Max aspect ratio = 38.1396 OK.
    Minimum face area = 1.38676e-10. Maximum face area = 1.38029e-08.  Face area magnitudes OK.
    Min volume = 5.93772e-15. Max volume = 4.59938e-13.  Total volume = 5.50062e-09.  Cell volumes OK.
    Mesh non-orthogonality Max: 58.5843 average: 13.0879
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.52523 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

 End
Is it good enough? Maybe I should make smaller cells.


Quote:
Originally Posted by crubio.abujas View Post
Concerning the files you mentioned, the file decomposeParDict is for paralleling your simulation. It tells OF how to split your mesh in sections for each parallel process.

The file setFieldDict is for imposing a set of values inside your domain. Neither of these file is strictly mandatory.

Hope that helps you!
Thank you for the explanation. I won't set up these files by the moment since they are optional.

So, following your recommendations, alpha.air, p_rgh, U and controlDict files should be like this?

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      alpha.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform 1;
    }

    inlet2
    {
        type            fixedValue;
    value        uniform 0;
    }

    walls1
    {
        type            zeroGradient;
    }

    walls2
    {
        type            zeroGradient;
    }

    outlet
    {
        type            zeroGradient;
    }
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet1
    {
        type            fixedFluxPressure;
    value        uniform 0;
    }

    inlet2
    {
        type            fixedFluxPressure;
    value        uniform 0;
    }

    walls1
    {
        type            zeroGradient;
    }

    walls2
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
    value        uniform 0; //Atmospheric pressure (Pgage)
    }
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform (0.1 0 0);
    }

    inlet2
    {
        type            fixedValue;
        value           uniform (0 -0.1 0);
    }

    walls1
    {
        type            noSlip;
    }

    walls2
    {
        type            noSlip;
    }

    outlet
    {
        type            zeroGradient;
    }
}

// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     interFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.2;

deltaT          0.000005;

writeControl    adjustableRunTime;

writeInterval   0.0016;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  no;

maxCo           2;
maxAlphaCo      1;

 // ************************************************************************* //
I have run the simulation again and I get a strange behavior of the air: it goes inside the vertical channel of water, like this:




It doesn't make sense and causes the Courant number to blow up after some iterations. Why is this happening? Is there a way to restrict the entrance of air into the vertical pipe? Or is happening because the cells of the mesh are not small enough? I could improve the mesh but I should decrease the time step in order to ensure that Co=U\frac{\Delta t}{\Delta x}<1 (and this simulation already took me 3.5 hours...).

I would be hugely grateful if you can help me with this issue.

Thank you very much,

Carlos.
cmoreno98 is offline   Reply With Quote

Old   March 11, 2020, 11:20
Default
  #6
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Hi again!

Its hard to tell... I've tried your set up and it worked for me. Maybe is related with he OF version, what version are you using? I've tried it with OF6. You can find the results and the case definition I've used here.


I don't know it those are the expected results. The interface may be better resolved with a finer mesh, but that shouldn't make the entire simulation to crash.



Neither the residuals nor the courant number seems to have unreasonable values. By the way, you may find interesting to use PyFoam for plotting relevant information while solving.

Concerning the simulation times, you may consider using a parallel running. Add a decomposeParDict file to your system file. This file may have different configuration parameters but I recommend you to start using the scotch method, that takes care of splitting your domain for each processor. That should reduce the time of simulation.

system/decomposeParDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


// Change 4 to your machine number of cores.
numberOfSubdomains 4;

method          scotch;

// ************************************************************************* //
For execute it in parallel just use:
Code:
# Split your domain in different regions, one for each process.
decomposePar

# Run in parallel. The -np value must be the same defined in the decomposeParDict
mpirun -np 4 interFoam -parallel

# Recompose the case to process the results
reconstructPar
Do not despair, beginnings are always hard!
sersol and cmoreno98 like this.
crubio.abujas is offline   Reply With Quote

Old   March 13, 2020, 07:44
Default
  #7
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hi again!

Its hard to tell... I've tried your set up and it worked for me. Maybe is related with he OF version, what version are you using? I've tried it with OF6. You can find the results and the case definition I've used here.
Thank you very much Carlos. Now this case is working perfect, you're great!
I'm using OF6 aswell.

Quote:
Originally Posted by crubio.abujas View Post


I don't know it those are the expected results. The interface may be better resolved with a finer mesh, but that shouldn't make the entire simulation to crash.
That's exactly what I want to do right now. I want to improve the resolution of the simulation by implementing a finer mesh. I've created this one, with 500k cells and inflation around the walls.
You say that a finer mesh shouldn't make the entire simulation to crash, but it does
I have tried to make the time step smaller (from 5 \mu s to 1 \mu s), but the Courant number gets very big and the simulation stops at time t = 0.01 s approximately (after running for 10 hours). Maybe the mesh is too fine? 500k cells are too many cells? (maybe I should try with 300k or so). I checked the mesh and it is OK:

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 6-fa1285188035
Exec   : checkMesh
Date   : Mar 13 2020
Time   : 12:27:15
Host   : "carlos"
PID    : 2305
I/O    : uncollated
Case   : /home/carlos/OpenFOAM/carlos-6/run/Structured/0.5_0.5_15
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           190032
    internal points:  175778
    faces:            1160192
    internal faces:   1136584
    cells:            503802
    faces per cell:   4.55889
    boundary patches: 5
    point zones:      0
    face zones:       1
    cell zones:       1

Overall number of cells of each type:
    hexahedra:     28800
    prisms:        223968
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    251034
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology                  
    inlet1              1418     1126     ok (non-closed singly connected)  
    walls1              16604    8405     ok (non-closed singly connected)  
    inlet2              1784     1413     ok (non-closed singly connected)  
    walls2              2400     2480     ok (non-closed singly connected)  
    outlet              1402     1118     ok (non-closed singly connected)  

Checking geometry...
    Overall domain bounding box (0 -0.0005 -0.0005) (0.006 0.0015 0.0005)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (8.67928e-17 -5.65932e-16 6.04785e-17) OK.
    Max cell openness = 8.52587e-16 OK.
    Max aspect ratio = 19.5164 OK.
    Minimum face area = 6.89058e-11. Maximum face area = 2.7508e-09.  Face area magnitudes OK.
    Min volume = 1.41624e-15. Max volume = 6.88307e-14.  Total volume = 5.54272e-09.  Cell volumes OK.
    Mesh non-orthogonality Max: 60.3291 average: 14.111
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.49182 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
I have also introduced the constantAlphaContactAngle boundary condition at both walls (beacuse I want to study the behavior of air when changing this parameter), like this:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      alpha.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform 1;
    }

    inlet2
    {
        type            fixedValue;
        value		uniform 0;
    }

    walls1
    {
        type            constantAlphaContactAngle;
        theta0          165;
        limit           gradient;
        value           uniform 0;
    }

    walls2
    {
        type            constantAlphaContactAngle;
        theta0          165;
        limit           gradient;
        value           uniform 0;
    }

    outlet
    {
        type            zeroGradient;
    }
}

// ************************************************************************* //
But now that I see it I think that the contact angle condition at walls2 is useless since there is only water inside this channel. I'll change it for the next simulation.

Quote:
Originally Posted by crubio.abujas View Post


Neither the residuals nor the courant number seems to have unreasonable values. By the way, you may find interesting to use PyFoam for plotting relevant information while solving.

Concerning the simulation times, you may consider using a parallel running. Add a decomposeParDict file to your system file. This file may have different configuration parameters but I recommend you to start using the scotch method, that takes care of splitting your domain for each processor. That should reduce the time of simulation.

system/decomposeParDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


// Change 4 to your machine number of cores.
numberOfSubdomains 4;

method          scotch;

// ************************************************************************* //
For execute it in parallel just use:
Code:
# Split your domain in different regions, one for each process.
decomposePar

# Run in parallel. The -np value must be the same defined in the decomposeParDict
mpirun -np 4 interFoam -parallel

# Recompose the case to process the results
reconstructPar
I'm more used to MATLAB than to Python, but I'll give it a look.
The parallel running is great! The simulation time is really shortened. Thank you very much again

Quote:
Originally Posted by crubio.abujas View Post
Do not despair, beginnings are always hard!
I'm trying as hard as a I can to stay calm hahaha
It is really hard.

If you could help me with the new mesh problem I would be appreciated.

Saludos,

Carlos.
cmoreno98 is offline   Reply With Quote

Old   March 16, 2020, 10:38
Default
  #8
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Refinie the mesh may increase significantly the computation time. I can help you further without more details. If you say that the computation takes almost 10h to fail... It would be nice to share the computation log instead of let me waste those 10h .

If you don't know how to log the output, you can try piping the output.
Code:
# Show the results on screen AND store them into "interFoam.log"
interFoam | tee interFoam.log
You may use this with mpirun for parallel or any other command you wish.

Concerning PyFoam, altough it has been certainly written in python is not required to know python to use. When you install it (using pip its quite easy to do so) you get access to a bunch of executable fies with the name pyFoam...
For example:
Code:
# Launch interFoam and show the results. Automatically generates a log file.
pyFoamPlotRunner interFoam

# Read a log file and plot the relevant information.
pyFoamPlotWatcher interFoam.log
In any case, I've started with Matlab and switched to python some years ago. From my perspective is totally worth it!
cmoreno98 likes this.
crubio.abujas is offline   Reply With Quote

Old   March 19, 2020, 09:15
Default
  #9
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Refinie the mesh may increase significantly the computation time. I can help you further without more details. If you say that the computation takes almost 10h to fail... It would be nice to share the computation log instead of let me waste those 10h .

If you don't know how to log the output, you can try piping the output.
Code:
# Show the results on screen AND store them into "interFoam.log"
interFoam | tee interFoam.log
You may use this with mpirun for parallel or any other command you wish.

Concerning PyFoam, altough it has been certainly written in python is not required to know python to use. When you install it (using pip its quite easy to do so) you get access to a bunch of executable fies with the name pyFoam...
For example:
Code:
# Launch interFoam and show the results. Automatically generates a log file.
pyFoamPlotRunner interFoam

# Read a log file and plot the relevant information.
pyFoamPlotWatcher interFoam.log
In any case, I've started with Matlab and switched to python some years ago. From my perspective is totally worth it!
Hi Carlos,

I tried a new mesh of 428k cells. You can download the case folder here (I also included the .log file of the simulation).

I used 2 different time steps: 2e-6 and 5e-6. I also installed PyFoam as you recommended.

Results for 5e-6:
- Execution time: 9h 25min
- Residuals:


- Courant:




Results for 2e-6:
- Execution time: 22h 22min
- Residuals:


- Courant:




Comparison using ParaView:

- Time = 0.0064:


- Time = 0.0072:


- Time = 0.008:




Is it better to use a smaller time step? The max Courant number is smaller, but the results at ParaView are very simillar... I don't know if it's worth to "lose" 13h decreasing the time step to 2 microseconds when I get no substantial improvement.

Another doubt that I have is that it seems that (is barely noticeable) the bubbles are being "sucked" at the outlet. There is a small bubble deformation, but I don't know why. The boundary conditions at the outlet are zeroGradient for alpha.air and U files and fixedValue (value 0) for p_rgh file.

Thank you very much,

Carlos.
and2300 likes this.
cmoreno98 is offline   Reply With Quote

Old   March 19, 2020, 10:28
Default
  #10
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Hi, nice that you managed to solve it!



Concerning the mesh resolution, you have already performed some kind of mesh sensibility analisis. It is nice that the results are pretty simillar, it is a sign that you are going in the right track. What since is enough? That is something you have to determine. What is the purpuse of the simulation? Which error is acceptable?


I do not know how to help you further with the outlet issue. I am vaguely aware of wave reflection issie with some BC, but I never used them neither know if there is something implemented in OF.



Good luck with the model and your way with OF
cmoreno98 likes this.
crubio.abujas is offline   Reply With Quote

Old   March 20, 2020, 13:05
Default
  #11
New Member
 
Carlos
Join Date: Feb 2020
Location: Barcelona
Posts: 19
Rep Power: 4
cmoreno98 is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hi, nice that you managed to solve it!



Concerning the mesh resolution, you have already performed some kind of mesh sensibility analisis. It is nice that the results are pretty simillar, it is a sign that you are going in the right track. What since is enough? That is something you have to determine. What is the purpuse of the simulation? Which error is acceptable?


I do not know how to help you further with the outlet issue. I am vaguely aware of wave reflection issie with some BC, but I never used them neither know if there is something implemented in OF.



Good luck with the model and your way with OF
The purpose of the simulation is to study the velocity, frequency and volume of the bubbles as a function of the inlet velocities (of air and water) and also the contact angle boundary condition.

Right now I would like to generate a plot like this:



It shows the fraction of air at two given surfaces (located at x=7 and x=8 mm in this case) with respect to time.
Do you know any way of generating two surfaces and extract the fraction of air at each time step? I think that I have to create some functions inside controlDict file but I don't know how to do it.

Is there a way to get this information using PyFoam? The volume of the bubbles for example. It would be extremely useful.

Thanks,

Carlos
cmoreno98 is offline   Reply With Quote

Old   October 7, 2020, 09:52
Default
  #12
New Member
 
najmeh
Join Date: Oct 2020
Posts: 1
Rep Power: 0
najmehjafari is on a distinguished road
Hi Carlos
I hope you are fine. I'm trying to run a simulation of a T-junction (cold water entering through one inlet and hot water through the other)
The mesh is done in Ansys and exported in .msh format. Then, the fluent3DMeshToFoam command is used to convert it from ASCII format to foam format.
but I don't understand why it doesn't work. It gets an error from me and I can not see it in Paraview. Can I take your Ansys file in this example?
najmehjafari is offline   Reply With Quote

Old   October 8, 2020, 05:04
Default
  #13
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 125
Rep Power: 7
crubio.abujas is on a distinguished road
Quote:
Originally Posted by najmehjafari View Post
Hi Carlos
I hope you are fine. I'm trying to run a simulation of a T-junction (cold water entering through one inlet and hot water through the other)
The mesh is done in Ansys and exported in .msh format. Then, the fluent3DMeshToFoam command is used to convert it from ASCII format to foam format.
but I don't understand why it doesn't work. It gets an error from me and I can not see it in Paraview. Can I take your Ansys file in this example?
Hello najmehjafari,

What kind of problems are you experiencing?

For exporting mesh from ANSYS to OpenFoam I think its needed to ensure that they are in ASCII format. By default they are in binary, so you just need to explore the exporting options of ANSYS Meshing to do so. Try that approach or share more information of the error you have so we can assest you better.
crubio.abujas is offline   Reply With Quote

Old   October 10, 2020, 20:19
Default
  #14
New Member
 
Andersson Romero
Join Date: Oct 2020
Posts: 3
Rep Power: 4
and2300 is on a distinguished road
Hi Everyone

Last edited by and2300; October 22, 2020 at 22:59. Reason: Solved the problem.
and2300 is offline   Reply With Quote

Old   May 20, 2022, 16:45
Default Can you help me
  #15
New Member
 
mumu
Join Date: May 2022
Posts: 3
Rep Power: 2
mumuaye is on a distinguished road
Hello

I'm a new OpenFOAMer and I'm trying to run a similar question. The blockMesh has always been unsuccessful, can you give me the blockMesh file?

Thank you.
mumuaye is offline   Reply With Quote

Old   May 21, 2022, 14:31
Default
  #16
New Member
 
Berin Šeta
Join Date: Dec 2014
Location: Tarragona
Posts: 7
Rep Power: 10
Berin Šeta is on a distinguished road
Quote:
Originally Posted by mumuaye View Post
Hello

I'm a new OpenFOAMer and I'm trying to run a similar question. The blockMesh has always been unsuccessful, can you give me the blockMesh file?

Thank you.
I think that mesh above was generated by Ansys Fluent. You could share your blockMeshDict and error you get, so someone could help you with that.

BR
Berin Šeta is offline   Reply With Quote

Reply

Tags
bubbles, interfoam, t-junction

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Transient Simulation in CFX ashtonJ CFX 1 September 28, 2018 02:18
restarting paused transient simulation using reactingFoam JMDag2004 OpenFOAM Running, Solving & CFD 1 August 10, 2015 11:15
Strange error in multithread simulation with interFoam davidmd OpenFOAM Running, Solving & CFD 3 December 13, 2014 21:45
setting up a simulation with multiple interactions phandy OpenFOAM Running, Solving & CFD 1 October 6, 2014 04:16
Discrete event simulation vs. fixed time (discrete time simulation) jenjon FLUENT 0 March 10, 2013 07:58


All times are GMT -4. The time now is 17:20.