# Workings of setValuesFromList

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

 December 30, 2011, 21:48 Workings of setValuesFromList #1 New Member   lazio Join Date: Apr 2010 Posts: 22 Rep Power: 9 Dear Foamers, I am trying to understand the function setValuesFromList which is in fvMatrix.C lines 181-267 in OF 2.1.0. As I understand the core is executed in lines 207 & 208: Code:  psi[celli] = value; source_[celli] = value*Diag[celli]; which sets the source vector equal to the diagonal times the value specified. This makes sense and I can understand. However I fail to fully grasp lines 220-232, i.e., Code:  if (symmetric()) { if (celli == own[facei]) { source_[nei[facei]] -= upper()[facei]*value; } else { source_[own[facei]] -= upper()[facei]*value; } upper()[facei] = 0.0; } * What is the meaning of upper()? * What is the meaning of "source_[nei[facei]] -= upper()[facei]*value", does this set the source vector of the neighbor cells, and why does it only subtract and not set? * Would it not be suffice to just set the neighbor matrix coefficients (a_N) to zero? Thank you very much, all input is very much appreciated.

December 31, 2011, 12:17
#2
Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,020
Blog Entries: 39
Rep Power: 109
Greetings lrunber,

I'm not familiar with this part of the code of OpenFOAM, but since we are near the end of 2011 and beginning of 2012 (and if will be like last year), the experts on this subject won't come back for a another few days.

So, based on the following information:
• Source: http://foam.sourceforge.net/docs/cpp....html#_details
Quote:
 lduMatrix is a general matrix class in which the coefficients are stored as three arrays, one for the upper triangle, one for the lower triangle and a third for the diagonal. Addressing arrays must be supplied for the upper and lower triangles.
• The outer if block checks for symmetry, therefore the contents are meant to be related only to symmetry.

Quote:
 Originally Posted by lrunber * What is the meaning of upper()?
Should be the reference to the Upper matrix of a symmetric matrix. This way only half of the matrix needs to be stored.

Quote:
 Originally Posted by lrunber * What is the meaning of "source_[nei[facei]] -= upper()[facei]*value", does this set the source vector of the neighbor cells, and why does it only subtract and not set?
In OpenFOAM, operators sometimes don't do what we expect them to do. Check the source code when in doubt: http://foam.sourceforge.net/docs/cpp...ce.html#l00215

Quote:
 Originally Posted by lrunber * Would it not be suffice to just set the neighbor matrix coefficients (a_N) to zero?
By what I can deduce from that set of code, for whatever reason, that "upper" matrix seems to only contain weights. That is why the set value is weighed-in with the upper value, then neutralized so it won't be used in future iterations.

This should get you going forward, at least until someone more experienced can answer you!

Best regards,
Bruno
__________________

 December 31, 2011, 14:30 #3 New Member   lazio Join Date: Apr 2010 Posts: 22 Rep Power: 9 Thank you very much Bruno! May I also take this opportunity to wish you a fantastic 2012 I think I may have figured it out, I will write out my understanding and if someone could please just comment on the correctness.. The discretized FVM equation for each cell can be written out as: (Eq. 1) In the ldumatrix these terms correspond to: = diag() = upper() and lower() = source_ and the solution variable corresponds to: = psi_ To "force" the solution in the specified cells (cellLabels) to the specified values (values), the following operations are performed on the matrix for each of the concerned equations: (line: 207) (line: 208) (line: 231 or 244 & 245, depending on matrix symmetry) This results in the trivial solution of Eq. 1 i.e., However, there remains the important aspect of the influence of the fixed cells on their neighbor cells and setting removes this influence (since it is zero'd!). This is where I am very impressed with this code (if I understand it correctly), since before the zero'ing of , the influence of the concerned cells is added to neighbors by modifying the source term for the neighboring cells ( ) using the old value before setting it to zero. (lines 224 & 228 or 237 & 241 depending on symmetry) I hope my understanding is correct. Thanks again Bruno for putting me on track. wyldckat likes this.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post tanven FLUENT 2 July 5, 2015 11:22 niklas OpenFOAM 2 July 31, 2013 16:03 atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 16:26 Carlos Main CFD Forum 4 August 23, 2002 05:55 K.L.Huang Siemens 1 March 29, 2000 04:57

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