CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Get initialResidual of each space direction (https://www.cfd-online.com/Forums/openfoam-programming-development/158481-get-initialresidual-each-space-direction.html)

Tobi August 26, 2015 09:47

Get initialResidual of each space direction
 
Hi all,

I have a question about the initial residuals for the questions in the x, y and z direction. I can make a scalar where i get the lowest initial residuals of x,y and z like:
Code:

scalar initResidual = UEqn.solve().initialResidual();
Does anybody know if its possible to access x, y and z like:
Code:

scalar initResidual_x = UEqn.solve().initialResidual().x();
scalar initResidual_y = UEqn.solve().initialResidual().y();
scalar initResidual_z = UEqn.solve().initialResidual().z();

Via Doxygen I did not find a call function that return the value I need. I need it because my stress solver (2d-rotational symmetric - wedge) is not stopping because the wedge side's are fluctuating and do not fall down.

fabian_roesler August 27, 2015 08:17

component(initialResidual, xyz)
 
Hi Tobi

have a look into
/src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.C.

This is the part of OpenFOAM where all the solver outputs come from. Here they use component(initialResidual, xyz). May be this is what you're looking for.

Code:

for(direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
    if (pTraits<Type>::nComponents == 1)
    {
        os << solverName_ << ": Solving for " << fieldName_;
    }
    else
    {
        os << solverName_ << ": Solving for "
          << word(fieldName_ + pTraits<Type>::componentNames[cmpt]);
    }
    if (singular_[cmpt])
    {
        os << ": solution singularity" << endl;
    }
    else
    {
        os << ", Initial residual = " << component(initialResidual_, cmpt)
          << ", Final residual = " << component(finalResidual_, cmpt)
          << ", No Iterations " << noIterations_
          << endl;
    }
 }

Cheers


Fabian

Tobi August 27, 2015 09:13

Dear Fabian, thanks for the hint. Is exactly need component(finalResidual_, clot). But how to access to that value out of that function? I am not at my computer at the moment but will check it later.

kishpishar August 5, 2016 08:17

Hi Tobi,

Have you found out a way to extract the individual components of the initialResidual()? If you make scalar initRes = UEqn.solve().initialResidual()
I think you get the initial residual of the last equation solved. I need this for a transient solver I am making. Thanks,

Kumar


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