CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   settlingFoam fails with timeVarying conditions on U (https://www.cfd-online.com/Forums/openfoam-bugs/75268-settlingfoam-fails-timevarying-conditions-u.html)

alberto April 20, 2010 21:32

settlingFoam fails with timeVarying conditions on U
 
Hello,

Bug

settlingFoam fails when a timeVarying boundary condition is used for the U field, since Vdj inherits the boundaryField from U, leading the code to a segmentation fault when

Vdj.correctBoundaryConditions();

is executed.

Proposed solution

I'm not sure why Vdj inherits the BC's from V, since it is computed explicitly. However a workaround could be to replace the declaration of Vdj in createFields.H with (I left the commented line).

Code:

volVectorField Vdj
    (
        IOobject
        (
            "Vdj",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedVector("0.0", U.dimensions(), vector::zero)
        //,U.boundaryField().types()
    );

Best,

lfbarcelo April 21, 2010 14:16

The bug also exists for alpha BC, since Alpha inherits the boundaryField from alpha.
I tried a similar fix for this BC.

Code:

volScalarField Alpha
    (
        IOobject
        (
            "Alpha",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        alpha*rhod/rho
        //,alpha.boundaryField().types()
    );

Where I commented the comma and the last line.

But I get the next error message when trying to run the case:

Quote:

Starting time loop

Time = 0.1

Courant Number mean: 0.00597056 max: 0.0488136
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 3.67271e-10, No Iterations 3
DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 9.12603e-10, No Iterations 3


--> FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField
on patch lowerWall of field Alpha in file "/home/pablo/OpenFOAM/pablo-1.6.x/run/V_1/0/Alpha"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const
in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 187.

FOAM exiting
I've tried creating the Alpha BC in the 0 folder of the case, and reading that boundaryField instead of inheriting it from alpha:

Code:

volScalarField Alpha
    (
        IOobject
        (
            "Alpha",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
      mesh
        // alpha*rhod/rho
        //,alpha.boundaryField().types()
    );

I changed NO_READ for MUST_READ, and commented the line where it calculates Alpha for the first step. I also added the word mesh.

It seems to work fine, but I had to manually calculate and create the Alpha bondaryField File in the 0 folder, and apply the timeVaryingUniformFixedValue to this BC instead of applying it to alpha.

P.S.: Note the difference between alpha and Alpha. Alpha= alpha*rhod/rho


All times are GMT -4. The time now is 21:06.