|
[Sponsors] |
how to get cell value of the cell next to the f_loop face? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
|
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) } } |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Join Date: Apr 2018
Posts: 8
Rep Power: 8 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
|
yep that was the solution
![]() |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
New Member
Peyman
Join Date: Jul 2021
Posts: 12
Rep Power: 5 ![]() |
Quote:
Could you please share the correct answer ? |
||
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
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) } }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
![]() |
![]() |
![]() |
Tags |
cell, define profile, face, loop, udf |
|
|
![]() |
||||
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 |