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

Save the InitialResidual as a variable in personalized solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2023, 12:35
Default Save the InitialResidual as a variable in personalized solver
  #1
New Member
 
Martin Marone
Join Date: Oct 2023
Posts: 3
Rep Power: 3
MaroneM is on a distinguished road
Hi everyone!

I am wondering how can I save the "Initial residual" reported by the different OpenFOAM numerical solvers as a variable that then I can use for example to define the convergence criteria for a system of partial differential Eq. In particular I am now interested in the momentum equation (UEqn.H), which I am taking from OpenFOAM's native "buoyantBoussinesqSimpleFoam" implementation, which I present bellow:

Code:
    MRF.correctBoundaryVelocity(U);

    tmp<fvVectorMatrix> tUEqn
    (
        fvm::div(phi, U)
      + MRF.DDt(U)
      + turbulence->divDevReff(U)
     ==
        fvOptions(U)
    );
    fvVectorMatrix& UEqn = tUEqn.ref();

    UEqn.relax();

    fvOptions.constrain(UEqn);

    if (simple.momentumPredictor())
    {
        solve
        (
            UEqn
          ==
            fvc::reconstruct
            (
                (
                  - ghf*fvc::snGrad(rhok)
                  - fvc::snGrad(p_rgh)
                )*mesh.magSf()
            )
        );

        fvOptions.correct(U);
    }
I would like to do something more or less like the following:

Code:
scalar initResUx = yourSolutionHere;
scalar initResUy = yourSolutionHere;
scalar initResUz = yourSolutionHere;

scalar initResUEqn = initResUx+initResUy+initResUz;
Thank you in advance! ^^
MaroneM is offline   Reply With Quote

Reply

Tags
residual, ueqn


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
Error: WorkBench Error: Could not handle event: SolutionStatusUpdate Kieyo Fluent Multiphase 0 November 10, 2022 00:58
two different gas! Fluid pair model! saha2122 CFX 7 February 9, 2022 08:15
[ANSYS Meshing] Help with element size sandri_92 ANSYS Meshing & Geometry 14 November 14, 2018 08:54
Solver with variable viscosity wildfire230 OpenFOAM Running, Solving & CFD 3 May 22, 2018 09:09
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27


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