CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

voldiagTensorField?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Lieven

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2013, 22:26
Default voldiagTensorField?
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18
sharonyue is on a distinguished road
Hi guys,

I have a volTensorField mu. I wanna use diag() function to get a voldiagTensorField diagmu. So mu is a tensorField, diagmu is a vectorField. The code is as follows:
Code:
    volTensorField mu
    (
        IOobject
        (
            "mu",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT
        ),
        U * L //U, L is vectors.
    );
    mu.oldTime();
    
    voldiagTensorField diagmu
    (
        IOobject
        (
            "diagmu",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT
        ),
        diag(mu)
    );
    diagmu.oldTime();
But it says:
Code:
voldiagTensorField was not declared in this scope
Whats going on? Any ideas? Thanks.
sharonyue is offline   Reply With Quote

Old   October 11, 2013, 10:58
Default
  #2
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22
Lieven will become famous soon enough
The class voldiagTensorField does not exist in openfoam. So you are trying to create an object of a class that doesn't exist. Therefore the error...
Lieven is offline   Reply With Quote

Old   October 11, 2013, 21:28
Default
  #3
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18
sharonyue is on a distinguished road
Quote:
Originally Posted by Lieven View Post
The class voldiagTensorField does not exist in openfoam. So you are trying to create an object of a class that doesn't exist. Therefore the error...
Thanks, I will try another way.
sharonyue is offline   Reply With Quote

Old   October 12, 2013, 04:03
Default
  #4
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22
Lieven will become famous soon enough
In fact, the class you are looking for does exist i.e. volVectorField. So is this maybe close to what to achieve:

Code:
volTensorField mu
(
    IOobject
    (
        "mu",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT
    ),
    U * L //U, L is vectors.
);

volVectorField muDiag
(
    IOobject
    (
        "muDiag",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT
    ),
    mesh,
    dimensionedVector("zero",mu.dimensions(),vector::zero)
);

forAll(muDiag,cellI)
{
    muDiag[cellI] = mu[cellI].diag();
}
This is just from the head so I don't promise it compiles immediately.

Cheers,

Lieven
sharonyue likes this.
Lieven is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



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