|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Josh
Join Date: May 2019
Posts: 16
Rep Power: 8 ![]() |
Hi everyone,
I have a txt document like this: time velocity 0 0 0.1 1.3 0.2 1.7 0.3 2.5 ..and so on. My dataset unfortunately is not so easy, in fact I have a periodic function that has a pretty irregular velocity in time. The problem is that I have to impose this velocity as a UDF on a wall of my domain but I cannot find a function to properly fits those data. So my question: is there a way to write a UDF to read this dataset to impose the value of velocity for the timestep? Thanks |
|
|
|
|
|
|
|
|
#2 |
|
Member
Join Date: Jun 2017
Posts: 43
Rep Power: 10 ![]() |
You need to load your data into a C array and use a search function to get them.
|
|
|
|
|
|
|
|
|
#3 |
|
New Member
Josh
Join Date: May 2019
Posts: 16
Rep Power: 8 ![]() |
||
|
|
|
|
|
|
|
#4 |
|
Member
Join Date: Jun 2017
Posts: 43
Rep Power: 10 ![]() |
||
|
|
|
|
|
|
|
#5 | |
|
New Member
Josh
Join Date: May 2019
Posts: 16
Rep Power: 8 ![]() |
Quote:
The problem is to write in the udf language. I have the udf manual but I cannot do it... |
||
|
|
|
||
|
|
|
#6 |
|
Member
Join Date: Jun 2017
Posts: 43
Rep Power: 10 ![]() |
You should be aware that UDF is a C code in which you load the udf header to access some of the Fluent utilities.
What I want to say is that that you can write a dummy C function which reads your file and transfers the values to a global defined array: Code:
#include "udf.h"
double** data;
void build_table()
{
// code to allocate data from file to the variable "data"
}
Code:
DEFINE_ON_DEMAND(read_file)
{
build_table();
}
This creates you an "execute on demand" function that allows the remaining part of your code to read the values in the array. |
|
|
|
|
|
![]() |
| Tags |
| udf, udf and programming, udf code, udf customize |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UDF to read transient data | hemmt | Fluent UDF and Scheme Programming | 0 | January 11, 2017 01:51 |
| UDF DPM_BC with F_UDMI not storing data | balki | Fluent UDF and Scheme Programming | 3 | June 6, 2016 23:10 |
| 999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 | UDS_rambler | FLUENT | 2 | November 22, 2011 10:46 |
| Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 15:37 |
| UDF to read and write data | Mcgregor | FLUENT | 4 | June 9, 2003 14:21 |