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

Temperature dependent heat flux condition

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By crubio.abujas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2020, 15:18
Question Temperature dependent heat flux condition
  #1
New Member
 
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 15
Rep Power: 6
NBad is on a distinguished road
Hi everyone, I have a funny challange for you!

I'm performing a thermal simulation on a component using chtMultiregionFOAM and need to implement on a boundary surface of one of the solids a particular boundary condition, which is a heat flux which is dependent on the temperature of the surface itself.

In particular I need to apply on this patch the following boundary condition:
\dot{Q}'' = C_1T^2\exp\left(C_2\cdot T\right)
so that a heat flux dependent on the surface temperature is extracted from the surface itself.

I was thinking to do that with scalarCodedSource, but I don't even know from where to start, any idea??

Is it even possible to do that with the codedSource or do I need to implement from scratch a whole new boundary condition?

Thanks in advance for your replies!
NBad is offline   Reply With Quote

Old   June 15, 2020, 06:58
Default
  #2
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 9
crubio.abujas is on a distinguished road
Hi NBad,

Try with codedMixed. You didn't mention if the patch should be attached into a solid region or a fluid one, that will affect to the thermal conductivity (kappa in the code). You need the thermal conductivity because you cannot apply directly a heat flux, you need to tell a gradient of T, which is the meaningful variable, and this factor is required for conversion.

I've attached a version for a solid region. In case you want to apply it to a fluid one you may need to change the way to get the thermo property (rather use the fluid properties themselves, or use the effective ones given by the turbulent model).


Try the code and let me know if it worked for you!



Code:
    <patchName>
    {
        type            codedMixed;
        value           uniform 300;
        name            temperatureHeatFlux;
        refValue        uniform 600;       
        refGradient     uniform 0;      
        valueFraction   uniform 0;      //1 - Dirictlect ;  0 - Neumann

    code
    #{
        // Get the basic thermo properties (for solid region)
        const solidThermo& thermo =
            db().lookupObject<solidThermo>(basicThermo::dictName);


        // Get current patchi
        const label patchi = patch().index();

        // This is the temperature of current patch
        const scalarField& Tp(*this);
        
        // Constant of the equation
        const scalar C1 = 1;
        const scalar C2 = 0;

        // Calculate the values on each face of the patch
        // Note: Eq is divided by thermal conductivity to units of grad(T)
        this->refGrad() = C1*pow(Tp, 2)*pow(M_E, C2*Tp)/thermo.kappa(patchi);

        bool debug = true;  
        if (debug) {
            Info << "Evaluating temperatureHeatFlux on " << patch().name() << endl;
            Info << "temperatureHeatFlux::average(Tp)  = " << gAverage(Tp) << " K" << endl;
            Info << "temperatureHeatFlux::average(Q) = " 
                 << gAverage(this->refGrad()*thermo.kappa(patchi)) << " W/m2K"
                 << endl << endl;
        }
    #};

    codeInclude
    #{
        #include "solidThermo.H"
    #};

    codeOptions
    #{
        -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
        -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    #};

    }
parthigcar likes this.
crubio.abujas is offline   Reply With Quote

Old   December 19, 2021, 10:43
Default
  #3
New Member
 
Giacomo Quattrucci
Join Date: Mar 2021
Posts: 2
Rep Power: 0
GiaQ is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hi NBad,

Try with codedMixed. You didn't mention if the patch should be attached into a solid region or a fluid one, that will affect to the thermal conductivity (kappa in the code). You need the thermal conductivity because you cannot apply directly a heat flux, you need to tell a gradient of T, which is the meaningful variable, and this factor is required for conversion.

I've attached a version for a solid region. In case you want to apply it to a fluid one you may need to change the way to get the thermo property (rather use the fluid properties themselves, or use the effective ones given by the turbulent model).


Try the code and let me know if it worked for you!



Code:
    <patchName>
    {
        type            codedMixed;
        value           uniform 300;
        name            temperatureHeatFlux;
        refValue        uniform 600;       
        refGradient     uniform 0;      
        valueFraction   uniform 0;      //1 - Dirictlect ;  0 - Neumann

    code
    #{
        // Get the basic thermo properties (for solid region)
        const solidThermo& thermo =
            db().lookupObject<solidThermo>(basicThermo::dictName);


        // Get current patchi
        const label patchi = patch().index();

        // This is the temperature of current patch
        const scalarField& Tp(*this);
        
        // Constant of the equation
        const scalar C1 = 1;
        const scalar C2 = 0;

        // Calculate the values on each face of the patch
        // Note: Eq is divided by thermal conductivity to units of grad(T)
        this->refGrad() = C1*pow(Tp, 2)*pow(M_E, C2*Tp)/thermo.kappa(patchi);

        bool debug = true;  
        if (debug) {
            Info << "Evaluating temperatureHeatFlux on " << patch().name() << endl;
            Info << "temperatureHeatFlux::average(Tp)  = " << gAverage(Tp) << " K" << endl;
            Info << "temperatureHeatFlux::average(Q) = " 
                 << gAverage(this->refGrad()*thermo.kappa(patchi)) << " W/m2K"
                 << endl << endl;
        }
    #};

    codeInclude
    #{
        #include "solidThermo.H"
    #};

    codeOptions
    #{
        -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
        -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    #};

    }
If I just want to use dt/dx = q/kappa, should I put the refValue = 0 ?
GiaQ is offline   Reply With Quote

Old   December 20, 2021, 03:17
Default
  #4
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 9
crubio.abujas is on a distinguished road
Hi Giacomo,


As soon as you use valueFraction = 0 the refValue will be ignored so it doesn't matter which value you use.


If you need further information about what means each term you can check the info in the source code.
crubio.abujas is offline   Reply With Quote

Old   February 22, 2022, 02:31
Default
  #5
New Member
 
dhiraj
Join Date: Nov 2021
Posts: 6
Rep Power: 4
dhiraj kumar is on a distinguished road
hello everyone. I have a solar receiver in which at outer surface of the receiver i have to apply non-uniform heat flux [cosine profile - q(θ) = qnet ·
cos θ(−90 ≤ θ ≤ 90)] with radiation and convection losses to ambient. can anyone give me the idea for writing the UDF for ansys fluent for this condition. thanks !
dhiraj kumar is offline   Reply With Quote

Old   February 22, 2022, 02:57
Default Thank you!
  #6
New Member
 
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 15
Rep Power: 6
NBad is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hi NBad,

Try with codedMixed. You didn't mention if the patch should be attached into a solid region or a fluid one, that will affect to the thermal conductivity (kappa in the code). You need the thermal conductivity because you cannot apply directly a heat flux, you need to tell a gradient of T, which is the meaningful variable, and this factor is required for conversion.

I've attached a version for a solid region. In case you want to apply it to a fluid one you may need to change the way to get the thermo property (rather use the fluid properties themselves, or use the effective ones given by the turbulent model).


Try the code and let me know if it worked for you!



Code:
    <patchName>
    {
        type            codedMixed;
        value           uniform 300;
        name            temperatureHeatFlux;
        refValue        uniform 600;       
        refGradient     uniform 0;      
        valueFraction   uniform 0;      //1 - Dirictlect ;  0 - Neumann

    code
    #{
        // Get the basic thermo properties (for solid region)
        const solidThermo& thermo =
            db().lookupObject<solidThermo>(basicThermo::dictName);


        // Get current patchi
        const label patchi = patch().index();

        // This is the temperature of current patch
        const scalarField& Tp(*this);
        
        // Constant of the equation
        const scalar C1 = 1;
        const scalar C2 = 0;

        // Calculate the values on each face of the patch
        // Note: Eq is divided by thermal conductivity to units of grad(T)
        this->refGrad() = C1*pow(Tp, 2)*pow(M_E, C2*Tp)/thermo.kappa(patchi);

        bool debug = true;  
        if (debug) {
            Info << "Evaluating temperatureHeatFlux on " << patch().name() << endl;
            Info << "temperatureHeatFlux::average(Tp)  = " << gAverage(Tp) << " K" << endl;
            Info << "temperatureHeatFlux::average(Q) = " 
                 << gAverage(this->refGrad()*thermo.kappa(patchi)) << " W/m2K"
                 << endl << endl;
        }
    #};

    codeInclude
    #{
        #include "solidThermo.H"
    #};

    codeOptions
    #{
        -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
        -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    #};

    }

Thank you very much crubio!



In the end I left OpenFOAM to use some other enterprise software, since I was not able to get my simulation to converge in any way, even with simpler BC and without using this variable term.



Still, thank you for your reply, it was very interesting!!


Sincerely,

Nicoḷ.
NBad is offline   Reply With Quote

Old   February 22, 2022, 03:10
Default
  #7
New Member
 
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 15
Rep Power: 6
NBad is on a distinguished road
Quote:
Originally Posted by dhiraj kumar View Post
hello everyone. I have a solar receiver in which at outer surface of the receiver i have to apply non-uniform heat flux [cosine profile - q(θ) = qnet ·
cos θ(−90 ≤ θ ≤ 90)] with radiation and convection losses to ambient. can anyone give me the idea for writing the UDF for ansys fluent for this condition. thanks !

Hi dhiraj, I don't think this is the right thread to ask, here we are discussing about OpenFOAM which is a different software. You might want to post your question as a new thread in the blog so you can get proper help.
NBad is offline   Reply With Quote

Old   July 29, 2022, 12:02
Default
  #8
New Member
 
Marco Rosatti
Join Date: Mar 2019
Location: Argentina
Posts: 4
Rep Power: 7
Brodenson is on a distinguished road
Hi folks!
I have tested this code in my example. It is compounded by two regions, one of them solid and another one a fluid. I have implemented this boundary condition in a solid region and it compiles. I haven't verified the convergence.
Regards!
Brodenson is offline   Reply With Quote

Old   July 29, 2022, 12:05
Default
  #9
New Member
 
Marco Rosatti
Join Date: Mar 2019
Location: Argentina
Posts: 4
Rep Power: 7
Brodenson is on a distinguished road
Hi folks!
I have tested this code in my example. It is compounded by two regions, one of them solid and another one a fluid. I have implemented this boundary condition in a solid region and it compiles. I haven't verified the convergence.
Regards!

P/D:
the line that I added is the following:
-I$(LIB_SRC)/transportModels/compressible/lnInclude \

for ESI version v2112
Brodenson 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
Temperature dependent Heat flux (Peltier effect) Student3 FLUENT 8 February 4, 2021 04:13
temperature dependent heat flux on wall tjliang OpenFOAM Running, Solving & CFD 0 December 8, 2014 09:37
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 17:30
Temperature and heat flux wall boundary condition L. Hamid Main CFD Forum 3 February 22, 2014 21:10
Temperature and heat flux wall boundary condition L. Hamid FLUENT 2 February 9, 2014 23:59


All times are GMT -4. The time now is 00:54.