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

Clarification on the writing for the user defined function to be imported into Fluent

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2025, 21:40
Default Clarification on the writing for the user defined function to be imported into Fluent
  #1
New Member
 
Ketan Karkare
Join Date: Feb 2024
Posts: 4
Rep Power: 3
kkarkare is on a distinguished road
Hello,

I've written a UDF to model the absorption kinetics of a metal hydride reactor. Before proceeding with my simulation, I would like to confirm the logical flow of my code, particularly the calculations for equilibrium pressure (\(P_{eq}\)) and the reaction rate.

:Background

The model is based on the modified van't Hoff equation for temperature-dependent equilibrium pressure. The reaction rate is dependent on the local temperature and the pressure ratio (\(P/P_{eq}\)). I am using a User-Defined Scalar (UDS) to track the hydrogen concentration in the hydride.

Request: Could someone please review the following snippet of my C code and confirm if the logic correctly implements these physics?

Specifically, I'd like to verify: The calculation of P_eq and the reaction rate. The correct use of Fluent macros to read temperature and pressure.The handling of the absorption condition (pressure > P_eq).

Here, the temperature will change based on the reaction, which will change the P_eq and eventually the reaction logically ends once the P_eq=Ps. So I don't know how to add a variable like temperature so that in Fluent, I will have the temperature change at each cell, which will be observed by the Simulation with the effects as well. I am not an expert in C code, more like a MATLAB guy. Please guide me through the code formatting and how to put this in Fluent for the simulation.

Thank you


Code Snippet:
Attached Files
File Type: c absorption_metal_hydride.c (2.4 KB, 4 views)
kkarkare is offline   Reply With Quote

Reply

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
../externals/cgns/hdf5/H5public.h:63:10: fatal error: mpi.h: No such file or director Mohsin1 SU2 8 November 25, 2023 04:46
Error: WorkBench Error: Could not handle event: SolutionStatusUpdate Kieyo Fluent Multiphase 0 November 10, 2022 00:58
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
[snappyHexMesh] crash sHM H25E OpenFOAM Meshing & Mesh Conversion 11 November 10, 2014 12:27
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


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