# fvc::laplacian(rAUf, p_rgh) versus fvm::laplacian(rAUf, p_rgh)

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

 July 24, 2015, 10:50 fvc::laplacian(rAUf, p_rgh) versus fvm::laplacian(rAUf, p_rgh) #1 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 Dear all, I have a problem to understand the way how OpenFoam dicretizes the pressure equation. There is already a lot of information on this forum, but always on the explicit formulation. E.g. Code: `fvc::laplacian(rAUf, p_rgh)` is identical to: Code: `fvc::surfaceIntegrate(rAUf*fvc::snGrad(p_rgh)*mag(mesh.Sf()))` I verified this and it is correct. Also Code: `fvc::surfaceIntegrate(rAUf*fvc::snGrad(p_rgh)*mag(mesh.Sf())-phiHbyA)` is identical to Code: `fvc::laplacian(rAUf, p_rgh) - fvc::div(phiHbyA)` . So the sum rule of the divergence does apply indeed. But if I use fvScalarMatrix p_rghEqn ( fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) ); the equation is decitized into a linear matrix equation type Code: `S - A * p_rgh = rA` whereas rA is the residual that is iterated to be small (A is the matrix). In my case I get an average number per cell of 10^-20, which is really small. However, if compare this by the explicit divergence of the calulated phi field, I get an error of around 10^-8. Is there any explanation to this? Regards, Daniel

 July 28, 2015, 03:54 #2 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 I think I have an idea where this may come from. OpenFoam uses a feature called "non-othogonal correction". It supposely takes care of this issue. In order to see, if it is doing what I need, I can add non-orthogonal corrector loops and hope this does change something. It would be nice to have some measurement of effictiveness of non-othogonal correction. I would need the residuals of the matrix iteration and, divide them by the expicit error (div (phi) in this case and some the absolute of these local errors up, eventually divide it by the number of cells. This would give me some measure if the non-orthogonal correction does something. Is there some method to get the matrix residuals. I do not see any of such object in the solverperformance declaration. Regards, Daniel

 July 29, 2015, 04:19 #3 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 I checked the non orthogonal correction. Even this swithed off, I get the same inconsistency. So, I am kind of stuck here. Is there anybody who has an explanation? some higher order terms, which are neglegted in fvm discretization procedure? Curreously: if I set use the explicit error and add it to a 2nd fvm discretization, the deviation remains. I am kind of stuck here. Is there somebody who has an idea? Regards, Daniel

 July 30, 2015, 10:14 #4 New Member   Jan Join Date: Oct 2014 Posts: 8 Rep Power: 2 Hey danny, I'm very new here and as you will have recognized I myself am also a little bit lost To be honest I don't really see what your question is ... As I understand it, you want to know what the difference between the explicit and the implicit class is. I am not sure if I got it right myself ... I am asking myself the same thing for some time now but as the "Programmers Guide" says: "vm and fvc contain static functions, representing differential operators, e.g. ∇ 2 , ∇ • and ∂/∂t, that discretise geometricField < Type > s. The purpose of defining these functions within two classes, fvm and fvc, rather than one, is to distinguish: • functions of fvm that calculate implicit derivatives of and return an fvMatrix < Type > • some functions of fvc that calculate explicit derivatives and other explicit calcula- tions, returning a geometricField < Type > ." (P-36) So I think the main difference is that derivatives are calculated in different ways. (see http://www.sosmath.com/calculus/diff/der05/der05.html ) Since the path to your solution is a different one this may (or will) cause a small difference in the numerical solution. Though there is a small difference both solutions should be pretty similar and about equally "correct" (and roughly equally wrong) I don't know much about the "non-orthogonal correction" loops but they seem to be important in some cases ... I didn't really get what they do yet ... (P-51) Sorry - I know I'm not very helpful here ... but as I mentioned I'm not even sure what exactly your problem is ... and I don't know how you can sum up exact differences ...

 July 30, 2015, 11:54 #5 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 It is getting even more confusing since I added a comment line in the gausslapacianscheme and it is not to be found in the output. I think I have to sleep this over. Since CFD uses linear discretization exclusively, You can always represent a differential equation as A * x = b, A being a matrix, x the value vector and b the source term. So, there should not be no difference to the explicit calculation unless there is some multiplication. E.g. in the convective term there is a quadratic term (rho phi U), but this is treated is a linear relationship too, since only U is treated implicetly. By the way, fvm::lapalcian(A) does exists already in the namespace. It is treated the same way I told you, but consideres non-othogonal correction. You can switch it off though. Regards, Daniel

 July 31, 2015, 05:58 #6 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 I put info statements into laplacianScheme.C. It compiles, but there is no output. Is there any reason to this? Or do I look into the wrong file? To test, I simply did this: Code: ```// if (fv::debug) { Info<< "laplacianScheme::New(const fvMesh&, Istream&) : " "constructing laplacianScheme" << endl; }``` This should basically cancel out the debug switch. In the application solver, I call Code: ``` fvScalarMatrix pcorrEqn ( fvm::laplacian(rAUf, pcorr) == fvc::div(phiHbyA) );``` This works and I get an ouput, but the info statement above is not plotted. Is there anybody who has an idea? The same happens, if I add info statements into gaussLaplacianScheme.C Regards, Daniel

 Today, 05:42 #7 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 122 Rep Power: 5 Hello, Now it becomes more and more tricky. I have 2 implicit laplacians in my code, one explicit laplacian. So far, so simple. I put info statement into the code. It seems that Code: ```template tmp > laplacianScheme::fvmLaplacian``` is called located in laplacianScheme.C. It gets called only once. The explicit call within the same file does not get called . When the individual laplacians are built, Code: ```template tmp > gaussLaplacianScheme::fvmLaplacianUncorrected``` gets called, located in gaussLaplacianScheme.C. It does not matter if I specify "Gauss linear corrected" or "Gauss linear uncorrected" . The explicit laplacian call also does not get called by the pcorrEq.flux() command. Is there anybody who knows how the laplacian call logic works? It would be nice to have that of the snGrad logic too, since the explicit laplacian calls snGrade (even though maybe not, since the fvc laplacian does not get called). Regards, Daniel

 Tags laplacian operator

 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

All times are GMT -4. The time now is 11:54.