CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Tensor data generated by foamToVTK (http://www.cfd-online.com/Forums/openfoam-bugs/62503-tensor-data-generated-foamtovtk.html)

cpplabs January 15, 2008 20:38

Hi, What is the number of
 
Hi,
What is the number of components of the Bmean tensor in the results of tutorial/channelOodles/channel395 ? foamToVTK marks the tensor has 6 components but saves 9 for each of them.
Thanks,

JT
Bmean 6 60000 float
followed by 540000 values (60000 * 9)

cpplabs January 30, 2008 23:01

Found the reason for the probl
 
Found the reason for the problem: the 6 components symmTensor is saved as a regular 9 components tensor. I have a fix but don't know how to attach the files, can someone let me know how to submit the fix.
Thanks.

mattijs January 31, 2008 06:00

See the Documentation->Formatt
 
See the Documentation->Formatting on the left: \attach

Alternatively tell us what you've changed.

cpplabs January 31, 2008 14:41

The writeFuns::write function
 
The writeFuns::write function uses the insert function to convert the symmTensor into a scalar list:
void Foam::writeFuns::write(*)
{
......
insert(vvf.internalField(), fField);
......
write(os, binary, fField);
}

The insert function is defined for scalar, vector and tensor only, not defined for symmTensor, so the one for tensor is used symmTensor.
Add the following two insert function in Foam::writeFuns can solve the problem:

void Foam::writeFuns::insert(const symmTensor& pt, DynamicList<floatscalar>& dest)
{
for (direction cmpt = 0; cmpt < symmTensor::nComponents; cmpt++)
{
dest.append(float(pt[cmpt]));
}
}
void Foam::writeFuns::insert(const sphericalTensor& pt, DynamicList<floatscalar>& dest)
{
for (direction cmpt = 0; cmpt < sphericalTensor::nComponents; cmpt++)
{
dest.append(float(pt[cmpt]));
}
}

mattijs January 31, 2008 15:57

Thanks. Just so people don'
 
Thanks.

Just so people don't make the same mistake I made (board converted floatScalar to all lower case) here are the corrected files for 1.4.1.

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif writeFuns.C
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif writeFuns.H


All times are GMT -4. The time now is 14:00.