CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

looping over selected / marked cells

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   November 22, 2012, 05:59
Default looping over selected / marked cells
Senior Member
Join Date: Mar 2010
Location: Cape Town, SA
Posts: 155
Rep Power: 8
Jonathan is on a distinguished road
Hi everyone,

just wondering if anyone can help me with this query:

i would like to loop over a set of cells adjacent to a wall boundary - say the next 5 cells next to the wall, or if that is not possible, over a set of cells marked using the adaptation menu and some metric (say mesh iso-value).

so far i only know about looping over the whole domain and looping over various threads, which typically only include (a single layer of) wall adjacent cells.

basically, i have an expression in a UDF which i want to integrate over a finite number of cells adjacent to the wall.

many thanks and best regards in advance

 Name        : entropy_generation.c
 Author      : Jonathan Bergh
 Version     :
 Copyright   : Copyright J Bergh 2012
 Description : Ansys Fluent UDF to calculate entropy in C, Ansi-style
#include "udf.h"
#include "mem.h"

	Domain *d;
	Thread *t;

	real S_gen_tot;
	real S_gen_v;
	real S_gen_t;
	cell_t c;

	d = Get_Domain(1);
				real temperature = C_T(c,t);
				real c_d;

				real dTdx = C_T_RG(c,t)[0];
				real dTdy = C_T_RG(c,t)[1];
				real dTdz = C_T_RG(c,t)[2];
				real dudx = C_DUDX(c,t);
				real dudy = C_DUDY(c,t);
				real dudz = C_DUDZ(c,t);
				real dvdx = C_DVDX(c,t);
				real dvdy = C_DVDY(c,t);
				real dvdz = C_DVDZ(c,t);
				real dwdx = C_DWDX(c,t);
				real dwdy = C_DWDY(c,t);
				real dwdz = C_DWDZ(c,t);
				real c_k_lam = C_K_L(c,t);
				real c_mu_lam = C_MU_L(c,t);
				S_gen_t = (c_k_lam/(temperature*temperature))*((dTdx)*(dTdx) + (dTdy)*(dTdy) + (dTdz)*(dTdz));

				S_gen_v = (c_mu_lam/temperature)*(2*(dudx*dudx + dvdy*dvdy + dwdz*dwdz) + (dvdx+dudy)*(dvdx+dudy) + (dwdy + dvdz)*(dwdy + dvdz) + (dudz + dwdx)*(dudz + dwdx));

				S_gen_tot = S_gen_t + S_gen_v;

				c_d = S_gen_tot / (1.010073 * (65*65*65) / 0.040 / 300);

				C_UDMI(c,t,0) = c_d;
Jonathan is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 6 August 26, 2015 09:38
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11
snappyHexMesh aborting Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 04:23
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43

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