# Write cell residual value in the solution?

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

 October 1, 2010, 08:04 Write cell residual value in the solution? #1 Senior Member   M. Montero Join Date: Mar 2009 Location: Madrid Posts: 125 Rep Power: 10 Hi all, with respect to other commercial cfd codes, I miss the possibility to plot the cell residual value (Ux, Uy, p, k, epsilon) in the same way as velocity or pressure and so, detect mesh problems or computational problem in the fluid domain...... Does anyone know if there is this option with openfoam or how to implement it into the code? Thanks in advance

 October 1, 2010, 08:31 #2 Senior Member   Laurence R. McGlashan Join Date: Mar 2009 Posts: 370 Rep Power: 16 Say you have a scalar transport equation Code: ```fvScalarMatrix aField ( fvm::ddt(aField) + fvm::div(phi, aField) ); eqnResidual = aField.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual);``` initialResidual() in Foam::lduMatrix::solverPerformance and residual() in Foam::fvMatrix will give the quantities you are looking for. __________________ Laurence R. McGlashan :: Website

 October 1, 2010, 12:33 #3 Member   Niklas Winkler Join Date: Mar 2009 Location: Stockholm, Stockholm, Sweden Posts: 73 Rep Power: 10 Hi, I'm also interested in computing the residual, since I need it for a low-dimensional model via POD modes. Do you know what residual() in Foam::fvMatrix actually computes? I would like to compute the residual (the spatial part of the mom. eq. in rhoPisoFoam) for every cell. However, as a check I tried but I can't get the complete momentum equation to be fulfilled!? Tried the following below. Any idea of what could be wrong? 1) The following two equals, UEqn1Residual == UEqn_Expl_Residual , i.e the .residual() should be divided by the cell volume! And the terms can be computed explicitly, see computations below. (Have also computed the transient term with fvc and fvm which gave the same results!) fvVectorMatrix UEqn1 ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) + fvc::grad(p) ); vectorField UEqn1Residual(UEqn1.residual()); FOR EVERY CELL: volVectorField UEqn1_Residual(UEqn1_Residual[cellI] = UEqn3Residual[cellI]/mesh.V()[cellI]); volVectorField UEqn_Expl_Residual( fvc::div(phi, U) - muEff*fvc::laplacian(U) - muEff*fvc::div(dev2(fvc::grad(U)().T())) + fvc::grad(p)); 2) I've computed the transient term as a volField (fvc::ddt(rho, U)) and the spatial terms as a fvMatrix separately. To check that the momentum eq. is fulfilled I added the transient term with the residual of the spatial terms divided by the cell volume. And the results are far from zero!!!? Thanks All the Best /NW

 October 4, 2010, 05:18 #4 Senior Member   M. Montero Join Date: Mar 2009 Location: Madrid Posts: 125 Rep Power: 10 Sorry but I do not understand what I have to do. I have not handed on openfoam code so I have no idea. What I want is to plot with paraView or Tecplot ( with foamToTecplot) the cell residual value ( pressure or Ux, Uy, Uz) but I do not Know what part of the code (files ) I have to modify to obtain this. Could you explain slowly what I have to do it? Please. I will put my best. PD: I am running simpleFoam. OF 1.6.x

 October 4, 2010, 05:37 #5 Member   Niklas Winkler Join Date: Mar 2009 Location: Stockholm, Stockholm, Sweden Posts: 73 Rep Power: 10 I'm myself are trying to get the residuals and my reply to your thread is just another question to why I'm not getting the result I'm expecting. However, to answer your question you can look at the code in the following thread, http://www.cfd-online.com/Forums/ope...residuals.html Regards /NW

 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

 Similar Threads Thread Thread Starter Forum Replies Last Post raagh77 OpenFOAM Running, Solving & CFD 99 February 6, 2018 19:31 Unseen OpenFOAM Running, Solving & CFD 7 April 16, 2014 03:38 heavy_user OpenFOAM 16 February 11, 2012 06:15 vw.cfd OpenFOAM 6 August 7, 2009 05:44 braennstroem OpenFOAM Running, Solving & CFD 16 May 15, 2006 02:23

All times are GMT -4. The time now is 00:03.