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

How to connect values between two separate walls

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2019, 14:39
Question How to connect values between two separate walls
  #1
New Member
 
Join Date: Jan 2019
Posts: 3
Rep Power: 7
lrodrigues is on a distinguished road
Let's say I have a 2D problem where two solid domains are separated by a fluid domain. (solid 1|fluid|solid 2). Solid 1 has heat generation, and all heat generated goes through the left wall (zero wall flux at the solid-liquid interface).

How can I make the right wall of solid 2 have the same values of the wall in solid 1 that "collects" the heat? Would an UDF with DEFINE_ADJUST be the best solution? Any thoughts?

Thanks in advance!
lrodrigues is offline   Reply With Quote

Old   January 24, 2019, 20:24
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by lrodrigues View Post
Let's say I have a 2D problem where two solid domains are separated by a fluid domain. (solid 1|fluid|solid 2). Solid 1 has heat generation, and all heat generated goes through the left wall (zero wall flux at the solid-liquid interface).

How can I make the right wall of solid 2 have the same values of the wall in solid 1 that "collects" the heat? Would an UDF with DEFINE_ADJUST be the best solution? Any thoughts?

Thanks in advance!
You can use DEFINE_ADJUST to compute the heat value on solid 1 left wall, then use DEFINE_PROFILE to set solid 2 right wall's heat flux same as that. Below is an example to compute the heat flux on each facet of solid 1 left left wall.


Thread *t=Lookup_Thread(domain,left_wall_id);
face_t f;
real A[ND_ND];
begin_f_loop(f,t)
{
F_AREA(A,f,t);
Message("Wall_Heat_Flux=%f W/m2\n",BOUNDARY_HEAT_FLUX(f,t)/NV_MAG(A));
}
end_f_loop(f,t)
gearboy is offline   Reply With Quote

Old   January 25, 2019, 05:24
Default
  #3
New Member
 
Join Date: Jan 2019
Posts: 3
Rep Power: 7
lrodrigues is on a distinguished road
Quote:
Originally Posted by gearboy View Post
You can use DEFINE_ADJUST to compute the heat value on solid 1 left wall, then use DEFINE_PROFILE to set solid 2 right wall's heat flux same as that. Below is an example to compute the heat flux on each facet of solid 1 left left wall.


Thread *t=Lookup_Thread(domain,left_wall_id);
face_t f;
real A[ND_ND];
begin_f_loop(f,t)
{
F_AREA(A,f,t);
Message("Wall_Heat_Flux=%f W/m2\n",BOUNDARY_HEAT_FLUX(f,t)/NV_MAG(A));
}
end_f_loop(f,t)

That makes sense! Thanks for your help, I'll give it a try!
lrodrigues is offline   Reply With Quote

Old   January 28, 2019, 10:36
Default
  #4
New Member
 
Join Date: Jan 2019
Posts: 3
Rep Power: 7
lrodrigues is on a distinguished road
So, after spending some time trying to make it work, it seems something is still wrong.

Here's the code used. Two notes:
First, for convenient reasons, I'm interpreting the UDF instead of compiling it. As soon as I get it running I intend to compile it. From my understandings, in this case there shouldn't be a difference between compiled/interpreted other than the line written as a comment.
Second, as I'm using a mesh in the nm range, the source value needs to be high so that there is an increase in temperature (By running only the DEFINE_SOURCE, the solid increases around 8 K, so the issue isn't here)


#include "udf.h"

real wall_flux_value;

DEFINE_SOURCE(Heat_generation, c, t, dS, eqn)
{
real x[ND_ND];
real y;
real source;

C_CENTROID(x, c, t);
y = x[0];
source = 5e24*y;
dS[eqn] = 0.0;
return source;
}

DEFINE_ADJUST(Heat_Flux_LeftWall, d)
{
Thread *t = Lookup_Thread(d, 13);
face_t f;
real A[ND_ND];
begin_f_loop(f, t)
{
F_AREA(A, f, t);
/* Message("Wall_Heat_Flux=%f W/m2\n", BOUNDARY_HEAT_FLUX(f, t) / NV_MAG(A)); - This line of code doesn't work in interpreted UDF's */
wall_flux_value =+ BOUNDARY_HEAT_FLUX(f, t) / NV_MAG(A);
}
end_f_loop(f, t)
}

DEFINE_PROFILE(Heat_Flux_RightWall, t, i)
{
face_t f;

begin_f_loop(f, t)
{
F_PROFILE(f, t, i) = wall_flux_value;
}
end_f_loop(f,t)
}


When running the case with the UDF, there's no increase in temperature in solid 2. My guess is that the issue must be between storing the value from the DEFINE_ADJUST and using it in the DEFINE_PROFILE. How how I go about doing such? Would an UDM be the right way to go about solving this?

PS: Sorry if it is obvious, but i'm still new to writing UDF's and the whole C language :P
lrodrigues 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
Pressure boundaries at walls? Compressible Navier-Stokes 2D, Cavity problem. antoniojr Main CFD Forum 15 March 22, 2017 17:01
k-w SST freestream values for w hazari.aaquib Main CFD Forum 4 March 18, 2016 04:29
SIMPLE algorithm does not converge when using old pressure (correction) values andreasp Main CFD Forum 3 February 9, 2016 21:18
Boundary-adapt refinement with interior "dummy" walls thomas. FLUENT 0 July 27, 2015 10:10
Velocity values are normal but pressure values are too big rv82 OpenFOAM Running, Solving & CFD 4 April 13, 2015 03:59


All times are GMT -4. The time now is 23:16.