|
[Sponsors] |
December 19, 2011, 09:56 |
UDF-reference to a different thread
|
#1 |
Senior Member
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 16 |
Hi everybody,
I have to create a UDF for a wall: in particular the wall temperature must depend on the temperature of a point not next to the boundary (in this point there's a temperature sensor and the wall temperature changes thanks to a feedback) I don't now how to create the thread, in the UDF, referring to this point (so that I can use C_T function...) I should have, in the end, two threads in my UDF: the one belonging to the boundary (declared in DEFINE_PROFILE) and this new thread... Some suggestions? (excuse for my bad english) Last edited by Bionico; December 19, 2011 at 10:56. |
|
December 19, 2011, 13:13 |
|
#2 | |
Senior Member
|
Quote:
you can easily separate your desired volume which encompasses the sensor with this procedure: 1) Adapt->region ..... (define your volume as small as possible which contains the sensor location) 2) grid ->separate-> cells ..... (separate the selected volume) 3) define-> boundary condition ..... (find its ID) 4) if this volume contains more than 1 cell, do proper consideration in UDF such as finding average of properties in this volume and then use it as sensor variable... 5) Enjoy! Bests,
__________________
Amir |
||
December 20, 2011, 05:20 |
|
#3 |
Senior Member
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 16 |
Thank you very much, Amir
I haven't tried your solution yet because I would prefer one independent on the mesh I have written this UDF, but it doesn't work Code:
DEFINE_ADJUST(tsensor,domain) { real trif_coordinate[ND_ND]; real trif; real xmin; real xmax; real ymin; real ymax; real zmin; real zmax; real x,y,z,nt; cell_t c; Domain *d; Thread *t; d = Get_Domain(1); xmin=-1.940; xmax=-1.860; ymin=-1.040; ymax=-0.960; zmin=1.360; zmax=1.440; thread_loop_c(t,d) { nt=0.0; begin_c_loop(c,t) { C_CENTROID(trif_coordinate,c,t); x=trif_coordinate[0]; y=trif_coordinate[1]; z=trif_coordinate[2]; if ((x >= xmin) && (x <= xmax)) { if ((y >= ymin) && (y <= ymax)) { if ((z >= zmin) && (z <= zmax)) { trif=trif + C_T(c,t); nt=nt+1.0; } } } } end_c_loop(c,t) } trif=trif/nt; } DEFINE_PROFILE(twall, thread, position) { real trif; real tlimit; face_t f; tlimit=291.65; if (trif>tlimit) begin_f_loop(f,thread) { F_PROFILE(f, thread, position) = 291.15-(trif-291.15); } end_f_loop(f, thread) else begin_f_loop(f,thread) { F_PROFILE(f, thread, position) = 291.15; } end_f_loop(f, thread) } wall temperature doesn't decrease even if trif>tlimit maybe in DEFINE_PROFILE trif isn't the one defined in the previuos function (DEFINE_ADJUST)? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Second Derivative Zero - Boundary Condition | fu-ki-pa | OpenFOAM | 11 | March 27, 2021 05:28 |
It would be wonderful if a tool for FoamToTecplot is available | luckyluke | OpenFOAM Post-Processing | 165 | November 27, 2012 07:54 |
How to Reference an Adjacent Cell in a UDF ? | jeff8541 | FLUENT | 0 | March 8, 2011 11:33 |
Installing OpenFOAM-1.5-dev on a cluster | ZKM | OpenFOAM Installation | 4 | December 25, 2010 16:59 |
Windows Installation BugsComments on Petrbs patch | brooksmoses | OpenFOAM Installation | 48 | April 16, 2006 01:20 |