|
[Sponsors] |
how to store UDF output for arbitrary/particular cell |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 23, 2019, 13:44 |
how to store UDF output for arbitrary/particular cell
|
#1 |
New Member
Athalia
Join Date: Sep 2019
Posts: 2
Rep Power: 0 |
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 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); 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? |
|
September 24, 2019, 06:02 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use FILE* f = fopen("file.txt", "a"); before DEFINE_EXCHANGE_PROPERTY()
if you need additional help, show your code best regards |
|
Tags |
cell value, drag coefficients, store, udf |
|
|
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 |