|
[Sponsors] |
October 10, 2013, 22:26 |
voldiagTensorField?
|
#1 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18 |
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(); Code:
voldiagTensorField was not declared in this scope |
|
October 11, 2013, 10:58 |
|
#2 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
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...
|
|
October 11, 2013, 21:28 |
|
#3 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18 |
||
October 12, 2013, 04:03 |
|
#4 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
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(); } Cheers, Lieven |
|
|
|