|
[Sponsors] |
Can you check if my attached UDF is correct?? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 27, 2010, 15:29 |
Can you check if my attached UDF is correct??
|
#1 |
Member
Sandeep
Join Date: Jul 2010
Posts: 48
Rep Power: 16 |
Hi,
I am running a multiphase simulation with VOF model which has a droplet spreading on a solid substrate. In order to account for the transient surface tension effects of added surfactant to the droplet, I have written a UDF which defines the above effect and hooked it after compiling. Now my question is that why am I getting my results as if it is having very less surface tension than the defined trend in UDF. I want to make sure if fluent is using values defined from the UDF and is there a way to create a file while the case is running about the values of surface tension being used while the case is running? I hope my question is clear and really sorry to bother you with such a lengthy question. Please look at the UDF defined below: #include "udf.h" DEFINE_PROPERTY(dyn_surf_tension, cell, thread) { double dst; double c_t = CURRENT_TIME; if (c_t >= 0 || c_t < 5.000000e-002) dst = 7.145500e-002; if (c_t >= 5.000000e-002 || c_t < 7.050000e-001) dst = 4.017570e-002; if (c_t >= 7.050000e-002 || c_t < 9.950000e-002) dst = 3.862980e-002; if (c_t >= 9.950000e-002 || c_t < 1.000000e-001) dst = 3.862690e-002; else dst = 3.862410e-002; return dst; } Thanks and Regards Sandeep K Gande |
|
December 28, 2010, 11:11 |
|
#2 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Gandesk,
If you're hooking the UDF to the surface tension property box, found under phase--->interaction, you should be OK. I've changed your "double" variable definition to "real," changed the syntax slightly, and posted below. See if it works for you: Code:
#include "udf.h" DEFINE_PROPERTY(dyn_surf_tension, cell, thread) { real dst; real c_t = CURRENT_TIME; dst = 3.862410e-002; if (c_t >= 0 && c_t < 5.000000e-002) { dst = 7.145500e-002; } if (c_t >= 5.000000e-002 && c_t < 7.050000e-001) { dst = 4.017570e-002; } if (c_t >= 7.050000e-002 && c_t < 9.950000e-002) { dst = 3.862980e-002; } if (c_t >= 9.950000e-002 && c_t < 1.000000e-001) { dst = 3.862690e-002; } return dst; } Otherwise, to check the value of UDF-controlled surface tension (or any other UDF-controlled value), simply add a user-defined memory and examine it. Steps: 1) Define--->User-Defined--->Memory. Change the number to 1 2) In the code above, add Code:
C_UDMI(cell,thread,0)=dst; 3) Run a few time steps in your simulation, stop it, then examine the contours of the User-Defined-Memory location 0 to see if the surface tension matches what you expect. ComputerGuy |
|
December 28, 2010, 19:36 |
|
#3 |
Member
Sandeep
Join Date: Jul 2010
Posts: 48
Rep Power: 16 |
Hi computerguy,
Thank you very much for your reply. It looks like the code is working good now. I will mail back you after the complete simulation. I hope it works perfectly. I have another quesion wrt define--> memory. Can we include the same code with different numbers if we use more than one udf and want to extract all those values. Thanks Sandeep |
|
December 28, 2010, 19:45 |
|
#4 |
Member
Sandeep
Join Date: Jul 2010
Posts: 48
Rep Power: 16 |
Hi computer guy,
I forgot to mention about this following thing in my previous reply. I just have the surface tension values at thoses descrete points. How can i interpolate function. I did not understand what you meant. Could u pls explain me?? Thanks Sandeep |
|
December 28, 2010, 19:46 |
|
#5 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Sandeep,
If I recall correctly, you can define up to 500 user defined memory locations. As such, if you have variables you want to track from UDF's, I find UDMI's a better way of getting the status of such variables instead of writing to console. You address them as Code:
C_UDMI(cell,thread,XXX)=your_value; Glad it's working. ComputerGuy |
|
December 28, 2010, 19:54 |
|
#6 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Sandeep,
Interpolating is simply choosing values in between your discrete points. If you were given two points which make up a line (y=m*x+b), you could figure out the equation which describes the line, and thus describe, for any value of x, the value of y. By the way, I think there is a typo in the original code, which I've propagated in my code. The actual code (I think) should be: Code:
#include "udf.h" DEFINE_PROPERTY(dyn_surf_tension, cell, thread) { real dst; real c_t = CURRENT_TIME; dst = 3.862410e-002; if (c_t >= 0 && c_t < 5.000000e-002) { dst = 7.145500e-002; } if (c_t >= 5.000000e-002 && c_t < 7.050000e-002) { dst = 4.017570e-002; } if (c_t >= 7.050000e-002 && c_t < 9.950000e-002) { dst = 3.862980e-002; } if (c_t >= 9.950000e-002 && c_t < 1.000000e-001) { dst = 3.862690e-002; } return dst; } |
|
December 28, 2010, 21:17 |
|
#7 |
Member
Sandeep
Join Date: Jul 2010
Posts: 48
Rep Power: 16 |
Computer guy,
thanks for correcting me once again and really appreciate for your inputs. I have another question running a job which has UDF s in it parallelly. When I try to run it parallelly the follwing message is popping up in the log file. Opening library "libudf"... Primitive Error at Node 0: open_udf_library: No such file or directory Could you help me what could be the reason Actuallty I am try to run on a high performance linux cluster and I have used the following qsub commands #PBS -N test21 #PBS -l walltime=90:00:00 #PBS -l nodes=4pn=4 #PBS -l software=fluent:fluentpar+16 #PBS -m abe #PBS -S /bin/bash #PBS -o /nfs/03/ucn0987/FLUENT/Test21/1.out #PBS -j oe set echo on hostname module load fluent cd /nfs/03/ucn0987/FLUENT/Test21 rm -f pnodes cat $PBS_NODEFILE | sort > pnodes export ncpus=`cat pnodes | wc -l` fluent 2ddp -t$ncpus -pinfiniband.ofed -cnf=pnodes -g < 3input Thanks Sandeep Sandeep |
|
December 29, 2010, 11:05 |
|
#8 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Sandeep,
I don't believe there's anything in the code I've written which is incompatible with parallel usage. Are you compiling or interpreting the code? The steps you should go through are: 1) Define --> User-defined --> Functions --> Compiled 2) Source files --> Add --> Your_Udf.c 3) Click "Build" 4) If there are no errors, click "Load" If you already have a libudf loaded, go to: 1) Define --> User-defined --> Functions --> Managed 2) Select libudf 3) Click unload, then repeat steps 1-4 above If your udf compiles OK, and the steps I've laid out don't throw an error, I'm not sure what the problem is. ComputerGuy |
|
March 6, 2017, 14:57 |
kindly check UDF and suggest better one
|
#9 |
New Member
invincible
Join Date: Dec 2016
Posts: 17
Rep Power: 10 |
The two UDF below are for dynamic mesh in which BODY A will move from POINT 1 to POINT 2 and then back to POINT 1, picture for that is attached here.
kindly check and tell me errors. Suggest the better one with faster speed if wrong! how can i correct it? UDF 1 #include "udf.h" DEFINE_CG_MOTION(move,dt,vel,omega,time,dtime) { vel[1] = 0.0315*sin(0.21*time); } DEFINE_CG_MOTION(ball1,dt,vel,omega,time,dtime) { if (time>0 && time<1) vel[1]=0; else if (time>1 && time<2) vel[1]=0.009; else if (time>15 && time<16) vel[1]=-0.0005; else if (time>16 && time<17) vel[1]=-0.0137; else vel[1]=-0.00; } DEFINE_CG_MOTION(ball2,dt,vel,omega,time,dtime) { if (time>0 && time<1) vel[1]=-0.005; else if (time>1 && time<16) vel[1]=0.0315*sin(0.21*time); else if (time>16 && time<17.58) vel[1]=0.007; else vel[1]=0.0315*sin(0.21*time); } UDF 2 #include "udf.h" DEFINE_CG_MOTION(move,dt,vel,omega,time,dtime) { vel[1] = 0.0942*sin(0.628*time); } DEFINE_CG_MOTION(ball1,dt,vel,omega,time,dtime) { if (time>0 && time<1) vel[1]=0.018*time; else if (time>5 && time<5.1) vel[1]=-0.0005; else if (time>5.1 && time<5.5) vel[1]=-0.035; else vel[1]=-0.00; } DEFINE_CG_MOTION(ball2,dt,vel,omega,time,dtime) { if (time>0 && time<0.4) vel[1]=-0.01; else if (time>0.4 && time<5.5) vel[1]=0.0942*sin(0.628*time); else if (time>5.5 && time<6.17) vel[1]=-0.0028; else vel[1]=0.0942*sin(0.628*time); } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to access only one phase in multiphase model by UDF | wersoe | Fluent UDF and Scheme Programming | 1 | January 4, 2017 08:11 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
UDF programming | fullmonty | FLUENT | 5 | June 30, 2011 03:40 |
Problems in compiling paraview in Suse 10.3 platform | chiven | OpenFOAM Installation | 3 | December 1, 2009 08:21 |
I need UDF help. | S.Whitney | FLUENT | 0 | October 15, 2007 12:29 |