# setReference in fvMatrix.C

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

 April 16, 2015, 05:45 setReference in fvMatrix.C #1 New Member   Andre Weiner Join Date: Aug 2012 Posts: 27 Rep Power: 4 Hello Foamers! The method setReference is widely used in OpenFOAM, for instance to set a reference pressure in simulations without a boundary with fixed pressure value. It's body looks the following: Code: line 517-520 in fvMatrix.C { source()[celli] += diag()[celli]*value; diag()[celli] += diag()[celli]; } My Question: Why do I arrive at the defined value by manipulating the diagonal matrix coefficient and the source in the given way? Many thanks in advance! Best, Andre

April 24, 2015, 06:59
#2
Senior Member

Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
Quote:
 Originally Posted by andre.weiner Hello Foamers! The method setReference is widely used in OpenFOAM, for instance to set a reference pressure in simulations without a boundary with fixed pressure value. It's body looks the following: Code: line 517-520 in fvMatrix.C { source()[celli] += diag()[celli]*value; diag()[celli] += diag()[celli]; } My Question: Why do I arrive at the defined value by manipulating the diagonal matrix coefficient and the source in the given way? Many thanks in advance! Best, Andre
I wrote it down and hopes this will give u some hints. pls see the image. Hopes im right

oh this image is way too big...Sorry about that, Im shocked...

 April 24, 2015, 11:30 #3 New Member   Andre Weiner Join Date: Aug 2012 Posts: 27 Rep Power: 4 Ciao sharonyue! Thanks a lot for your small example. I tried to formulate it a little bit more general For each cell center P with the neighbours nb we can write the equation or What we want is to set for a given P To incorporate this condition into outer algebraic system, first we multiply by To this equation we now add (1) (we are adding 0) and get which is reordered This approach almost seems to simple and effective to be true On the one hand you do not destroy the conditioning of the Matrix by applying some huge value to the diagonal and the source, and on the other hand the symmetry of the matrix is conserved (it would be also possible to set the off-diagonal coefficients to zero). Thanks again for the support! Best, Andre

April 25, 2015, 04:19
#4
Senior Member

Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
Quote:
 Originally Posted by andre.weiner Ciao sharonyue! Thanks a lot for your small example. I tried to formulate it a little bit more general For each cell center P with the neighbours nb we can write the equation or What we want is to set for a given P To incorporate this condition into outer algebraic system, first we multiply by To this equation we now add (1) (we are adding 0) and get which is reordered This approach almost seems to simple and effective to be true On the one hand you do not destroy the conditioning of the Matrix by applying some huge value to the diagonal and the source, and on the other hand the symmetry of the matrix is conserved (it would be also possible to set the off-diagonal coefficients to zero). Thanks again for the support! Best, Andre
Neat! quite clear and simple,

Never too old to learn CFD. haha.

Best,
dongyue

 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 liuhuafei OpenFOAM Bugs 4 February 22, 2014 16:01 tehache OpenFOAM Running, Solving & CFD 5 August 29, 2012 09:41 mattamos OpenFOAM Running, Solving & CFD 7 July 28, 2005 12:03

All times are GMT -4. The time now is 07:33.