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

Adding a term in the diagonal of the matrix form of the momentum equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 3, 2020, 05:07
Default Adding a term in the diagonal of the matrix form of the momentum equation
  #1
New Member
 
Join Date: Aug 2020
Posts: 20
Rep Power: 6
Agavi is on a distinguished road
Hi everyone,

I'm an openfoam beginner and am trying to implement a simple addition of a term (sp) in the diagonal of the matrix form of the N-S eqns. ie: a_p*u_p -\Sigma{a_f*u_f} = b_p+s_p*u_p. The term sp*up should be subtracted implicitly in the diagonal of the RHS of Au=b, increasing the diagonal dominance because sp<0. In order to implement this change in OF I used the SuSp framework. I added a term s_p*u_p/V_p in the PDE in order for it to be discretized as s_p*u_p in the matrix form.

I'm using

eqn += fvm::Sp(sp/Vp,U) in the addSup function in fvOptions.

I tried printing out the diagonal and the upper and lower matrices of UEqn and it appears that the diagonal indeed increases by sp, while the upper and lower remain untouched. However I'm not getting my desirable results so I was wondering if there is anything wrong with my implementation.

The reason I'm confused is that I don't seem to be able to print out the system A*u=b. I did find a way online to get matrix A and vector b, by adding the UEqn's upper lower and diagonal with the BC contributions, but when i multiply this matrix by the UEqn().psi() (when the solution has converged) I do not get the UEqn().source(), which is again not equal to UEqn().boundaryCoeffs()[patchI][faceI], which i thought was supposed to be the RHS of Au=b. I am definitely getting something wrong, and probably need some good explanation of the fvMatrix class functions. I'd be very greatful if someone could point me to the right direction

Thanks,

A
Agavi is offline   Reply With Quote

Old   August 3, 2020, 14:12
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Replace Sp by SuSp. See https://github.com/OpenFOAM/OpenFOAM...e/fvm/fvmSup.H (and corresponding C-file).

Some details are at https://www.linkedin.com/pulse/openf...menico-lahaye/
dlahaye 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
Developing a matrix coefficient for a source term and adding a constrain equation charles4allme OpenFOAM Programming & Development 0 April 9, 2019 12:38
Energy Equation - Adding source term cfdsolver1 OpenFOAM Running, Solving & CFD 9 February 21, 2018 11:52
A simple question about adding Div and Grad of a source term to the momentum equation adkar Main CFD Forum 5 May 23, 2016 18:31
Adding source term to the momentum equation sirpolar FLUENT 1 January 6, 2016 09:29
what is form of momentum equation in case of cavitation in nozzle & how it is solved arindamsantra7 Fluent Multiphase 0 August 11, 2014 04:32


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