|
[Sponsors] |
January 7, 2019, 13:29 |
Writing first UDF
|
#1 |
New Member
Max
Join Date: Jun 2017
Posts: 21
Rep Power: 9 |
Hello All,
I need to write a UDF for monitoring a species mass fraction, which I believe should be pretty simple. However, I don't have any experience coding, so I'm hoping I can get some guidance to get started. Essentially, I have a UDS set up for a species as a certain inlet mass fraction, and I want to include a species death rate as a function of first order kinetics. I have used data to determine this correlation, along with a k constant, but I do not know how to include this in a UDF. Does anyone have any advice or resources that can point me in the right direction for someone without any coding experience? I greatly appreciate any help. |
|
January 8, 2019, 11:38 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You basically want the UDS to be removed from your volume (in a controlled way). So, essentially you want a sink.
A sink is a negative source. So look at DEFINE_SOURCE in the Fluent manual (Fluent customization Manual, section 2.3.36). |
|
January 15, 2019, 15:01 |
|
#3 |
New Member
Max
Join Date: Jun 2017
Posts: 21
Rep Power: 9 |
Thanks so much for your reply pakk. I've written some code using the DEFINE_SOURCE macro, and it's saying that I'm missing parameters for this macro. Here's what I have so far...
#include "udf.h" DEFINE_SOURCE(cell_deathrate,c,t,i) { real source; real k; k=0.0000108840 source=-k*C_UDSI(c,t,0); return source; } Basically, I want to monitor this UDS as dN/dt = -k*(local cell concentration). I thought this would do the trick to set up the first order kinetics and add a sink, but I continue to get some errors. Do you have any insight into what I may be missing? Thanks so much. |
|
January 16, 2019, 05:59 |
|
#4 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
|
||
Tags |
first order, species mass fraction, udf code |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
Writing UDF to represent drag equations | Dawood Al-Mosuli | FLUENT | 1 | April 27, 2015 06:02 |
Seek help in writing UDF | Jack Martinez | FLUENT | 9 | June 14, 2007 11:24 |
New to writing UDF | Sandilya | FLUENT | 0 | May 31, 2007 13:03 |