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

Source term with divergence

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2025, 22:07
Default Source term with divergence
  #1
Member
 
Rodrigo Villarreal
Join Date: Nov 2016
Posts: 42
Rep Power: 10
rodrigovime is on a distinguished road
Hello everyone,
I have to include a source term in my energy conservation equation using a UDF, but i have a divergence operator that i don't know how to include in the code. Does anyone have solved a similar problem?
The equation I need to include is:
[/math] - \nabla \cdot ((h_1-h_2)\frac{k}{c_p}\nabla Y_1)[/math]
Thanks for your help
rodrigovime is offline   Reply With Quote

Old   April 30, 2025, 21:12
Default
  #2
New Member
 
Join Date: May 2024
Posts: 3
Rep Power: 3
karam_j is on a distinguished road
Hello,
you can use Divergence/Gauss's Theorem to translate this term into fluxes through the cell faces. Basically, you do a cell face loop and calculate the flux through each face, then add these up into a single term and apply it to the cell as a source. Look out for face value interpolation wherever necessary.
karam_j is offline   Reply With Quote

Old   May 19, 2025, 17:57
Default
  #3
Member
 
Rodrigo Villarreal
Join Date: Nov 2016
Posts: 42
Rep Power: 10
rodrigovime is on a distinguished road
Thank you very much for that idea. Following it, I managed to calculate a diffusion-like term for a simple case to test my UDF with succes. Here's the UDF i wrote for 2D rectangular coordinates.
Attached Files
File Type: c diffusion_term_cartesian.c (7.5 KB, 2 views)
rodrigovime is offline   Reply With Quote

Reply

Tags
derivatives, source energy term, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MapFields utility for staggered grid saeed jamshidi OpenFOAM Running, Solving & CFD 17 January 23, 2024 11:36
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 03:50
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 16:18
fluent divergence for no reason sufjanst FLUENT 2 March 23, 2016 16:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


All times are GMT -4. The time now is 06:53.