CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Modifying the wallHeatFlux utility (https://www.cfd-online.com/Forums/openfoam-post-processing/157365-modifying-wallheatflux-utility.html)

schuyler July 27, 2015 14:45

Modifying the wallHeatFlux utility
 
Hello,

I am making a different version of wallHeatFlux for myself that will use the fvc::grad to calculate the gradient instead of the snGrad.

This is how it looks after I modified it:

Code:

   

 #include "createFields.H"
volVectorField gradh
    (
        IOobject
        (
        "gradh",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
        ),
        fvc::grad(h)
    );

    volScalarField wallgradh
    (
        IOobject
        (
        "wallgradh",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("wallgradh",dimensionSet(1,1,-2,0,0,0,0),0)
    );

    volScalarField heatFlux
    (
        IOobject
        (
        "heatFlux",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("heatFlux",dimensionSet(1,0,-3,0,0,0,0),0)
    );

    forAll(wallgradh.boundaryField(), patchI)
    {
        wallgradh.boundaryField()[patchI] =
        (
            ( mesh.Sf().boundaryField()[patchI] ) / ( mesh.magSf().boundaryField()[patchI] ) & gradh.boundaryField()[patchI]
        );
    }
   
    forAll(heatFlux.boundaryField(),patchI)
    {
        heatFlux.boundaryField()[patchI] =
        fvc::interpolate
                (
                    (
                    turbulence.valid()
                  ? turbulence->alphaEff()()
                  : thermo->alpha()
                    )
                )*wallgradh.boundaryField()[patchI];
    }

The above compiles in the utility but when I run it on a case I get the following error code:

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigSegv::sigHandler(int) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::multiply(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#4  Foam::operator*(Foam::UList<double> const&, Foam::UList<double> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5 
 in "/home/wshinman/OpenFOAM/wshinman-2.2.1/platforms/linux64GccDPOpt/bin/mywallHeatFlux"
#6  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 
 in "/home/wshinman/OpenFOAM/wshinman-2.2.1/platforms/linux64GccDPOpt/bin/mywallHeatFlux"

Anything obvious that I may have screwed up?

Thanks,

Schuyler

schuyler July 27, 2015 15:48

Solved!
 
I found the problem (stupid mistake by me).

The section:

Code:

    forAll(heatFlux.boundaryField(), patchI)
    {
        heatFlux.boundaryField()[patchI] =
        (
        fvc::interpolate(
            ( turbulence.valid()
                      ? turbulence->alphaEff()()
                      : thermo->alpha()
            )
            )*(wallgradh.boundaryField()[patchI])
        );
    }

Was causing the problem because when I call out alpha it is not a boundary field. I just defined a new surfaceScalarField called alpha and then calculated the heatFlux using its boundaryField.

Schuyler


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