<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[OpenFOAM sparse matrix 内存管理]]></title><description><![CDATA[<p dir="auto">各位大神好，我从事热辐射输运方向。现在想在openfoam中开发新的蒙特卡洛求解热辐射输运方程，所用的方法为READ法。我现在想用sparse matrix 存储viewfactor， 需要用到一个内存动态变化的sparse matrix。因为在fvMatrix类中，sparse matrix根据网格类型、差值算法等条件，内存都是事先分配好的。请问大神有什么建议吗？</p>
]]></description><link>https://cfd-china.com/topic/2293/openfoam-sparse-matrix-内存管理</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 12:44:56 GMT</lastBuildDate><atom:link href="https://cfd-china.com/topic/2293.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Mar 2019 19:31:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to OpenFOAM sparse matrix 内存管理 on Sat, 02 Mar 2019 20:08:27 GMT]]></title><description><![CDATA[<p dir="auto">好吧！我先自己回复下自己。在稀疏矩阵存储中，通用有两种格式，如下矩阵</p>
<pre><code>A =   [ a00  a01 0 0
         0 a11 a12 0
         a20 0 a22 0
         a30 0 0 a33];
</code></pre>
<p dir="auto">引用一篇博士论文 CRS scheme stores the non-zero elements the matrix in left-to-right and top-to-bottom order in vector v (row-wise storge). 存储格式如下</p>
<pre><code>v = [a00, a01, a11,a12,a20,a22,a30,a33]
cI = [0,1,1,2,0,2,0,3]
rI = [0,1,1,2,0,2,0,3]
</code></pre>
<p dir="auto">但是在openfoam中，不是这么存储的<br />
openfoam是一种 LDU 格式  对角线 lowerAddr() upperAddr()</p>
<pre><code>A = [ 
       d0 u0 u1  0  0 0 
       l0 d1 u2  0 0 0 0 
        l1 l2 d2 u4 u5
        . . . 
]
</code></pre>
<pre><code> l = [l0 l1 l2  ...]
 d = [d0 d1 d2 d3 d4 ...]
 u = [u0 u1 u2 u3 ...]
L = [0 0 1 1 2 2 3 ...]
U = [1 2 2 3 3 4 4 ..]
</code></pre>
<p dir="auto">具体可参见lduAddressing.H 头文件<br />
因为计算流体力学中，大部分矩阵都是对称（因为一个internal face对应两个体）除了特别的边界条件外，基本上都是对称矩阵。而矩阵对角元素就更好求了，大部分情况直接把该行相加就得到主对角元素。这种sparse matrix设计是符合cfd计算原理的，但是我的问题还是没解决。看到相关资料分享一下。<br />
稀疏矩阵也分好多种，openfoam中的renumberMesh就是尽量保证在是多对角阵。<br />
谢谢！</p>
]]></description><link>https://cfd-china.com/post/12040</link><guid isPermaLink="true">https://cfd-china.com/post/12040</guid><dc:creator><![CDATA[刘雄国]]></dc:creator><pubDate>Sat, 02 Mar 2019 20:08:27 GMT</pubDate></item></channel></rss>