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/)
-   -   Dimensioned Tensor: having diagonal terms which are not predefined constant (https://www.cfd-online.com/Forums/openfoam-programming-development/157238-dimensioned-tensor-having-diagonal-terms-not-predefined-constant.html)

pablitobass July 23, 2015 12:39

Dimensioned Tensor: having diagonal terms which are not predefined constant
 
Hello everyone,

I would like to ask if someone can tell me if it is possible to define a dimensionedSymmtensor having diagonal terms which are not predefined constant (variables, let say).

In practice I would like to know if it is possible to define an "object " like this:

Code:

    D_
    (
        dimensionedSymmTensor
        (
            "D",
            dimensionSet(0, 0, 0, 0, 0, 0, 0),
            symmTensor
            (
              D_.xx , 0, 0,
                    D_.yy, 0,
                        D_.zz                     
            )
        )
    ),

Furtherome, is it is possible to convert it in a "volTensorField"? I must to manipulate it with other objects that are defined in this manner.

Thank you very much in advance.

Regards,
Paolo

pablitobass July 25, 2015 12:11

Hello,

I have just found another way to define the volumeTensorField
Code:

{   
    return tmp<Foam::volTensorField>
    (
        new volTensorField
        (
            IOobject
            (
                "D",
                localtimeName,
                *localmesh,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            *localmesh
        )
    );
}

It compile fine but I cannot define the diagonal tensor field I need. If I have understood correctly, by using the following operation: diag(T) give the diagonal of the matrix T, which is obviously a matrix as well. Since in my case D is a volTensorField, that operation is not allowed.

Furthermore, I have another tensor field A, and my goal is to obtain D as the diagonal of the field A.

Does anyone knows if there is a way around to get the diagonal of a tensor field?

Thanks

Paolo


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