|
[Sponsors] |
March 28, 2014, 18:28 |
Problems with interpolating UDF
|
#1 |
New Member
anonymous
Join Date: Mar 2014
Posts: 5
Rep Power: 12 |
I'm trying to make a UDF that interpolates between values of a continuous curve defining wall temperature to evaluate the difference the interpolation makes on the solution.
Here is the working continuous UDF: Code:
#include "udf.h" #define t0 0.00288 DEFINE_PROFILE(panel_wall_7_temperature, thread, i) { face_t f; double time; begin_f_loop(f, thread) { time = CURRENT_TIME; F_PROFILE(f, thread, i) = 300.0 + 100.0 * (time / t0) - 25.0 * pow((time / t0), 3.0); } end_f_loop(f, thread) } And here is the non-working interpolating UDF for 100 time steps doing interpolation between every 4th point in time: Code:
#include "udf.h" #include <vector> #define t0 0.00288 main() { int i; double Tw4i[26]; double t4i[26]; for (i=0;i<26;i++) t4i[i]=4.0*i*t0/100; /*Assemble discretized time vector*/ for (i=0;i<26;i++) Tw4i[i]= 300.0 + 100.0*t4i[i]/t0 - 25.0*t4i[i]*t4i[i]*t4i[i]/t0/t0/t0; /*Discretized Wall Temperature vector to interpolate to*/ DEFINE_PROFILE(panel_wall_7_temperature_sub100, thread, i) { face_t f; double t; double TL; double TR; double tL; double tR; begin_f_loop(f, thread) { t = CURRENT_TIME; /*Current timestep time that FLUENT is calculating from*/ for (i=0;i<25;i++) TL=Tw4i[i]; /*Nearest Left Temperature*/ TR=Tw4i[i+1]; /*Nearest Right Temperature*/ tL=t4i[i]; /*Nearest Left time*/ tR=t4i[i+1]; /*Nearest Right time*/ if (t>=tL && t<=tR) F_PROFILE(f, thread, i) = TL + ((TR-TL)/(tR-tL))*(t-tL); /*Linear interpolation to surrounding discrete temperature values*/ } end_f_loop(f, thread) } } Error output in fluent: Copied H:\Research\Fluent\100 Timesteps\Subcycling\panel-wall-7_temperature_100_Subcycling.c to libudf\src (system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "win64\3ddp_host")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. (system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "win64\3ddp_node")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. Any idea what needs fixed for the latter? I have Visual Studio 2013 Ultimate through my school's Dreamspark program, so I don't get the 'nmake' error... Last edited by Topspin; March 30, 2014 at 16:44. |
|
March 30, 2014, 23:23 |
|
#2 |
New Member
anonymous
Join Date: Mar 2014
Posts: 5
Rep Power: 12 |
Might as well post this for anyone that stumbles upon this with the same issue:
Eliminated the 'nmake' error by launching from Net2.0 "SDK Command Prompt" Now, it seems to compile correctly. Here's my new code, I just edited it to get rid of the vector. It has to reassemble the temperature curve every timestep but that's fine. Code:
#include "udf.h" #define t0 0.00288 DEFINE_PROFILE(panel_wall_7_temperature_sub100, thread, i) { face_t f; double TL; double TR; double tL; double tR; int j; double t; begin_f_loop(f, thread) { t = CURRENT_TIME; /*Current timestep time that FLUENT is calculating from*/ for (j=0;j<25;j++){ tL=4.0*j*t0/100; /*Nearest Left time*/ tR=4.0*(j+1)*t0/100; /*Nearest Right time*/ TL=300.0 + 100.0*tL/t0 - 25.0*tL*tL*tL/t0/t0/t0; /*Nearest Left Temperature*/ TR=300.0 + 100.0*tR/t0 - 25.0*tR*tR*tR/t0/t0/t0; /*Nearest Right Temperature*/ if (t>=tL && t<=tR) F_PROFILE(f, thread, i) = TL + ((TR-TL)/(tR-tL))*(t-tL);} /*Linear interpolation to surrounding discrete temperature values*/ } end_f_loop(f, thread) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Windows Environment variables- to solve problems in compiling UDF in Fluent | Modest Cat | Fluent UDF and Scheme Programming | 39 | May 18, 2016 11:33 |
problems with UDF to set contact angle | poiuy219 | Main CFD Forum | 0 | April 30, 2009 11:43 |
DEFINE_DPM_OUTPUT macro UDF HELP | Puneet | FLUENT | 3 | November 28, 2003 11:55 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |