CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Dimensionless variables (https://www.cfd-online.com/Forums/openfoam-solving/70670-dimensionless-variables.html)

makaveli_lcf December 2, 2009 04:07

Dimensionless variables
 
Hi everybody!

I wonder if it is possible to use dimensionless variables in OpenFOAM? I tried it on my own and it didn't work. For example, using icoFoam, we can transform continuity and momentum equations to form:

div U = 0
D U/ Dt = 1/Re laplacian(U) - grad p

and icoFoam produces fatal error and exits:
Quote:

incompatible dimensions for operation
[U[0 0 -1 0 0 0 0] ] + [U[0 -1 0 0 0 0 0] ]#0 Foam::error::printStack(Foam::Ostream&) in "/home/forsher/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/forsher/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 void Foam::checkMethod<Foam::Vector<double> >(Foam::fvMatrix<Foam::Vector<double> > const&, Foam::fvMatrix<Foam::Vector<double> > const&, char const*) in "/home/forsher/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/icoFoam"
#3 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::operator+<Foam::Vector<double> >(Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > const&, Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > const&) in "/home/forsher/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/icoFoam"
#4 main in "/home/forsher/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/icoFoam"
#5 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#6 Foam::regIOobject::readIfModified() in "/home/forsher/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/icoFoam"


From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/fvMatrix.C at line 1184.

FOAM aborting

Aborted
I rescaled all my variables and size of calculation domain using characteristic length L0 and velocity U0. Then I set all dimensions to 0. I am pretty sure, that problem arise because I cannot set dimensions for mesh and cells. Am I right?

So the only solution seems to to be using same dimensions, but rescaling values. But it is not correct from formulation side... Is there any other solution?

Waiting for your response! Have a good day!

makaveli_lcf December 2, 2009 04:22

Already found some answers on forum at
http://www.cfd-online.com/Forums/ope...-mesh-etc.html

and at
http://openfoamwiki.net/index.php/Ma...al_checking.3F

Answering possible future questions why I'm using dimensionless calculations - first, it is better numerically to use dimensionless variables, and second, than its is possible to compare two different flows, two different process regimes and so on.

gschaider December 2, 2009 05:10

Quote:

Originally Posted by makaveli_lcf (Post 238439)
Hi everybody!

I wonder if it is possible to use dimensionless variables in OpenFOAM? I tried it on my own and it didn't work. For example, using icoFoam, we can transform continuity and momentum equations to form:

div U = 0
D U/ Dt = 1/Re laplacian(U) - grad p

and icoFoam produces fatal error and exits:


I rescaled all my variables and size of calculation domain using characteristic length L0 and velocity U0. Then I set all dimensions to 0. I am pretty sure, that problem arise because I cannot set dimensions for mesh and cells. Am I right?

So the only solution seems to to be using same dimensions, but rescaling values. But it is not correct from formulation side... Is there any other solution?

Waiting for your response! Have a good day!

Two other possibilities: - switch off dimension-checking (somewhere in etc/controlDict. It is described elsewhere on the forum. I don't do it and I don't advertise it. There may be a possibility that you can turn it off in your program by fiddling around with the dimensionSet::debug-variable, but you're on your own there) - the "extra" dimensions are introduced by the differential-operators. So you can multiply each differential-operator with a dimensionedScalar with the value 1 and the "opposite" dimension Bernhard

makaveli_lcf December 2, 2009 05:21

Thank you, Bernhard!

umar82088 May 27, 2013 12:25

Hi,
can you please explain the dimensions of each term in icoFoam,

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

solve(UEqn == -fvc::grad(p));

Actually, I am trying to solve NS by non-dimensionalizing, i edited code like this
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(1/Re, U)
);

solve(UEqn == -fvc::grad(p));

There comes an error in laplacianSchemes, so edited form is like this:

laplacianSchemes
{
default none;
laplacian((Re^-1),U) Gauss linear orthogonal;
laplacian((1|A(U)),p) Gauss linear orthogonal;
}

Can you please comment over my approach, along with dimensions of each term in solver file. I would really appreciate your help.
Many Thanks
Umar

Quote:

Originally Posted by gschaider (Post 238448)
Two other possibilities: - switch off dimension-checking (somewhere in etc/controlDict. It is described elsewhere on the forum. I don't do it and I don't advertise it. There may be a possibility that you can turn it off in your program by fiddling around with the dimensionSet::debug-variable, but you're on your own there) - the "extra" dimensions are introduced by the differential-operators. So you can multiply each differential-operator with a dimensionedScalar with the value 1 and the "opposite" dimension Bernhard



All times are GMT -4. The time now is 16:41.