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

Can OpenFOAM handle Third-Rank Tensor

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2010, 05:12
Default Can OpenFOAM handle Third-Rank Tensor
  #1
Member
 
Jinbiao Xiong
Join Date: Oct 2009
Location: China/Japan
Posts: 50
Rep Power: 17
JinBiao is on a distinguished road
Send a message via MSN to JinBiao
Hi Foamers,

In the documentation for OpenFOAM the rank-3 tensor is mention. But I can't find a corresponding class in the OpenFOAM code. And there seems rare information on this forum. Anyone have an idea where to find it? Or there is no class like that in the OF.

Thanks in advance.

Jinbiao
JinBiao is offline   Reply With Quote

Old   May 7, 2010, 22:00
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
What do you have to do? Solve a transport equation for a 3x3 matrix as unknown? Manipulate tensors?

OpenFOAM can do that with fvTensorMatrix and volTensorField / surfaceTensorField.

If you provide some more detail, we can answer better ;-)

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   May 9, 2010, 02:06
Default
  #3
Member
 
Jinbiao Xiong
Join Date: Oct 2009
Location: China/Japan
Posts: 50
Rep Power: 17
JinBiao is on a distinguished road
Send a message via MSN to JinBiao
Alberto, thanks for your reply.

I am implementing a second moment closure for reynolds stress. Here I have to solve equations for a symmetric third rank tensor, u_i*u_j*u_k. The highest rank of tensor involved is rank 4.

For a better understanding, I provide the major equations below

rms = root mean square

Code:
D(u_i*u_j*u_k)/Dt = P_i,j,k + phi_i,j,k + d_i,j,k + eps_i,j,k

d_i,j,k = d( rms(u_i*u_j) * rms(u_k*u_l) + rms(u_k*u_j) * rms(u_i*u_l) + rms(u_i*u_k) * rms(u_j*u_l) ) / dt
Best

Jinbiao
JinBiao is offline   Reply With Quote

Old   May 9, 2010, 02:20
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
A transport equation for a symmetric tensor can be solved using fvSymmTensorMatrix, while for asymmetric tensors you have to use fvTensorMatrix.

If you have higher rank matrices, you have to deal with them independently (you can either use scalar equations for each component (easier and faster to do), or extend fvMatrix (more complicated)).

P.S. You can take a look at the implementation of Reynolds stress models too.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.

Last edited by alberto; May 9, 2010 at 13:27.
alberto is offline   Reply With Quote

Old   May 9, 2010, 03:28
Default
  #5
Member
 
Jinbiao Xiong
Join Date: Oct 2009
Location: China/Japan
Posts: 50
Rep Power: 17
JinBiao is on a distinguished road
Send a message via MSN to JinBiao
Alberto, thank you so much for the encouraging message.

Actually I am solving a matrix for symmetric rank 3 tensor. I am trapped at the beginning because I can not find a class for rank 3 tensor. Do you know where to find it or I have to write this into OpenFOAM by myself?

Thanks again.

Regards.

Jinbiao
JinBiao is offline   Reply With Quote

Old   May 9, 2010, 03:36
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
For symmetric tensors (not field):

http://foam.sourceforge.net/doc/Doxy...ymmTensor.html

For symmetric tensor fields:

http://foam.sourceforge.net/doc/Doxy...nsorField.html

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   May 9, 2010, 03:41
Default
  #7
Member
 
Jinbiao Xiong
Join Date: Oct 2009
Location: China/Japan
Posts: 50
Rep Power: 17
JinBiao is on a distinguished road
Send a message via MSN to JinBiao
Sorry, I am still confused about this.

These two classes are for rank 2 tensors. The components and operators of rank 3 tensor is different from provided by them. How can I relate them together?

Thanks again.

Jinbiao
JinBiao is offline   Reply With Quote

Old   May 9, 2010, 10:03
Default
  #8
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25
deepsterblue will become famous soon enough
27 components... Hmm.. That doesn't exist as yet, but I don't see why not. You'd have to write your own rank-3 tensor class, but although the extension process is straightforward, writing all that code is not. Taking its gradient, for instance, would be quite a laborious process indeed.
I guess you would still have to solve such a system in the conventional segregated sense (one component at a time). Hopefully, there's some way in which you can manipulate your equations to reduce the rank.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   May 9, 2010, 13:27
Default
  #9
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Sorry for the confusion. I should stop answering late... ;-)

As Sandeep said, there is no implementation of rank > 2 tensors in OpenFOAM. Simply use scalar transport equations, maybe collected in a list to have a cleaner code.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   May 9, 2010, 21:47
Default
  #10
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Some additional hints that might help you to carry your 27 equations without writing too much spaghetti code

You can collect equations in a PtrList defined as

Code:
PtrList<fvScalarMatrix> myScalarEquations(nScalars);
where nScalars is the number of scalars you want to use (remember, it starts for 0 and ends at 26 if you have a complete rank 3 tensor).

To set your equations you can loop for i = 0 to i < nScalars, adding each scalar equation to the PtrList as follows:

Code:
for (int i = 0; i < nScalars; i++)
{
   myScalarEquations.set
   (
      i,
      new fvScalarMatrix
      (
        // Put the terms of your equation here, as usual
      )
   );
}
Once defined, you can relax all of them with

Code:
for (int i = 0; i < nScalars; i++)
{
   myScalarEquations[i].relax();  // you can put a label inside relax to use always the same URF
}
and then you can solve them with

Code:
for (int i = 0; i < nScalars; i++)
{
   myScalarEquations[i].solve();  // you can put a label inside solve to specify the linear solver only once in fvSolution (see pimpleFoam to see how this is done).
}
You can use PtrList in a similar way to collect fields. The idea is always the same.

I hope this helps (and it doesn't confuse you more than what I did before ).

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.

Last edited by alberto; May 9, 2010 at 21:50. Reason: Added explanation
alberto is offline   Reply With Quote

Old   May 9, 2010, 22:31
Default
  #11
Member
 
Jinbiao Xiong
Join Date: Oct 2009
Location: China/Japan
Posts: 50
Rep Power: 17
JinBiao is on a distinguished road
Send a message via MSN to JinBiao
Alberto and Sandeep, Thanks a lot.

Now I have the direction to solve my problem. I will post it here, if I have further questions.

Many thanks again. By the way, spaghetti tastes very good.
JinBiao 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
tensor rank 3 OFU OpenFOAM 0 November 18, 2009 05:10
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 06:56
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 15:25
Tensor Rank Oliver Main CFD Forum 3 August 12, 1998 15:48


All times are GMT -4. The time now is 23:41.