CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Scalar Field Residual (https://www.cfd-online.com/Forums/openfoam-solving/59137-scalar-field-residual.html)

dak81 February 12, 2008 14:24

Hi, All Does anybody know h
 
Hi, All

Does anybody know how to calculate residual of
two scalar field with OpenFOAM?

I wanna get shorter code then that:

volScalarField residual("residual", T);

residual == mag(analytical - T);

doubleScalar maxResidual = 0.0;

forAll(residual, i) {
if (residual[i] > maxResidual) {
maxResidual = residual[i];
}
}

residual = maxResidual;

where analytical & T are of type volScalarField.

dak81 February 12, 2008 15:00

i.e. in my question i mean how
 
i.e. in my question i mean how to find max element of volScalarField using OpenFOAM methods

dmoroian February 13, 2008 01:32

How about "max(residual)"...?
 
How about "max(residual)"...?

dak81 February 13, 2008 01:48

Ah, thanks. I found the decisi
 
Ah, thanks. I found the decision by myself already.

max(mag(analytical - T)).value();

I was in trouble because i didn't use *.value(),
then max(mag(analytical - T)) was returning not scalar value.


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