CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Laplacian containing an implicit and an explicit variable (

voingiappone July 1, 2013 02:40

Laplacian containing an implicit and an explicit variable
Hello everybody.

I realize that my programming skills are almost zero but I had to venture in the C++ secrets of the FOAM and I am getting new challenges on a daily basis. So let's say I am getting used. Sometimes I simply cannot overcome the problems.
Here is the last (apparently) insurmountable one.

I have this couple of equations used for a jump condition on the L/G inteface:


media = DC * ( (1 - Acca) / (Acca * alpha1 + (1 - alpha1)));
        fvScalarMatrix CEqn
            + fvm::div(phi, C)
            + fvm::laplacian(DC, C)
            - Kappa * (1,1,0)      //Linear generation term along x,y
            - media * fvm::laplacian(C, alpha1)


The constant term "media" is just there to have it stored as a different field each time step instead being just calculated in the CEqn.
The HUGE problem I have here is that, even if the solver compiles good, the resulting file won't run the code, exiting with a peculiar error:


incompatible fields for operation
    [C] - [alpha1]#0  Foam::error::printStack(Foam::Ostream&) in "/home/piota/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/"

which, looking through the forum, seems to be related to the fact that "alpha1" can be explicitly calculated while "C" must be solved for. Both parameters coming out inside the same Laplacian (last row) seem to end up mismatching... whatever this word means. BTW, both C and alpha1 are volScalarFields well defined in createFields.H which can be normally used by a different equation configuration.

Now, I tried to "dismantle" the laplacian operator forcing the solver to use the divergence of the gradient being naive enough to see that the fvc::grad does exist and could be directly used (alpha1 is explicit). The solver won't compile (complaining that fvc::grad does not exist!!!).
Looking inside the laplacian definition file (in the finitevolume lib) it shows that I can actually solve for an (SS, Scalar, Scalar), hence no error in the compilation process.

I am stuck. Can somebody help me to either decompose the laplacian or instructing the solver to solve the "mixed" implicit/explicit one?

Thank you!

All times are GMT -4. The time now is 01:07.