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

Discretisation of fvm::div(). Why is negSumDiag() necessary?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By K.C.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2017, 14:25
Default Discretisation of fvm::div(). Why is negSumDiag() necessary?
  #1
Member
 
Join Date: Mar 2015
Posts: 35
Rep Power: 11
K.C. is on a distinguished road
Dear Foamers,

I am trying to use the fvMatrix-class for solving a sparse equation system in my model that can not be written in terms of fvm::laplacian oder fvm::div. Therfore I tried to understand the implementation of fvm::laplacian and fvm::div, to get confident with upper(), lower() and diag().

During my study I completly understood fvm::laplacian, but i get in trouble with fvm::div.
Imagine a simple 1D mesh with a simple advection of concentration by velocity U (phi on faces). Using Finite-Volume-Method for cell number 2 (so directly between cell 1 and cell 3), I would come up with the equations and discretisation in line 1 to 3 of the attached figure (weights for surface-interpolation are 0.25 and 0.75 to make the difference clear).


But using the negSumDiag() in fvm::div
Code:
for (register label face=0; face<l.size(); face++)
{
    Diag[l[face]] -= Lower[face];
    Diag[u[face]] -= Upper[face];
}
would end up with the matrix in line 4 of the attached figure.


I don't understand, how this can be the correct implementation of Finite-Volume-Method for the divergence-operator. Obviously it is correct, but I can not see my error in writing down the equations and the matrix. Thanks for every reply.
Attached Images
File Type: jpg equations.JPG (68.8 KB, 70 views)
Kummi likes this.
K.C. is offline   Reply With Quote

Old   July 8, 2017, 00:04
Default
  #2
New Member
 
WangYi
Join Date: Dec 2015
Location: Xi'an China
Posts: 7
Rep Power: 10
youmengtear is on a distinguished road
Quote:
Originally Posted by K.C. View Post
Dear Foamers,

I am trying to use the fvMatrix-class for solving a sparse equation system in my model that can not be written in terms of fvm::laplacian oder fvm::div. Therfore I tried to understand the implementation of fvm::laplacian and fvm::div, to get confident with upper(), lower() and diag().

During my study I completly understood fvm::laplacian, but i get in trouble with fvm::div.
Imagine a simple 1D mesh with a simple advection of concentration by velocity U (phi on faces). Using Finite-Volume-Method for cell number 2 (so directly between cell 1 and cell 3), I would come up with the equations and discretisation in line 1 to 3 of the attached figure (weights for surface-interpolation are 0.25 and 0.75 to make the difference clear).


But using the negSumDiag() in fvm::div
Code:
for (register label face=0; face<l.size(); face++)
{
    Diag[l[face]] -= Lower[face];
    Diag[u[face]] -= Upper[face];
}
would end up with the matrix in line 4 of the attached figure.


I don't understand, how this can be the correct implementation of Finite-Volume-Method for the divergence-operator. Obviously it is correct, but I can not see my error in writing down the equations and the matrix. Thanks for every reply.
Maybe, in the second equation the first div term show be negative, which should conside the direction of the face between 1 and 2.
youmengtear is offline   Reply With Quote

Old   July 10, 2017, 12:19
Default
  #3
Member
 
Join Date: Mar 2015
Posts: 35
Rep Power: 11
K.C. is on a distinguished road
Thanks for your answer, youmengtear.

Do you mean the sign of phi_i_j?
phi_i_j is defined as u_face*n_face, where n_face is the vector pointing outward the cell (not mesh.Sf()). So phi_i_j could be negative but that would not solve the problem.

When "phi_i_j*(c_i*weight + c_j*(1-weight))" is formed into a matrix equation, phi_i_j could not transfrom the "+" of interpolation into a "-", while the other C_value is not transformed, I guess.
K.C. is offline   Reply With Quote

Old   July 10, 2017, 18:59
Default
  #4
New Member
 
WangYi
Join Date: Dec 2015
Location: Xi'an China
Posts: 7
Rep Power: 10
youmengtear is on a distinguished road
Quote:
Originally Posted by K.C. View Post
Thanks for your answer, youmengtear.

Do you mean the sign of phi_i_j?
phi_i_j is defined as u_face*n_face, where n_face is the vector pointing outward the cell (not mesh.Sf()). So phi_i_j could be negative but that would not solve the problem.

When "phi_i_j*(c_i*weight + c_j*(1-weight))" is formed into a matrix equation, phi_i_j could not transfrom the "+" of interpolation into a "-", while the other C_value is not transformed, I guess.
In openfoam, Sf has the direction from owner to neighbour. And in internal the owner has lower label, while neighbour has upper one. So not the sign of phi_i_j but the sign of Sf means.
youmengtear is offline   Reply With Quote

Reply


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
higher order discretisation scheme Simon Smokes Main CFD Forum 2 August 23, 2014 07:19
8th order polynomial function(VOF smoothening) + ENO discretisation bharat.cmeri FLUENT 1 July 4, 2012 11:51
Wrong fvm::div assembling santiagomarquezd OpenFOAM Bugs 90 December 27, 2010 12:54
Second Order Discretisation with Porous Media giogio FLUENT 1 March 21, 2008 12:29
FEM discretisation for eps-equation Sigit Main CFD Forum 3 October 26, 2000 11:49


All times are GMT -4. The time now is 06:53.