|
[Sponsors] |
December 11, 2013, 11:06 |
Conversion to fvscalar matrix equation
|
#1 |
Member
AJ
Join Date: Sep 2013
Posts: 30
Rep Power: 12 |
Dear Fomers
Can you guys help me to convert this energy equation to fvscalar matrix equation, i am getting frequent errors in this part of program. formula.JPG |
|
December 11, 2013, 11:43 |
|
#2 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Code:
forAll(A,i) { A[i][i] = pEqn.diag()[i]; // inserting diagonal elements in A b[i] = pEqn.source()[i]; // and in b } const lduAddressing& addr = pEqn.lduAddr(); const labelList& lowerAddr = addr.lowerAddr(); const labelList& upperAddr = addr.upperAddr(); forAll(lowerAddr, i) { A[lowerAddr[i]][upperAddr[i]] = pEqn.upper()[i]; A[upperAddr[i]][lowerAddr[i]] = pEqn.lower()[i]; } forAll(p.boundaryField(),I) { const fvPatch &ptch=p.boundaryField()[I].patch(); forAll(ptch,J) { int w=ptch.faceCells()[J]; A[w][w]+=pEqn.internalCoeffs()[I][J]; b[w] +=pEqn.boundaryCoeffs()[I][J]; } } |
|
December 11, 2013, 18:36 |
|
#3 |
Member
AJ
Join Date: Sep 2013
Posts: 30
Rep Power: 12 |
But Matvej, i have attached an equation below.I had changed that equation as
fvm::ddt(T)+ ((fvc::grad(U))*T)-(lambda\(Cp*rho))*fvm::laplacian(T) ignoring the epsilon. Is the above equation equivalent to which i attached .Because i get errors when i use this in TEqn |
|
December 12, 2013, 03:56 |
|
#4 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21 |
Uhm, which errors?
Normally you would discretize the convective term with fvm::div(phi,T). Have a look in the, for example, buoyantPimpleFoam solver. The h-equation is very similar to your T-equation. |
|
December 12, 2013, 09:32 |
|
#5 |
Member
AJ
Join Date: Sep 2013
Posts: 30
Rep Power: 12 |
Bernhard, i have uploaded a formula pic in my first post.I got that from a journal.I wanted a fvscalar matrix equation equivalent to that.can u please go through tat equation and give me some suggestions.
|
|
December 13, 2013, 11:17 |
|
#6 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Hi, Aj Nair!
My last post was about how to convert from your OF matrix format to 2D array. Now i see, that You are missing some basics of OF. The problem that you are experiencing, is that OF uses conservative integral solution. Let's think you have equation fig1.jpg Then, You must convert this equation to conservative form: fig2.jpg But, OF works with integral equations, thus, you have to convert to integral balance: fig3.jpg If you will use mean theorem, without second order terms you can write: fig4.jpg By splitting terms at the r.h.s You will get: fig5.jpg |
|
December 13, 2013, 11:28 |
|
#7 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Now, if lambda, rho and Cp are constant, You convert Your equation to:
fig6.jpg You can find all equations here: T-equation-from-cfd-online.pdf Last equation can be discretized with OF: Code:
volScalarField kappa = lambda / rho / Cp; fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi,T) - fvm::Sp(fvc::div(phi), T) == fvm::laplacian(kappa, T) + (gamma / Cp) * dEpsilonOverDt ); Last edited by mkraposhin; December 15, 2013 at 06:10. |
|
December 15, 2013, 02:11 |
|
#8 |
Member
AJ
Join Date: Sep 2013
Posts: 30
Rep Power: 12 |
Thanks a lot Matvej, i will come back to you, if i have any doubt
|
|
December 15, 2013, 02:25 |
|
#9 |
Member
AJ
Join Date: Sep 2013
Posts: 30
Rep Power: 12 |
Sorry for the delay in reply, thanks again Matvej
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
inverse of a matrix or solution of implicit equation | romant | OpenFOAM Programming & Development | 4 | August 6, 2013 09:02 |
About theory:how to get the pressure equation when solving u-p simultaneously? | lzw2003 | Main CFD Forum | 8 | April 8, 2012 22:13 |
continuity equation | Rafal | Main CFD Forum | 4 | November 29, 2006 09:27 |
Poisson equation vs continuity equation | DJ | Main CFD Forum | 1 | August 5, 2004 20:01 |
Boundary conditions in a Poisson's equation? | vincent | Main CFD Forum | 4 | April 16, 1999 02:19 |