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

Problem with snGrad() for heat flux.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 13, 2014, 06:11
Default Problem with snGrad() for heat flux.
  #1
New Member
 
Lee
Join Date: Oct 2011
Posts: 12
Rep Power: 5
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, 14:01
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 10:09
Default
  #3
New Member
 
Lee
Join Date: Oct 2011
Posts: 12
Rep Power: 5
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 08:20. Reason: Added [CODE][/CODE]
SKLee is offline   Reply With Quote

Old   March 2, 2014, 08:40
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 23:46
Default
  #5
New Member
 
Lee
Join Date: Oct 2011
Posts: 12
Rep Power: 5
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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mesh UDF problem kornetka Fluent UDF and Scheme Programming 4 July 25, 2013 06:54
Solution of SOD Shock Tube Problem by using HARTEN Modified Flux TVD Scheme xue sheng Main CFD Forum 4 December 13, 2012 06:11
Problem setting with chtmultiregionFoam Antonin OpenFOAM 10 April 24, 2012 09:50
Problem with Sngrad() operator skabilan OpenFOAM Bugs 6 March 24, 2009 20:00
What is the problem with the relative Flux Correction danielle OpenFOAM Running, Solving & CFD 0 November 2, 2008 00:24


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