CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for heat and mass transfer

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By blackmask
  • 1 Post By blackmask
  • 1 Post By blackmask

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 1, 2018, 00:31
Smile UDF for heat and mass transfer
  #1
New Member
 
Akash Siddique
Join Date: Apr 2018
Posts: 10
Rep Power: 8
Akash Siddique is on a distinguished road
Hi everyone!!
I’m working on a problem related to heat and mass transfer phenomena between adsorbent material and air. When humid air passes over the adsorbent material, heat and mass transfer happen. I want to write 3simple UDF’s for inlet boundary condition for heat and mass transfer.

Equation 1 Variable Air Temperature = 1162 – (100/z),
(z = distance along axis=0.01-0.4m)

Equation 2 Variable Adsorbent Temperature = .06+ (.05/t^.19), (t=time =0-3600)

Equation 3 Variable Air Humidity Ratio = -22(41*t^.1)-.625(4/z),
(z= distance along axis, t=time)


Capture.PNG

I Hope you guys will cooperate
You can ask me for any additional information
New Email address- afzalkhangm001@gmail.com
Akash Siddique is offline   Reply With Quote

Old   September 1, 2018, 02:12
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
I look the word up in my dictionary and still do not know what cooperate means, but I will tell you how to deal with it anyway.

Code:
#include "udf.h"

real T_air(real z)
{
    return 1162.0 - 100.0/z;
}

real T_adsorbent(real t)
{
    return 0.06+0.05/pow(t, 0.19);
}

real humidity_ratio(real z, real t)
{
    return -22.0*(41.0*pow(t, 0.1))-0.625*(4.0/z);
}


DEFINE_PROFILE(inlet_T_air, thread, position)
{
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);
    face_t f;
    real r;
    real t = CURRENT_TIME;

    /* origin is a point on the axis and axis is the direction vector*/
    NV_S(origin, =, 0.0);
    NV_D(axis, =, 0.3, 0.4, 0.5);
    r = NV_MAG(axis);
    NV_VS(axis, =, axis, /, r); /* normalize to unit vector */

    begin_f_loop(f,thread)
    {
        F_CENTROID(x, f, thread);
        NV_VV(x, =, x, -, origin);
        NV_CROSS(rvec, axis, x);
        r = NV_MAG(rvec);
        F_PROFILE(f, thread, position) = T_air(r);
    }
    end_f_loop(f, thread)
}
Akash Siddique likes this.
blackmask is offline   Reply With Quote

Old   September 1, 2018, 02:35
Default
  #3
New Member
 
Akash Siddique
Join Date: Apr 2018
Posts: 10
Rep Power: 8
Akash Siddique is on a distinguished road
Quote:
Originally Posted by blackmask View Post
I look the word up in my dictionary and still do not know what cooperate means, but I will tell you how to deal with it anyway.

Code:
#include "udf.h"

real T_air(real z)
{
    return 1162.0 - 100.0/z;
}

real T_adsorbent(real t)
{
    return 0.06+0.05/pow(t, 0.19);
}

real humidity_ratio(real z, real t)
{
    return -22.0*(41.0*pow(t, 0.1))-0.625*(4.0/z);
}


DEFINE_PROFILE(inlet_T_air, thread, position)
{
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);
    face_t f;
    real r;
    real t = CURRENT_TIME;

    /* origin is a point on the axis and axis is the direction vector*/
    NV_S(origin, =, 0.0);
    NV_D(axis, =, 0.3, 0.4, 0.5);
    r = NV_MAG(axis);
    NV_VS(axis, =, axis, /, r); /* normalize to unit vector */

    begin_f_loop(f,thread)
    {
        F_CENTROID(x, f, thread);
        NV_VV(x, =, x, -, origin);
        NV_CROSS(rvec, axis, x);
        r = NV_MAG(rvec);
        F_PROFILE(f, thread, position) = T_air(r);
    }
    end_f_loop(f, thread)
}
I'm extremely thankful for your quick response and effort

but now I'm facing another difficulty. I think I need three (3) separate program for boundary condition with respect to each equation. Please make three separate programs with each equation and correct me if I'm wrong.

and thanks for the Cooperation...
Akash Siddique is offline   Reply With Quote

Old   September 1, 2018, 02:50
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Well, that is not what I expected, but, hey, why not.

Code:
#include "udf.h"

real T_air(real z, real t)
{
    return 1162.0 - 100.0/z;
}

real T_adsorbent(real z, real t)
{
    return 0.06+0.05/pow(t, 0.19);
}

real humidity_ratio(real z, real t)
{
    return -22.0*(41.0*pow(t, 0.1))-0.625*(4.0/z);
}

DEFINE_PROFILE(inlet_T_air, thread, position)
{
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);
    face_t f;
    real r;
    real t = CURRENT_TIME;

    NV_S(origin, =, 0.0);
    NV_D(axis, =, 0.3, 0.4, 0.5);
    r = NV_MAG(axis);
    NV_VS(axis, =, axis, /, r);

    begin_f_loop(f,thread)
    {
        F_CENTROID(x, f, thread);
        NV_VV(x, =, x, -, origin);
        NV_CROSS(rvec, axis, x);
        r = NV_MAG(rvec);
        F_PROFILE(f, thread, position) = T_air(r, r);
    }
    end_f_loop(f, thread)
}

DEFINE_PROFILE(inlet_T_adsorbent, thread, position)
{
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);
    face_t f;
    real r;
    real t = CURRENT_TIME;

    NV_S(origin, =, 0.0);
    NV_D(axis, =, 0.3, 0.4, 0.5);
    r = NV_MAG(axis);
    NV_VS(axis, =, axis, /, r);

    begin_f_loop(f,thread)
    {
        F_CENTROID(x, f, thread);
        NV_VV(x, =, x, -, origin);
        NV_CROSS(rvec, axis, x);
        r = NV_MAG(rvec);
        F_PROFILE(f, thread, position) = T_adsorbent(r, r);
    }
    end_f_loop(f, thread)
}


DEFINE_PROFILE(inlet_humidity_ratio, thread, position)
{
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);
    face_t f;
    real r;
    real t = CURRENT_TIME;

    NV_S(origin, =, 0.0);
    NV_D(axis, =, 0.3, 0.4, 0.5);
    r = NV_MAG(axis);
    NV_VS(axis, =, axis, /, r);

    begin_f_loop(f,thread)
    {
        F_CENTROID(x, f, thread);
        NV_VV(x, =, x, -, origin);
        NV_CROSS(rvec, axis, x);
        r = NV_MAG(rvec);
        F_PROFILE(f, thread, position) = humidity_ratio(r, r);
    }
    end_f_loop(f, thread)
}
Oula likes this.
blackmask is offline   Reply With Quote

Old   September 1, 2018, 03:07
Default
  #5
New Member
 
Akash Siddique
Join Date: Apr 2018
Posts: 10
Rep Power: 8
Akash Siddique is on a distinguished road
Quote:
Originally Posted by blackmask View Post
Well, that is not what I expected, but, hey, why not.

Code:
#include "udf.h"

real T_air(real z, real t)
{
    return 1162.0 - 100.0/z;
}

real T_adsorbent(real z, real t)
{
    return 0.06+0.05/pow(t, 0.19);
}

real humidity_ratio(real z, real t)
{
    return -22.0*(41.0*pow(t, 0.1))-0.625*(4.0/z);
}

#define MAKE_PROFILE(func) \
DEFINE_PROFILE(inlet_##func, thread, position) \
{\
    real NV_VEC(x), NV_VEC(origin), NV_VEC(axis), NV_VEC(rvec);\
    face_t f;\
    real r;\
    real t = CURRENT_TIME;\
\
    NV_S(origin, =, 0.0);\
    NV_D(axis, =, 0.3, 0.4, 0.5);\
    r = NV_MAG(axis);\
    NV_VS(axis, =, axis, /, r); \
\
    begin_f_loop(f,thread)\
    {\
        F_CENTROID(x, f, thread);\
        NV_VV(x, =, x, -, origin);\
        NV_CROSS(rvec, axis, x);\
        r = NV_MAG(rvec);\
        F_PROFILE(f, thread, position) = func(r, r);\
    }\
    end_f_loop(f, thread)\
}

MAKE_PROFILE(T_air);
MAKE_PROFILE(T_adsorbent);
MAKE_PROFILE(humidity_ratio);
As far as my understanding of Ansys fluent, three separate UDF will be hooking up in boundary condition at three separate location

one for Variable Air Temperature Boundary Condition
second for Variable Adsorbent Temperature
third for Variable Air Humidity Ratio

I'm presenting here my limited understanding of UDF.. what do you say ??
Akash Siddique is offline   Reply With Quote

Old   September 1, 2018, 03:47
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
My bad, I forget that DEFINE_PROFILE is not only a macro but also is used in an awk script to get the function name. I have edit my post.
Akash Siddique likes this.
blackmask is offline   Reply With Quote

Old   September 1, 2018, 03:51
Default
  #7
New Member
 
Akash Siddique
Join Date: Apr 2018
Posts: 10
Rep Power: 8
Akash Siddique is on a distinguished road
Quote:
Originally Posted by blackmask View Post
My bad, I forget that DEFINE_PROFILE is not only a macro but also is used in an awk script to get the function name. I have edit my post.
I appreciate your effort.

Please, can you help me understand that one program will do all the things that three separate programs were supposed to do ???
Akash Siddique 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
using define mass transfer udf for cavitation Komon Fluent UDF and Scheme Programming 14 June 21, 2016 02:50
udf source code for modelling mass transfer during film boiling vinita123 Fluent UDF and Scheme Programming 0 December 22, 2015 08:43
transient mass transfer in multiphase flow Tensian Fluent UDF and Scheme Programming 0 November 16, 2015 10:39
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28


All times are GMT -4. The time now is 19:35.