CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Problems to implement a coordinate change (https://www.cfd-online.com/Forums/openfoam/92686-problems-implement-coordinate-change.html)

mateusps September 21, 2011 21:04

Problems to implement a coordinate change
 
Hello.

I'm trying to implement a "coordinate contraction", and I got many problems (I'm newbie in OpenFOAM).

My mesh is a very long tube, so what I wanna do is implement a coordinate change to "compress" the axial coordinate, so that the aspect ratio gets better. I'm trying to do this in nonNewtonianIcoFoam.

Mathematically, what I must do is pre-multiply (innerly) the operators div, grad, and so on, in the equations, by an anisotropic tensor that shrinks the axial dimension. But I don't know how to do this in OpenFOAM.

I tryed to simply define the tensors and multiply them, but the operators (+, - and ==) didn't accept to operate a fvm::div(phi,U) class with a tensor class, and so on.

How can I do this (insert a tensor pre-multiplying all the "\nabla"s)? Help, please.

tomislav_maric September 22, 2011 03:08

Quote:

Originally Posted by mateusps (Post 325149)
Hello.

I'm trying to implement a "coordinate contraction", and I got many problems (I'm newbie in OpenFOAM).

My mesh is a very long tube, so what I wanna do is implement a coordinate change to "compress" the axial coordinate, so that the aspect ratio gets better. I'm trying to do this in nonNewtonianIcoFoam.

Mathematically, what I must do is pre-multiply (innerly) the operators div, grad, and so on, in the equations, by an anisotropic tensor that shrinks the axial dimension. But I don't know how to do this in OpenFOAM.

I tryed to simply define the tensors and multiply them, but the operators (+, - and ==) didn't accept to operate a fvm::div(phi,U) class with a tensor class, and so on.

How can I do this (insert a tensor pre-multiplying all the "\nabla"s)? Help, please.

Operators work on top of fields and a finite volume mesh: the resulting coefficient matrices are built based on the geometric (FVM related) mesh information, from one side.

The dimensions and shape (sparsity) of the Foam::fvm::fvMatrix will depend on the mesh + discretisation scheme used + linear combination and type of operators in the equation, and it will not be a tensor definitely, so multiplication with a tensor (a direct one) is out of the question... just my 2 cents...

Why not just make a better mesh? :)

Tomislav

mateusps September 22, 2011 05:16

My point is to make a coordinate transformation, not just make a better mesh. It's not just to run better, but to make it easy to visualise as well.

But I don't know if I understood. I know the Foam::fvm::fvMatrix isn't a tensor.

What I wanna do (mathmatically) is multiply the div(UU), grad(p), laplacian(nu,U), etc, by a tensor that performs the coordinate change. But I don't know how to implement this in OpenFOAM. I noticed that I can't just multiply the objects fvm::div(phi,U), fvc::grad(p), etc. But so how can I program to solve the equation:

dU/dt + A & div(UU) - A & A & laplacian(nu,U) = - A & grad(p)

where A is a tensor?

Thanks for the reply!

tomislav_maric September 22, 2011 13:20

Hi,

again: fvm::fvMatrix has not just geometrical information of the mesh but all other information related to the solution variable coefficients of the discretized (non)linear algebraic system.

Ask yourself this:

How am I to discretize the

\int_V_P A & div(UU) dv

using a Gauss divergence theorem when A is a tensor? Is this possible at all?

I personally believe that this is not possible at all within the finite volume framework, as explained for example in many theses related to FVM on arbitrary unstructured meshes, all of which you can find here:

http://powerlab.fsb.hr/ped/kturbo/OpenFOAM/docs/

If you prove this to be wrong, please post the result, I'm always happy to learn new stuff. :D

Tomislav

Quote:

Originally Posted by mateusps (Post 325188)
My point is to make a coordinate transformation, not just make a better mesh. It's not just to run better, but to make it easy to visualise as well.

But I don't know if I understood. I know the Foam::fvm::fvMatrix isn't a tensor.

What I wanna do (mathmatically) is multiply the div(UU), grad(p), laplacian(nu,U), etc, by a tensor that performs the coordinate change. But I don't know how to implement this in OpenFOAM. I noticed that I can't just multiply the objects fvm::div(phi,U), fvc::grad(p), etc. But so how can I program to solve the equation:

dU/dt + A & div(UU) - A & A & laplacian(nu,U) = - A & grad(p)

where A is a tensor?

Thanks for the reply!



All times are GMT -4. The time now is 03:51.