CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Two drops coalescing on substrate not conserving volume (https://www.cfd-online.com/Forums/openfoam-solving/241015-two-drops-coalescing-substrate-not-conserving-volume.html)

joshmccraney February 4, 2022 14:19

Two drops coalescing on substrate not conserving volume
 
Hi All

Can you help with the following issue?

Version: OpenFOAM 6 on Ubuntu 18.04 interFoam
Simulation: two water drops on a substrate coalescing
Issue: the drops are falling right through the substrate (-z direction). What am I missing?

My blockMesh is here
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  5                                    |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.01; // cm --> m

xmin -4;
xmax 5;
ymin -3;
ymax 3;
zmin 0;
zmax 3.5;

xcells 180;
ycells 120;
zcells 70;

vertices
(
    ($xmin $ymin $zmin)
    ($xmax $ymin $zmin)
    ($xmax $ymax $zmin)
    ($xmin $ymax $zmin)
    ($xmin $ymin $zmax)
    ($xmax $ymin $zmax)
    ($xmax $ymax $zmax)
    ($xmin $ymax $zmax)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) ($xcells $ycells $zcells) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    base
    {
        type wall;
        faces
        (
            (1 5 4 0)
        );
    }

    openBoundaries
    {
        type patch;
        faces
        (
            (0 4 7 3)
            (3 7 6 2)
            (2 6 5 1)
            (4 5 6 7)
            (0 3 2 1)
        );
    }
);

// ************************************************************************* //

alpha.water.orig is here

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.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField  uniform 0;

boundaryField
{
    base
    {
        type          constantAlphaContactAngle;
        theta0        106;
        limit          gradient;
        value          uniform 0;
    }

    openBoundaries
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value          uniform 0;
    }
}

// ************************************************************************* //

p_rgh is here

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
{
    base
    {
        type            fixedFluxPressure;
        value          uniform 0;
    }

    openBoundaries
    {
        type            totalPressure;
        p0              uniform 0;
    }
}

// ************************************************************************* //

U is here

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
{
    base
    {
        type            noSlip;
    }
    openBoundaries
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }
}


// ************************************************************************* //

I'm happy to supply any other relevant info. Thank you so much.

joshmccraney February 4, 2022 15:45

Nevermind I'm an idiot. Was setting the wrong plane as the wall in blockMeshDict. Please ignore

ktayna January 23, 2024 10:30

Hello joshmckraney! Even though this post is from long ago, would you please help me on how to simulate two droplets using OpenFOAM? Currently I'm able to simulate one droplet with setFields and setAlphaField, but not two. Thank you beforehand!

joshmccraney January 23, 2024 11:15

Quote:

Originally Posted by ktayna (Post 863632)
Hello joshmckraney! Even though this post is from long ago, would you please help me on how to simulate two droplets using OpenFOAM? Currently I'm able to simulate one droplet with setFields and setAlphaField, but not two. Thank you beforehand!

What does you setFields file look like? Can you post it here? All you should have to do is copy the block of code you use for the first drop for the second (change drop center and radius if you want, of course)

ktayna January 23, 2024 13:41

Quote:

Originally Posted by joshmccraney (Post 863639)
What does you setFields file look like? Can you post it here? All you should have to do is copy the block of code you use for the first drop for the second (change drop center and radius if you want, of course)

Hello Josh! Here is my setFields and my setAlphaField. My setFields is working alright, I think the problem lies on my setAlphaField; it only builds the alpha field for the second droplet when there are two droplets specified in it.

setFieldsDict:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
volScalarFieldValue alpha.phase1 0
);

regions
(
// Droplet 1
cylinderToCell
{
p1 (0.5 0.5 -1);
p2 (0.5 0.5 1);
radius 0.1;
fieldValues
(
volScalarFieldValue alpha.phase1 1
);
}

// Droplet 2
cylinderToCell
{
p1 (1.5 0.5 -1);
p2 (1.5 0.5 1);
radius 0.1;
fieldValues
(
volScalarFieldValue alpha.phase1 1
);
}
);


// ************************************************** *********************** //

setAlphaFieldDict:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

field alpha.phase1;
type cylinder;
radius 0.1;
direction (0 0 1);
origin (0.5 0.5 0);

field alpha.phase1;
type cylinder;
radius 0.1;
direction (0 0 1);
origin (1.5 0.5 0);

// ************************************************** *********************** //

joshmccraney January 23, 2024 14:15

Quote:

Originally Posted by ktayna (Post 863656)
Hello Josh! Here is my setFields and my setAlphaField. My setFields is working alright, I think the problem lies on my setAlphaField; it only builds the alpha field for the second droplet when there are two droplets specified in it.

setFieldsDict:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
volScalarFieldValue alpha.phase1 0
);

regions
(
// Droplet 1
cylinderToCell
{
p1 (0.5 0.5 -1);
p2 (0.5 0.5 1);
radius 0.1;
fieldValues
(
volScalarFieldValue alpha.phase1 1
);
}

// Droplet 2
cylinderToCell
{
p1 (1.5 0.5 -1);
p2 (1.5 0.5 1);
radius 0.1;
fieldValues
(
volScalarFieldValue alpha.phase1 1
);
}
);


// ************************************************** *********************** //

setAlphaFieldDict:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

field alpha.phase1;
type cylinder;
radius 0.1;
direction (0 0 1);
origin (0.5 0.5 0);

field alpha.phase1;
type cylinder;
radius 0.1;
direction (0 0 1);
origin (1.5 0.5 0);

// ************************************************** *********************** //

Right, sorry it’s been a few years since I’ve used OF (have since graduated). So you’ll want to run setFields command twice. Once for first drop and once for second drop. For the second drop just comment out all of the commands you use for the first drop. Make sense?

ktayna January 23, 2024 15:56

Quote:

Originally Posted by joshmccraney (Post 863657)
Right, sorry it’s been a few years since I’ve used OF (have since graduated). So you’ll want to run setFields command twice. Once for first drop and once for second drop. For the second drop just comment out all of the commands you use for the first drop. Make sense?

You mean, the setAlphaField command? The setFields command works alright.

I'll try that and come back to report. Thank you!

ktayna March 12, 2024 15:36

Hello! I have solved my issue, so I want to put it here in case someone else ever find this problem. Running the command twice didn't work: when I ran the second time, the first droplet would be erased, as if it was the first time the command was ran. Ultimately, I stopped using "setAlphaField" and it works just fine using only the "setFields" command. I am not sure why it didn't work before, and I'm not sure why it is working now, but it is! Thank you :)

joshmccraney March 12, 2024 17:17

Quote:

Originally Posted by ktayna (Post 866116)
Hello! I have solved my issue, so I want to put it here in case someone else ever find this problem. Running the command twice didn't work: when I ran the second time, the first droplet would be erased, as if it was the first time the command was ran. Ultimately, I stopped using "setAlphaField" and it works just fine using only the "setFields" command. I am not sure why it didn't work before, and I'm not sure why it is working now, but it is! Thank you :)

Sorry, didn’t see your second reply. And think I was thinking of funkSetFields, which I think would run twice when you want to add a phase. But makes sense, should only need to run setFields once. Nice job


All times are GMT -4. The time now is 19:28.