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

Bug in the programmer's guide: divergence of a tensor field

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By sebastian
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 17, 2012, 12:01
Default Bug in the programmer's guide: divergence of a tensor field
  #1
Member
 
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 16
sebastian is on a distinguished road
Hi everybody!

I wonder if there is a bug in the programmer's guide of OpenFOAM.

In chapter 2.1.2 the divergence of a tensor field is given as

\nabla \bullet T = \partial_i T_{ij}=\left( 
\begin{matrix}
 \frac{\partial T_{11}}{\partial x_1} 	+ \frac{\partial T_{12}}{\partial x_1} 	+ \frac{\partial T_{13}}{\partial x_1}\\
 \frac{\partial T_{21}}{\partial x_2} 	+ \frac{\partial T_{22}}{\partial x_2} 	+ \frac{\partial T_{23}}{\partial x_2}\\
 \frac{\partial T_{31}}{\partial x_3} 	+ \frac{\partial T_{32}}{\partial x_3} 	+ \frac{\partial T_{33}}{\partial x_3}	
\end{matrix}
 \right)

In my opinion this is wrong. After the convention in chapter 1.3.1 (inner product) it should be instead

\nabla \bullet T =
\left( 
\begin{matrix}
 \frac{\partial }{\partial x_1}, & \frac{\partial }{\partial x_2}, & \frac{\partial}{\partial x_3}
\end{matrix}
 \right)
\bullet
\left( 
\begin{matrix}
  T_{11} &	T_{12} &	T_{13}	\\
  T_{21} &	T_{22} &	T_{33}	\\
  T_{31} &	T_{32} &	T_{33}	\\
\end{matrix}
 \right) 
=\partial_j T_{ji}=\left( 
\begin{matrix}
 \frac{\partial T_{11}}{\partial x_1} 	+ \frac{\partial T_{21}}{\partial x_2} 	+ \frac{\partial T_{31}}{\partial x_3}\\
 \frac{\partial T_{12}}{\partial x_1} 	+ \frac{\partial T_{22}}{\partial x_2} 	+ \frac{\partial T_{33}}{\partial x_3}\\
 \frac{\partial T_{13}}{\partial x_1} 	+ \frac{\partial T_{32}}{\partial x_2} 	+ \frac{\partial T_{33}}{\partial x_3}	
\end{matrix}
 \right)

Can anybody confirm that or do I make something wrong here?
How is the implementation, does anybody know?


Sebastian
JamesCC likes this.
sebastian is offline   Reply With Quote

Old   July 17, 2012, 15:54
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
It depends on if you multiply a row vector by a tensor or a tensor by a column vector. We want the tensor to act on the vector. What you've written should be:

\nabla \bullet T =
\left( 
\begin{matrix}
  T_{11} &    T_{12} &    T_{13}    \\
  T_{21} &    T_{22} &    T_{33}    \\
  T_{31} &    T_{32} &    T_{33}    \\
\end{matrix}
\right)
\left(
\begin{matrix}
  \frac{\partial }{\partial x_1} \\
  \frac{\partial }{\partial x_2} \\
  \frac{\partial }{\partial x_3} 
\end{matrix}
\right)
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 17, 2012, 16:35
Default
  #3
Member
 
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 16
sebastian is on a distinguished road
Dear Laurence, thanks for your post.

When I look up for the definition of the divergence of a tensor field, on wikipedia for instance this is
\nabla \bullet T = \frac{\partial T_{ki}}{\partial x_i} e_k
This does not agree with the programmer's guide. Why should it be different in OpenFOAM?

Sebastian
sebastian is offline   Reply With Quote

Old   July 17, 2012, 18:15
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
The programmer's guide is not maintained anymore.

Anyway, how about:

\partial_j T_{ji} = \partial_i T_{ij}
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 18, 2012, 03:38
Default
  #5
Member
 
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 16
sebastian is on a distinguished road
I am not talking about if it's a i, j or k.

\text{div}T=
\left( 
\begin{matrix}
 \frac{\partial T_{11}}{\partial x_1} 	+ \frac{\partial T_{21}}{\partial x_2} 	+ \frac{\partial T_{31}}{\partial x_3}\\
 \frac{\partial T_{12}}{\partial x_1} 	+ \frac{\partial T_{22}}{\partial x_2} 	+ \frac{\partial T_{32}}{\partial x_3}\\
 \frac{\partial T_{13}}{\partial x_1} 	+ \frac{\partial T_{23}}{\partial x_2} 	+ \frac{\partial T_{33}}{\partial x_3}	
\end{matrix}
 \right)
\neq
\left(
\begin{matrix}
 \frac{\partial T_{11}}{\partial x_1} 	+ \frac{\partial T_{12}}{\partial x_1} 	+ \frac{\partial T_{13}}{\partial x_1}\\
 \frac{\partial T_{21}}{\partial x_2} 	+ \frac{\partial T_{22}}{\partial x_2} 	+ \frac{\partial T_{23}}{\partial x_2}\\
 \frac{\partial T_{31}}{\partial x_3} 	+ \frac{\partial T_{32}}{\partial x_3} 	+ \frac{\partial T_{33}}{\partial x_3}	
\end{matrix}
 \right)

The programmer's guide is obviously wrong.

Last edited by sebastian; July 19, 2012 at 10:24.
sebastian is offline   Reply With Quote

Old   July 18, 2012, 06:53
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Ah, sorry! Yes, the programmer's guide is incorrect.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 18, 2013, 23:03
Default error in wikipedia
  #7
New Member
 
heidi
Join Date: Jan 2013
Posts: 2
Rep Power: 0
hhouston is on a distinguished road
Hey, the following eq from wikipedia posted higher up in this thread has a typo:

"When I look up for the definition of the divergence of a tensor field, on wikipedia for instance this is
"
and further it is not consistent with the other parts of this thread - it should be Tik not Tki .

Also there are some typos in the matrices you put up, but they are not too hard to figure out. And the overall thrust of the thread is correct.
hhouston is offline   Reply With Quote

Old   January 18, 2013, 23:05
Default
  #8
New Member
 
heidi
Join Date: Jan 2013
Posts: 2
Rep Power: 0
hhouston is on a distinguished road
that is,

hhouston is offline   Reply With Quote

Old   September 7, 2013, 07:09
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
FYI: I've consolidated this information here: http://openfoamwiki.net/index.php/Op...s_Guide_Errata

Feel free to add to this wiki page.

By the way, the issue reported on this thread has already been fixed on the Programmer's Guide since OpenFOAM 2.2.0, at least from what I could find.
JamesCC likes this.
wyldckat is offline   Reply With Quote

Old   June 9, 2016, 15:21
Default
  #10
New Member
 
Gustavo
Join Date: Jun 2016
Posts: 1
Rep Power: 0
gustavorp is on a distinguished road
I found several books and papers about tensors. Most of them are showing this:

Capture.JPG

and

Capture2.JPG

I have implemented an algorithm in python to compute the tensor divergence to a 3d tensor field.

I am not sure if my implementation is correct. Does any one have some tensor field and its divergence to compare?

It could be a .txt, .mat, .py, etc.

Thank you
gustavorp is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Programmers Guide Bugs jens_klostermann OpenFOAM Bugs 2 September 7, 2013 06:44
In Programmer's Guide p. 40 makaveli_lcf OpenFOAM Bugs 3 September 7, 2013 06:41
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 12:34
Bug in the Programmerbs Guide OF15 ivan_cozza OpenFOAM Bugs 0 October 19, 2008 06:15
Fluent 5.5. What the differences with fluent 5.3?? confused FLUENT 2 July 29, 2001 22:58


All times are GMT -4. The time now is 05:08.