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/)
-   -   Hyper viscosity model (https://www.cfd-online.com/Forums/openfoam-programming-development/82425-hyper-viscosity-model.html)

Pascal_doran November 25, 2010 19:30

Hyper viscosity model
 
Hi all,

I would like to implement an hyper viscosity model which mean that I need to add the following term in the momentum equation :
-nuHV*d⁴U/dx⁴ or nuHV*laplacian(laplacian(U))
where nuHV is the hyper viscosity coefficient. I try this:
Code:

        volVectorField lap = fvc::laplacian(nuHV/nuHV, U);
 
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
          + fvm::laplacian(nuHV, lap)
        );
 
        solve(UEqn == -fvc::grad(p));

it compiled but I got this error message after starting the simulation:
Code:

[1] --> FOAM FATAL ERROR:
[1] incompatible fields for operation
    [U] + [((nuHV|nuHV)*laplacian(U))]

Note that I never wish to add U with ((nuHV|nuHV)*laplacian(U)) ...

Then I tried this:
Code:

        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U - fvm::laplacian(nuHV/nu, lap))
        );
 
        solve(UEqn == -fvc::grad(p));

And it didn't compile. What I should try?
Thank you,

Pascal

Chris Lucas November 26, 2010 03:20

Hi,

about the second source code you tried:
You want to solve the equation for U (what you do in the first two terms), but in the "new" term, you say that you want to solve the equation for "U-fvm::laplacian(...)".

About the first source code you tried:
the same error as above, you want to solve the equation for U, not lap.

Try to exchange the fvm and fvc for the lap equation and the laplacian term of the first source code

Regards,
Christian

Pascal_doran December 1, 2010 19:51

Thank you Christian,

It works when I tried this:
Code:

        volVectorField lap = fvc::laplacian(nuHV/nuHV, U);
 
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
          + fvc::laplacian(nuHV, lap)
        );
 
        solve(UEqn == -fvc::grad(p));

but what I should do if I want calculate it implicitly? Because this didn't work...:
Code:

        volVectorField lap = fvm::laplacian(nuHV/nuHV, U);
 
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
          + fvm::laplacian(nuHV, lap)
        );
 
        solve(UEqn == -fvc::grad(p));

Should I implement it myself or there's an easier way to do it?

Regards,
Pascal


All times are GMT -4. The time now is 22:11.