CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   viscoelastic flow with free surface (https://www.cfd-online.com/Forums/openfoam-programming-development/86662-viscoelastic-flow-free-surface.html)

adambarfi April 24, 2015 04:09

Quote:

Originally Posted by arash.heidarian (Post 543516)
thanks Mr mahmoudi it was really helpfull....

Dear Arash,

Did the solver work for you successfully?
I have some problem with compiling the both solver and the two phase mixture model.

Regards,
Mostafa

Supersale May 11, 2015 01:18

Thanks vigges, i am trying to make the solver work for this case file http://sourceforge.net/projects/viscoelasticof/
mr Favero (I think) and Jasak had a paper with this model. I'll keep you guys updated on results and what to do.
Thanks adambarfi for the input, i had no idea what dimensions to use. Do you have any definition of the "parameters for solvent shear-thinning viscosity"? (mu0 muInf...) I am grinding literature about this now but it's rather hard to look for dimensions lile 'a' and 'b' :D

wendy987 May 11, 2015 07:41

hi SuperScale
can you share your files of system with me, for example , fvSchemes, fvSolution?

Supersale May 11, 2015 22:09

Quote:

Originally Posted by wendy987 (Post 545849)
hi SuperScale
can you share your files of system with me, for example , fvSchemes, fvSolution?

I can, but keep in mind i'm still working on it. It is far from the ideal setup but I do get some kind of results with it...

Anyway, here it is...

fvSchemes:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.1                                  |
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version        2.0;
    format          ascii;

    root            "";
    case            "";
    instance        "";
    local          "";

    class          dictionary;
    object          fvSchemes;
}

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

ddtSchemes
{
    default Euler;
}

gradSchemes
{
    default        Gauss linear;
    grad(U)        Gauss linear;
    //grad(gamma)    Gauss linear; // - in the original. old naming for alpha
    grad(alpha)    Gauss linear;
}

divSchemes
{
    div(rho*phi,U)          Gauss limitedLinearV 1;
    div(phi,alpha)          Gauss vanLeer;
    div(phirb,alpha)      Gauss linear;
    div(phi,taufirst)        Gauss upwind;
    div(phi,tau)            Gauss upwind;
    div(tau)                Gauss linear;
}

laplacianSchemes
{
    default                    Gauss linear corrected;
    laplacian(etaPEff,U)      Gauss linear corrected;
    laplacian(etaPEff+etaS,U)  Gauss linear corrected;
    laplacian((1|A(U)),p)      Gauss linear corrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}

fluxRequired
{
    default        no;
    p_rgh;
    pcorr;
    alpha;
}


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


Supersale May 11, 2015 22:13

sorry, i'll post the rest later today...

Supersale May 12, 2015 04:10

adambarfi, may i ask you why you defined CrossPowerLaw and the BirdCarreau thing? i can't find it in the solver and it is not asked when i run the simulation without it

Supersale May 12, 2015 11:51

fvSolution:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.1                                  |
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version        2.0;
    format          ascii;

    root            "";
    case            "";
    instance        "";
    local          "";

    class          dictionary;
    object          fvSolution;
}

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

solvers
{
         
pcorr
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  DIC;

            tolerance      1e-13;
            relTol          0;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
            nPostSweeps    2;
            nFinestSweeps  2;
            cacheAgglomeration false;
            nCellsInCoarsestLevel 10;
            agglomerator    faceAreaPair;
            mergeLevels    1;
        }
        tolerance      1e-10;
        relTol          0;
        maxIter        1000;
    }

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

p_rghFinal
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  DIC;

            tolerance      1e-13;
            relTol          0;
            nVcycles        2;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
            nPostSweeps    2;
            nFinestSweeps  2;
            cacheAgglomeration true;
            nCellsInCoarsestLevel 10;
            agglomerator    faceAreaPair;
            mergeLevels    1;
        }
        tolerance      1e-13;
        relTol          0;
        maxIter        20;
    }

    U PBiCG
    {
        preconditioner
        {
            type        DILU;
        }

        minIter          0;
        maxIter          1000;
        tolerance        1e-08;
        relTol          0;
    };
    taufirst PBiCG
    {
        preconditioner
        {
            type          Cholesky;
        }

        minIter          0;
        maxIter          1000;
        tolerance        1e-8;
        relTol            0.0;

    };
    tau PBiCG
    {
        solver          PBiCG;
        preconditioner
        {
            preconditioner  DILU;

            tolerance      1e-13;
            relTol          0;
            nVcycles        2;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
            nPostSweeps    2;
            nFinestSweeps  2;
            cacheAgglomeration true;
            nCellsInCoarsestLevel 10;
            agglomerator    faceAreaPair;
            mergeLevels    1;
        }
        tolerance      1e-13;
        relTol          0;
        maxIter        20;
    };

    alphaphase1
    {
        nAlphaCorr      1;
        nAlphaSubCycles 1;
        cAlpha          1;
    };

}

PIMPLE
{
    momentumPredictor no;
    nCorrectors    3;
    nNonOrthogonalCorrectors 1;
    nAlphaCorr      1;
    nAlphaSubCycles 4;
    cAlpha          2;

    pdRefCell        0;
    pdRefValue      0.0;
}


relaxationFactors
{
//    p              0.97;
//    U              0.9;
//    taufirst        0.3;
}

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

setFieldsDict:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.1                                  |
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version        2.0;
    format          ascii;

    root            "";
    case            "";
    instance        "";
    local          "";

    class          dictionary;
    object          setFieldsDict;
}

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

defaultFieldValues
(
//    volScalarFieldValue gamma 0
    volScalarFieldValue alpha.phase1 0
//    volVectorFieldValue U (0 0 0)
    volSymmTensorFieldValue taufirst (0 0 0 0 0 0)
);

regions
(
    boxToCell
    {
    box (-1 0.015 -1) (1 1 1);
 
    fieldValues
    (
//        volScalarFieldValue gamma 1
        volScalarFieldValue alpha.phase1 1
    );
    }
);

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

controlDict:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.4                                  |
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version        2.0;
    format          ascii;

    root            "";
    case            "";
    instance        "";
    local          "";

    class          dictionary;
    object          controlDict;
}

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

application viscoelasticInterFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        10;

deltaT          1e-8;

writeControl    adjustableRunTime;

writeInterval  0.01;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision  6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo          0.01;
maxAlphaCo      0.2;

maxDeltaT      0.01;



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

i am running now a different setup since Favero's paper suggested some solvers and preconditioners. Gonna try those and give some feedback.

Supersale May 14, 2015 04:48

OK i think i figured out what these parameters are (mu0, muInf...)
It's to model the shear-thinning behaviour, and the equation can be found in viscoelasticTwoPhaseMixture.C at the top. The equation is:

Code:

if (viscosityType_ == "ShearThinning")
    {
        volScalarField shearRate_ = sqrt(2.0)*mag(symm(fvc::grad(U_)));
        volScalarField etaL_      = muInf_ +
                                    (
                                        (mu0_ - muInf_)
                                        /
                                        pow((scalar(1) + pow((k_*shearRate_),b_)),a_)
                                    );
       
        etaS_ = limitedAlpha1_*etaL_ + (scalar(1) - limitedAlpha1_)*etaS2_;
    }

now this is either the Cross model or the Carreau model. The Cross model looks like:

(eta - eta_inf) / (eta_0 - eta_inf) = 1 / (1 + (K * kappa) ^ m)

while the Carreau model looks like:

(eta - eta_inf) / (eta_0 - eta_inf) = 1 / (1 + (K * kappa) ^ 2) ^ m/2

now;
etaL is eta
mu0 is eta_0 [Pa.s]
muInf is eta_inf [Pa.s]
k is K (a constant with the dimensions of time) [s]
kappa is the shear-rate
m is a dimensionless constant

Regarding 'a' and 'b', depending on the model used, 'a' is either m/2 or 1 and 'b' is either 2 or m.

I also found some values for it. For polyarylamide: eta_0=1.82Pa.s, eta_inf=2.6mPa.s, K=1.5s and m=0.6.

I copied the Giesekus model into viscoelasticTwoPhaseMixture.C from the extend version, recompiled it and running it now. if it works i'll upload the case file and solver.

Anyone has more info about 'a' and 'b'?

i kept the transport model 'Newtonian'

arash.heidarian May 17, 2015 05:51

Does any one have a test case for this solver?
:confused:

adambarfi May 17, 2015 09:20

1 Attachment(s)
the case I ran it just one time is attached.
hope it helps you all viscoelastic FOAMers :D

Regsrds,
Mostafa

arash.heidarian May 18, 2015 15:37

Reading g
Calculating field g.h

time step continuity errors : sum local = 0, global = 0, cumulative = 0
DICPCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Courant Number mean: 0 max: 0

Starting time loop

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 1.19048e-05
Time = 1.19048e-05

MULES: Solving for alphawater
Phase-1 volume fraction = 0.825498 Min(alpha1) = 0 Max(alpha1) = 1
MULES: Solving for alphawater
Phase-1 volume fraction = 0.825498 Min(alpha1) = 0 Max(alpha1) = 1


--> FOAM FATAL ERROR:
updateCoeffs(const scalarField& snGradp) MUST be called before updateCoeffs() or evaluate() to set the boundary gradient.

From function fixedFluxPressureFvPatchScalarField::updateCoeffs( )
in file fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C at line 151.

FOAM exiting




I have this error when i run the solver
can any one help?

arash.heidarian May 18, 2015 15:41

Quote:

Originally Posted by adambarfi (Post 546579)
the case I ran it just one time is attached.
hope it helps you all viscoelastic FOAMers :D

Regsrds,
Mostafa

Dear Mr mahmoudi.
thank you.It was helpful.

adambarfi May 18, 2015 16:05

Dear Arash,

Can you attach your solver, I think there're some problems with the solver.

arash.heidarian May 19, 2015 06:24

2 Attachment(s)
sure...
my solver is the solver which have been posted in previous posts by Mr Bruno santos...
sorry but I can't run your test case by this solver.
Thank you very much for your reply. :)

Supersale May 21, 2015 21:12

OK, what i noticed while running this solver is that when I make use of the viscoelastic parameters (rho, etaS, etaP, lambda and aplha) i.e. i assign them a value that is bigger than 0, i have huge pressure fluctuations in the results. for example, i set p_rgh to be 1e5, and it shouldn't change much from that value, but when i check the results, in some time-steps the pressure range goes from -3e7 to 1e6 then from 2.48e5 to -1.2e5 (the same spots in the previous timesteps now have a different sign/foretoken). it fluctuates heavily. did anyone experience this in OpenFOAM before? Any solution recommended?

Supersale May 28, 2015 00:41

adambarfi, the case file you uploaded is not correct. the boundary conditions in 0/ do not agree with the geometry and mesh (which is from the dam break case)
for example in U you have walls, axiss, tray, inlet, outlet and frontAndBackPlanes which you don't have in the boundary file.
also, may i ask you which version of openfoam you are using?
thanks

adambarfi May 28, 2015 01:56

Quote:

Originally Posted by Supersale (Post 547953)
adambarfi, the case file you uploaded is not correct. the boundary conditions in 0/ do not agree with the geometry and mesh (which is from the dam break case)
for example in U you have walls, axiss, tray, inlet, outlet and frontAndBackPlanes which you don't have in the boundary file.
also, may i ask you which version of openfoam you are using?
thanks

Dear Sasa,

The mesh was compiled before and the geometry is not as the same as the dam break case. you can run whatever geometry you want. just you need to change the boundary conditions.
For example you can use the geometry and boundary conditions of dam break case.

Regards,
Mostafa

Supersale May 31, 2015 21:15

ok, i did set it up and run it. works. it's ridiculous how much faster your case works than mine (the setup of fvSolusions and fvSchemes was very different) just shows how much more i need to learn about the program. Anyway, thank you again. i'll continue to work on this :)

adambarfi June 1, 2015 00:47

Quote:

Originally Posted by Supersale (Post 548363)
ok, i did set it up and run it. works. it's ridiculous how much faster your case works than mine (the setup of fvSolusions and fvSchemes was very different) just shows how much more i need to learn about the program. Anyway, thank you again. i'll continue to work on this :)

I'm happy my case was useful and helped you.

good luck,
Mostafa

arash.heidarian June 1, 2015 09:00

question
 
Hi Mr Mahmoudi
which version of openfoam you have used for this test case?
and is your solver same as the solver which i have been attached in my last post?
:confused:


All times are GMT -4. The time now is 13:10.