CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Solve dS_dt + div(vect(U)*f(S))=q (https://www.cfd-online.com/Forums/openfoam/75591-solve-ds_dt-div-vect-u-f-s-q.html)

andresbh April 29, 2010 11:46

Solve dS_dt + div(vect(U)*f(S))=q
 
Hi
I am trying to solve this equation in openfoam.

dS_dt + div(vect(U)*f(S))=q

where f(S) is a known equation dependent of S. S cannot be explicitly extracted from f(S).

up to now if I implement the equation as stated above I get an error concerning calculatedFvPatchField.


Has anybody had similar problems?

Thanks

Andres

alberto April 30, 2010 01:08

A bit vague :-)

You should give some more detail on how the equation was implemented, and be specific with the error message.

Best,

andresbh April 30, 2010 03:44

Impementaiton
 
Hi Alberto,

I hope that the problem declaration this time is more illustrating.

Implementation:

The initial values of

Code:

volScalarField S
volVectorField U

are read from the case directory 0 and


Code:

dimensionedScalar const1
dimensionedScalar const2

from the constant directory.

The implementation reads

Code:

    volScalarField X = (S-const1)/(const2);
    f = pow(X,2)/(2*pow(X,2)-2*X-1);

    phi = linearInterpolate(U) & mesh.Sf();
    fvScalarMatrix SEqn
        (
            por*fvm::ddt(S) +
            fvm::div(phi,f) ==
            q
        );
        solve(SEqn);

Code:

Error:

--> FOAM FATAL ERROR:

    valueInternalCoeffs cannot be called for a calculatedFvPatchField
    on patch fixedWalls of field f in file "/home/i/andres/Simulations/FOAM/darcy2/0/f"
    You are probably trying to solve for a field with a default boundary condition.

    From function calculatedFvPatchField<Type>::valueInternalCoeffs(const tmp<scalarField>&) const
    in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 145.

I am no very sure what this means. Do I need to create my own boundary condition to fulfill this? or can I define my equation in another way ?

Thanks

Andres

niklas April 30, 2010 03:57

try to replace
fvm::div(phi,f)
with
fvc::div(phi,f)

You cant solve implicitly for both f and S, they arent really the same fields are they?


All times are GMT -4. The time now is 08:50.