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

how to store UDF output for arbitrary/particular cell

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2019, 13:44
Question how to store UDF output for arbitrary/particular cell
  #1
New Member
 
Athalia
Join Date: Sep 2019
Posts: 2
Rep Power: 0
athalia is on a distinguished road
Hello,

as part of my master thesis, I'm trying new drag models on a cold flow laboratory circulating fluidized bed. [Multiphase, Eulerian, transient]

So far I have a written a UDF to calculate the drag coefficient ["DEFINE_EXCHANGE_PROPERTY()"].

I want to store the drag coefficient, calculated by the UDF, for an arbitrary or a particular cell at the end of each Iteration or timestep.

What I've tried so far:

1.
Code:
if(cell == 1000){
	Message("%g \n", drag_coeff);
	 }
I don't know, where this cell=1000 is, which is okay for now.

(I tried to find a particular cell by defining a monitoring point and then in
report definition > Facet Average > Cell Info > Cell Id > mixture
retrieved the cell Id for this point. But I'm not sure if I can use it in UDF to address this particular cell)

The problem is that first I'm simulating on a cluster with 24 processors, so have many duplicates. Second, these lines are printed in between of residual reports after each iteration in the journal file. After 10,000 x 30=Iterations, the journal file is HUGE and practically not readable...

2.
Code:
FILE* f = fopen("file.txt", "a");
  
	if(cell == 1000){
	fprintf(f,"%g \n", drag_coeff);
	 }
  
	 fclose (f);
Here I have the same problem with duplicates because of 24 processors but the main problem is that the simulation becomes SOO SLOOOOOW...
I've seen a suggestion that opening and writing with EXECUTE_ON_DEMAND and EXECUTE_AT_END will stop the simulation from slowing down. But I'm not sure how to write the code. If that's true, I'll be grateful, if someone could help me out.

I'm pretty sure, defining monitoring point and using report definition won't work in my case...?Correct me if I'm wrong.
Are UDMI, UDS or Schemes an option?
athalia is offline   Reply With Quote

Old   September 24, 2019, 06:02
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
use FILE* f = fopen("file.txt", "a"); before DEFINE_EXCHANGE_PROPERTY()

if you need additional help, show your code

best regards
AlexanderZ is offline   Reply With Quote

Reply

Tags
cell value, drag coefficients, store, 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
[swak4Foam] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 13:08
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
Fluent UDF wrong number of cells in parallel - correct in serial dralexpe Fluent UDF and Scheme Programming 7 May 17, 2018 09:26
Using UDF in fuel cell addon module qwe2077 FLUENT 5 February 12, 2015 04:25
Help with DPM UDF for OUTPUT needed Zhengcai Ye FLUENT 0 January 5, 2004 17:58


All times are GMT -4. The time now is 02:45.