CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   tensorial viscosity (https://www.cfd-online.com/Forums/openfoam/92760-tensorial-viscosity.html)

mateusps September 24, 2011 07:56

tensorial viscosity
 
Hi, FOAMers.

I'm new in OpenFOAM, and I'm trying to implement a tensorial viscosity, but haven't got success.

I've already used tensorial diffusivities for the energy equation and other scalar equations, with no problems, but for the motion equation (or for a laplacian of a vector, or div(tensorD & grad(U))) it doesn't work. It compiles well, with no errors, but when I run the solver, it breaks.

Any suggest of how to implement a fvm::laplacian(tensorD, U) ???

Mateus

mateusps September 26, 2011 06:48

Doesn't anyone have a clue on how to implement a fvm::laplacian(<tensor>,<vector>)?

I've been trying, but with no success.

It compiles with no errors, which means fvm::laplacian may receive a tensorial "diffusivity" for a vector, but it doesn't work when I execute the solver.

Any ideas?

Bernhard September 26, 2011 08:00

You're right that fvm::laplacian accepts tensorial diffusivities (see also the Programmer Guide).

You say "it doesn't work", but nobody knows what you mean with that. What is the errormessage? What is the case you're trying to solve? Are you sure it is this tensorial viscosity that is causing the problems? Or can it be anything else? Please be more specific.

mateusps September 26, 2011 08:21

The error message is (just after the Courant Number of the first time step):
%%%%%%%%%%%%%%%%

Courant Number mean: 0.000538274 max: 0.124495

#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"

#1 Foam::sigSegv::sigSegvHandler(int) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"

#2 Uninterpreted:

#3

in "/home/mateus/OpenFOAM/mateus-1.7.1/applications/bin/linuxGccDPOpt/envido"

#4

in "/home/mateus/OpenFOAM/mateus-1.7.1/applications/bin/linuxGccDPOpt/envido"

#5

in "/home/mateus/OpenFOAM/mateus-1.7.1/applications/bin/linuxGccDPOpt/envido"

#6 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"

#7

in "/home/mateus/OpenFOAM/mateus-1.7.1/applications/bin/linuxGccDPOpt/envido"

Falha de segmentação




%%%%%%%%%%%%%%%%%%%%




The case is just for testing. It's the flow of a HershellBulkley fluid in an annulus. It runs OK with nonNewtonianIcoFoam solver, which is the one I'm trying to modify, including an anisotropic viscosity. The error messages above are for a identity tensor multiplying the viscosity, just for test, so I think it should work and return the same results obtained with the nonNewtonianIcoFoam. I tryed to do a similar modification in another solver I made, which is the nonNewtonianIcoFoam in which I included the energy equation, and I used a tensorial thermal diffusivity, and it works fine. But when I try to do this in the momentum equation, I get those errors (not in compiling, but when I run the case).


And I'm pretty sure it is the tensorial viscosity that's causing the trouble, because when I comment that line, I get no problems. And note that I'm testing with the identity tensor, so that it's not a problem of numeric values or something alike.


I'm thinking that the function laplacian(<tensor>,<vector>) is defined and overcharged, since it passes the compilation, but might not be implemented, since I get those error messages when I try to run.


Some idea? Am I saying something too stupid?


Thanks for the reply,

Mateus

mateusps September 26, 2011 08:29

Sorry for the :p

It should be
... Foam::error:: printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so".... (without the space)

santiagomarquezd September 26, 2011 10:56

What tensorial diffusivity did you put in the constant/transportProperties dictionary?

Regards

mateusps September 27, 2011 07:37

If someone is interested, I think I solved the problem. Apparently the fvm::laplacian(<tensor>,<vector>) wasn't really implemented (at least at versions 1.7.1 and 2.0.0, in which I tryed testing).

I just modified the file laplacianScheme.H in the directory /opt/openfoam171/src/finiteVolume/finiteVolume/laplacianSchemes/LaplacianScheme/, adding the line:

makeFvLaplacianTypeScheme(SS, vector, symmTensor) \



and recompiled the finiteVolume libso, and apparently it worked properly.

I didn't do enough tests yet, and my solver is resulting some wrong results, but I believe those are my mistakes, and I'm reviewing some parts of the solver.

thanks for the help,
Mateus

Bernhard September 27, 2011 08:07

That is odd, maybe you want to file a bugreport here: http://www.openfoam.com/bugs/
Than it will be probably be fixed in the next release.

chegdan December 19, 2011 18:32

just in case anyone is looking for this (like I was), this was filed as a bug in issue 0000305 and has been fixed on http://www.openfoam.com/bugs/ in 2.0.x

But....


I am getting some segmentation fault with something like

Code:


    volSymmTensorField Dt = (k/epsilon)*R;

...


            solve
            (
                fvm::ddt(C)
              + fvm::div(phi, C)
              - fvm::laplacian(D, C)
              - fvm::laplacian(Dt, C)
            );

the solver runs for a bit and then seg faults. I looked in laplacianSchemes.H and the line

Code:

makeFvLaplacianTypeScheme(SS, scalar, symmTensor)
is already there. Any thoughts?

Edit: It segfaults due to crazy behavior due to negative Dt values from negative R values. Nothing to see here.


All times are GMT -4. The time now is 04:27.