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 Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By torjo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2020, 10:41
Default how to get cell value of the cell next to the f_loop face?
  #1
Member
 
Deutschland
Join Date: Jun 2020
Posts: 43
Rep Power: 3
schwaral is on a distinguished road
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, 07:47
Default
  #2
New Member
 
Join Date: Apr 2018
Posts: 6
Rep Power: 5
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, 13:04
Default
  #3
Member
 
Deutschland
Join Date: Jun 2020
Posts: 43
Rep Power: 3
schwaral is on a distinguished road
yep that was the solution thanks a lot!
schwaral is offline   Reply With Quote

Reply

Tags
cell, define profile, face, loop, udf

Thread Tools Search this Thread
Search this Thread:

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


All times are GMT -4. The time now is 15:43.