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

how to get cell value of the cell next to the f_loop face?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By torjo
  • 2 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2020, 11:41
Default how to get cell value of the cell next to the f_loop face?
  #1
Member
 
Deutschland
Join Date: Jun 2020
Location: https://t.me/pump_upp
Posts: 43
Rep Power: 6
schwaral is on a distinguished road
Send a message via ICQ to schwaral Send a message via AIM to schwaral Send a message via Yahoo to schwaral
Hi,
I figured out, that my Problem is because c_density is wrong adressed. without this line the code works fine. My problem is, that I don't know how to tell the programm, that I need the density of the cell which is attached to the face at the boundary. DEFINE_PROFILE and the begin_f_loop do not provide the cell index I guess. I tried to make a c_loop around the c_density but this didn't help.

Mybe is there a solution with pointers so you can adress the face and the cell at the same time? Unforunatley with my C++ skills I'm a bit lost here. Any Help would be nice.

DEFINE_PROFILE(massfraction_for_const_RH,thread,po sition)
{
cell_t cell;
face_t f;

double a= -5800.2206;
double T,massfraction_new;
double p_sat, c_density;

begin_f_loop(f,thread)
{
T=F_T(f,thread);

p_sat= exp(a*pow(T,-1));

c_density = C_R(cell, thread);

massfraction_new=0.7*p_sat/c_density;
F_PROFILE(f,thread,position)=massfraction_new;
end_f_loop(f,thread)
}
}
schwaral is offline   Reply With Quote

Old   August 6, 2020, 08:47
Default
  #2
New Member
 
Join Date: Apr 2018
Posts: 8
Rep Power: 8
torjo is on a distinguished road
I think you need to use

F_C0(f,thread)

and

THREAD_T0(thread)

to get the cell and thread for your call to C_R
try:

c_density = C_R(F_C0(f,thread),THREAD_T0(thread))

BR.
Torjo
schwaral likes this.
torjo is offline   Reply With Quote

Old   August 13, 2020, 14:04
Default
  #3
Member
 
Deutschland
Join Date: Jun 2020
Location: https://t.me/pump_upp
Posts: 43
Rep Power: 6
schwaral is on a distinguished road
Send a message via ICQ to schwaral Send a message via AIM to schwaral Send a message via Yahoo to schwaral
yep that was the solution thanks a lot!
schwaral is offline   Reply With Quote

Old   January 28, 2022, 18:17
Default
  #4
New Member
 
Peyman
Join Date: Jul 2021
Posts: 12
Rep Power: 5
p.norouzi.gv is on a distinguished road
Quote:
Originally Posted by schwaral View Post
Hi,
I figured out, that my Problem is because c_density is wrong adressed. without this line the code works fine. My problem is, that I don't know how to tell the programm, that I need the density of the cell which is attached to the face at the boundary. DEFINE_PROFILE and the begin_f_loop do not provide the cell index I guess. I tried to make a c_loop around the c_density but this didn't help.

Mybe is there a solution with pointers so you can adress the face and the cell at the same time? Unforunatley with my C++ skills I'm a bit lost here. Any Help would be nice.

DEFINE_PROFILE(massfraction_for_const_RH,thread,po sition)
{
cell_t cell;
face_t f;

double a= -5800.2206;
double T,massfraction_new;
double p_sat, c_density;

begin_f_loop(f,thread)
{
T=F_T(f,thread);

p_sat= exp(a*pow(T,-1));

c_density = C_R(cell, thread);

massfraction_new=0.7*p_sat/c_density;
F_PROFILE(f,thread,position)=massfraction_new;
end_f_loop(f,thread)
}
}
hi , I found out you solved the problem.
Could you please share the correct answer ?
p.norouzi.gv is offline   Reply With Quote

Old   February 2, 2022, 20:38
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"
DEFINE_PROFILE(massfraction_for_const_RH,thread,po sition)
{
cell_t cell,c0;
face_t f;
thread *t0;
real a= -5800.2206;
real T,massfraction_new;
real p_sat, c_density;

begin_f_loop(f,thread)
{
T=F_T(f,thread);
c0=F_C0(f,thread)
t0=THREAD_T0(thread)
p_sat= exp(a*pow(T,-1));
c_density = C_R(c0,t0);
massfraction_new=0.7*p_sat/c_density;
F_PROFILE(f,thread,position)=massfraction_new;
end_f_loop(f,thread)
}
}
p.norouzi.gv and snow.shaoy like this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
cell, define profile, face, loop, udf


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
[blockMesh] edges not aligned with or perpendicular to non-empty directions ynos OpenFOAM Meshing & Mesh Conversion 6 March 26, 2020 16:02
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 15:07
Get cell coordinates and value at the lower face of the cell troymcfont Fluent UDF and Scheme Programming 0 April 27, 2015 07:28
[snappyHexMesh] SnappyHexMesh error: "expected but found" ... "readSTLASCII.L" Rovs OpenFOAM Meshing & Mesh Conversion 4 December 8, 2014 06:32
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56


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