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

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

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 17, 2012, 11: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: 7
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
sebastian is offline   Reply With Quote

Old   July 17, 2012, 14:54
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
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, 15:35
Default
  #3
Member
 
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 7
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, 17:15
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
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, 02:38
Default
  #5
Member
 
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 7
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 09:24.
sebastian is offline   Reply With Quote

Old   July 18, 2012, 05:53
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
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, 06:09
Default
  #9
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,258
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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.
wyldckat is offline   Reply With Quote

Reply

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


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