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

Write cell residual value in the solution?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2010, 08:04
Default Write cell residual value in the solution?
  #1
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
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
be_inspired is offline   Reply With Quote

Old   October 1, 2010, 08:31
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
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
l_r_mcglashan is offline   Reply With Quote

Old   October 1, 2010, 12:33
Arrow
  #3
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
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
nikwin is offline   Reply With Quote

Old   October 4, 2010, 05:18
Default
  #4
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
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
be_inspired is offline   Reply With Quote

Old   October 4, 2010, 05:37
Default
  #5
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
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
nikwin 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
transsonic nozzle with rhoSimpleFoam Unseen OpenFOAM Running, Solving & CFD 8 July 1, 2022 06:54
icoLagrangianFoam OF1.6 myNewParticleSolver heavy_user OpenFOAM 23 June 2, 2020 02:18
TwoPhaseEulerFoam and Boundary conditions raagh77 OpenFOAM Running, Solving & CFD 99 February 6, 2018 18:31
Error log vw.cfd OpenFOAM 6 August 7, 2009 05:44
Problem with jet flow braennstroem OpenFOAM Running, Solving & CFD 16 May 15, 2006 02:23


All times are GMT -4. The time now is 01:17.