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

Probing Residuals at specific points

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 15, 2016, 21:19
Default Probing Residuals at specific points
  #1
D.B
Member
 
DB
Join Date: Apr 2011
Posts: 87
Rep Power: 15
D.B is on a distinguished road
Hi All,
I want to monitor residuals at specific points in the domain. I have checked the residual function objects which gives max initial residuals in the entire domain. I have checked probes as well which writes various fields at various probe locations.

I have found no examples of writing residuals at specific points.

Can someone enlighten me of any functionality present in OpenFOAM which would help me get residuals at specific points in the domain, or if someone has an idea of how to change the source code for the same purpose.

Thanks,
__________________
-D.B
D.B is offline   Reply With Quote

Old   July 21, 2016, 10:20
Default
  #2
New Member
 
Join Date: Jun 2016
Posts: 9
Rep Power: 10
coloursfordirectors is on a distinguished road
Hi D. B.! I'm looking for exactly the same – have you found a solution in the meantime?
coloursfordirectors is offline   Reply With Quote

Old   August 30, 2016, 12:50
Default
  #3
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
A long time ago, I submitted a patch for something related to this:
http://bugs.openfoam.org/view.php?id=270

Perhaps this is a starting point: You can access the residual field of the solver object. Also the normalization constant should be accessible via the object registry. So you have to modify the solver and store the residuals as field at each (to be saved) time step.

In createFields.H of your solver, you have to add fields for the residuals, e.g.:
Code:
    volVectorField uResidual
    (
        IOobject
        (
            "uResidual",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionedVector("zero", dimensionSet(0,0,-1,0,0,0,0), vector(0.0, 0.0, 0.0))
    );

    volScalarField uxRes
    (
        IOobject
        (
            "uxRes",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimensionSet(1,-2,-2,0,0,0,0), 0.0)
    );

    volScalarField uyRes
    (
        IOobject
        (
            "uyRes",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimensionSet(1,-2,-2,0,0,0,0), 0.0)
    );

    volScalarField uzRes
    (
        IOobject
        (
            "uzRes",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimensionSet(1,-2,-2,0,0,0,0), 0.0)
    );



    volScalarField pResidual
    (
        IOobject
        (
            "pResidual",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimensionSet(0,0,-1,0,0,0,0), 0.0)
    );
In your solver you have to set these fields after every time step (bofore call to .solve()):

Code:
      pResidual.internalField() = p_rghEqn.residual();
Code:
            uResidual.internalField() = UEqnRes.residual();
            uxRes.internalField() = mag(uResidual.component(0));
            uyRes.internalField() = mag(uResidual.component(1));
            uzRes.internalField() = mag(uResidual.component(2));
To be honest, at the moment, I do not know how to access the normalization factor, but perhaps, the above code is enough, if you see where the largest residuals occur.
jherb is offline   Reply With Quote

Reply

Tags
openfoam;, probing, residuals


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
Setting the height of the stream in the free channel kevinmccartin CFX 12 October 13, 2022 22:43
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 01:58
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 18:00
Compression stoke is giving higher pressure than calculated nickjuana CFX 62 May 19, 2015 14:32
judging convergence through residuals MachZero Main CFD Forum 7 December 25, 2012 13:18


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