View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001017 | OpenFOAM | Bug | public | 2013-09-17 06:22 | 2013-09-19 15:56 |
Reporter | Assigned To | henry | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | IBM iDataPlex | OS | RedHat Linux | OS Version | 6 |
Summary | 0001017: det(tensor) returns incorrect units. | ||||
Description | As part of my simulations I need to compute the determinant of the velocity gradient tensor. I then use this scalar value for other operations, so the units must be correct. The velocity gradient tensor (gradU) produces the correct units of (1/time). However, taking the determinant of that tensor yields a scalar that also has the units of (1/time), but the correct units are (1/time^3). I have identified the problem. in $FOAM_SRC/OpenFOAM/dimensionedTypes/dimensionedTensor/dimensionedTensor.C, line 88 reads that the dimensions of the resulting scalar after computing the determinant are pow(dt.dimensions(), tensor::dim) My understanding is that dt.dimensions() returns the dimension vector, in the case of grad(U), dt.dimensions() = [0 0 -1 0 0 0 0]. tensor::dim is the order of the tensor, which for a rank 2 tensor is 3. So [0 0 -1 0 0 0 0]^(3) = [0 0 -1 0 0 0 0]. So the definition for the dimension of the resulting scalar is incorrect with an order 1 dimension in the tensor. The same problem exist for the symmetric and spherical tensors. | ||||
Steps To Reproduce | I have included the code used to generate the respective fields. volTensorField gradU ( IOobject ( "gradU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), fvc::grad(U) ); gradU.write(); volScalarField detGradU ( IOobject ( "detGradU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), det(gradU) ); detGradU.write(); | ||||
Tags | No tags attached. | ||||
|
I believe it would be correct to multiply, rather that perform a power operation. This would produce the correct dimensions. dt.dimensions() * tensor::dim As dt.dimensions() is a vector representing the exponents of the units, multiplying the exponents is true in general. Remember (x^2)^3 = x^6 (i.e., 2*3=6) |
|
Resolved by commit 01285215de4e5dc0225cee0437764858c80ccbd2 |