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

Problem with snGrad() for heat flux.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2014, 05:11
Default Problem with snGrad() for heat flux.
  #1
New Member
 
Lee
Join Date: Oct 2011
Posts: 15
Rep Power: 14
SKLee is on a distinguished road
I am simulating the gas laminar flow in straight rectangular channel with rhoCentralFoam (OF-2.2.2), I modified the utility wallHeatFlux and also renamed it to extract the heat flux for laminar flow, and get problem with snGrad() that was used to compute the normal gradient of temperature.

In the code I set

surfaceScalarField heatFlux = (fvc::interpolate(-k))*(fvc::snGrad(T));

then I compile my utility and run it and get the heat fluxes at the surfaces and outlet are zero while it can produce the heat flux at inlet only.

I just check heatFlux = fvc::interpolate(-k) so I have all values (not zero) of k at the surfaces but it I added (fvc::snGrad(T)) to heatFlux I got the results are zero for surface heat flux. This means (fvc::snGrad(T)) produced the value of zero for normal gradient temperature.

What problem I get with snGrad() function. Can anyone help me to get the heat fluxes at the surfaces ?

I use psiThemo model in simulation.
SKLee is offline   Reply With Quote

Old   February 16, 2014, 13:01
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Lee,

I honestly don't know what is the problem you're getting, because I don't get any problem. I'm guessing this is because you didn't share enough information for reproducing the same problem.

I modified the wallHeatFlux utility this way:
  1. Copied the folder "$FOAM_UTILITIES/postProcessing/wall/wallHeatFlux".
  2. Renamed the application in "Make/files".
  3. Changed in the main C file:
    Code:
    surfaceScalarField heatFlux
    (
        fvc::interpolate
        (
            (
                turbulence.valid()
              ? turbulence->alphaEff()()
              : thermo->alpha()
            )
        )*fvc::snGrad(h)
    );
    To this:
    Code:
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        ),
        mesh
    );
        
    surfaceScalarField heatFlux
    (
        fvc::interpolate
        (
            (
                turbulence.valid()
              ? turbulence->alphaEff()()
              : thermo->alpha()
            )
        )*fvc::snGrad(T)
    );
  4. Build it.
  5. Ran in the tutorial case "heatTransfer/buoyantSimpleFoam/hotRoom".
  6. Got results that seemed similar to the original wallHeatFlux.
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 24, 2014, 09:09
Default
  #3
New Member
 
Lee
Join Date: Oct 2011
Posts: 15
Rep Power: 14
SKLee is on a distinguished road
Hi Bruno,

I modified the wallHeatFLux for laminar case with the rhoCentralFoam solver.

in CreateFields.H
Code:
autoPtr<psiThermo> pThermo
(
    psiThermo::New(mesh)
);
psiThermo& thermo = pThermo();


volScalarField Cp
(
IOobject
(
    "Cp",
    runTime.timeName(),
    mesh
),
  thermo.Cp()
 );

volScalarField mu
(
    IOobject
    (
        "mu",
        runTime.timeName(),
        mesh
    ),
    thermo.mu()
);
and in the wallHeatFluxModifief.C I just change

Code:
volScalarField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::NO_WRITE
    ),
    mesh
);
        surfaceScalarField heatFlux
        
(
    fvc::interpolate
    (
        (
              mu*Cp/0.72
             // Pr = 0.72
         )
    )*fvc::snGrad(T)
);
and built it to run. The results show that the heat flux at the wall is zero everywhere. I just try to remove fvc::snGrad(T) and the results is not zero. (i.e. the values of mu*Cp/0.72 shown). That means in my modified code fvc::snGrad(T) does not work (i.e. snGrad(T) = 0).

Could you help me to find out the mistakes ?

Thanks

Best regards,

SK

Last edited by wyldckat; March 2, 2014 at 07:20. Reason: Added [CODE][/CODE]
SKLee is offline   Reply With Quote

Old   March 2, 2014, 07:40
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Lee,

This is the problem when people don't share a test case

The utility will work if you have walls in your simulation case. Check the contents of the file "constant/polyMesh/boundary". If all patches are of type "patch" or if none of the patches are of type wall, then it's only natural that you don't have non-zero values near the walls that don't exist

For example, if you run this command in the tutorial case "compressible/rhoCentralFoam/biconic25-55Run35", after the mesh has been created:
Code:
patchSummary -constant -noZero
It will tell you that the following patches are defined:
Code:
Valid fields:

patch    : cone
patch    : outlet
patch    : freestream
group    : symmetryPlane
group    : wedge

End
See, there are no "walls"

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   March 4, 2014, 22:46
Default
  #5
New Member
 
Lee
Join Date: Oct 2011
Posts: 15
Rep Power: 14
SKLee is on a distinguished road
Hi Bruno,

That's fine. It works. Thanks so much for your help.

SK
SKLee is offline   Reply With Quote

Reply


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
Solution of SOD Shock Tube Problem by using HARTEN Modified Flux TVD Scheme xue sheng Main CFD Forum 5 August 27, 2022 07:06
Mesh UDF problem kornetka Fluent UDF and Scheme Programming 4 July 25, 2013 06:54
Problem setting with chtmultiregionFoam Antonin OpenFOAM 10 April 24, 2012 09:50
Problem with Sngrad() operator skabilan OpenFOAM Bugs 6 March 24, 2009 19:00
What is the problem with the relative Flux Correction danielle OpenFOAM Running, Solving & CFD 0 November 1, 2008 23:24


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