|
[Sponsors] |
July 31, 2015, 11:48 |
Diagonal Form of a Symmetric Tensor
|
#1 | |
Member
Paolo Capobianchi
Join Date: Sep 2014
Posts: 35
Rep Power: 11 |
Hello everyone,
I'm trying to calculate the diagonal of a symmetric tensor, but without success. The part of code I wrote is this one: Code:
Foam::symmTensor Foam::ConfOldroyd_B::D() const { return diag(a_); } Furthermore I have extracted the tensor a_ from the symmTensorField Code:
A_ ( IOobject ( "A", U.time().timeName(), U.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), U.mesh() ) Code:
Foam::symmTensor Foam::ConfOldroyd_B::a() const { forAll(A_,celli) { A_[celli]; } return a_; } This is the error message I get when I compile Quote:
Does anyone have an idea about what might be the problem? Many thanks in advantage. Regards, Paolo |
||
July 31, 2015, 19:35 |
|
#2 |
Member
Paolo Capobianchi
Join Date: Sep 2014
Posts: 35
Rep Power: 11 |
I have just found another thread about the same topic.
It seems that the problem can be solved by using DiagTensor instead of diag(). However, I had a look into the file DiagTensor.H and it seems that it returns a tensor whose elements are only the diagonal of the original tensor. In other words, the result is a tensor whose out diagonal elements have been deleted. In my case, I need the diagonal form of the tensor as a solution of the eigenvalues problem, therefore the previous method does not work for me. Sorry for the useless question. Regards, Paolo |
|
August 5, 2015, 11:22 |
|
#3 |
Member
Paolo Capobianchi
Join Date: Sep 2014
Posts: 35
Rep Power: 11 |
I hope I found a way to get the tensor I was looking for. I also used it to calculate the logartihm of the tensor A_. The code I wrote is this one
Code:
Foam::tensor Foam::Oldroyd_B_Conform::teta() const { forAll(A_, cellI) { tensor a_ = A_[cellI]; tensor Omega_ = eigenVectors(a_); tensor OmegaT_ = eigenVectors(a_).T(); OmegaT_ & a_ & Omega_ = D_ ; scalar log_d_x = log(D_.xx()); scalar log_d_y = log(D_.yy()); scalar log_d_z = log(D_.zz()); tensor ( log_d_x, 0, 0, 0, log_d_y, 0, 0, 0, log_d_z ) = log_D_; Omega_ & log_D_ & OmegaT_ = teta_; } return teta_; } However, I have a couple of (more) doubts: 1. Is it normal that the code prints on screen just one tensor teta_? I expected it to be an array of tensors. 2. Since I have to solve a trasport equation for teta_, does anyone know how to re-create a volTensorField from the teta_ tensors? Thanks Paolo |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is symmetric tensor assumed in CFD? | andyCas | Main CFD Forum | 6 | June 26, 2014 08:02 |
why divergence occures in these cases | immortality | OpenFOAM Running, Solving & CFD | 2 | January 25, 2013 10:21 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 03:34 |
Problems compiling with the 'diag' tensor function (diagonal components matrix) | danihuso | OpenFOAM Programming & Development | 12 | January 31, 2012 10:45 |
pressure equation in tensor form | student | Main CFD Forum | 0 | August 10, 2009 13:41 |