CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Trouble: Sandia UV UDF on FLUENT 12.0.16 (https://www.cfd-online.com/Forums/fluent-udf/76388-trouble-sandia-uv-udf-fluent-12-0-16-a.html)

RPJones May 24, 2010 16:22

Trouble: Sandia UV UDF on FLUENT 12.0.16
 
I am trying to us a UV Dose UDF available from Sandia National Labs.

http://www.sandia.gov/cfd-water/uvdisinfection.htm

But it does not appear to be working right. The UDF is supposed to allow me to output a custom particle variable, in this case UV Dose, through the Reports->Discrete->Sample function. When I try to do this only a header line is produced, but no numbers are filled in.

Outside of the reporting problem, the UDF appears to work. I am able to view particle tracks colored by the user defined dose. Although I belive I could possibly output data from the particle track portion, having the data in the DPM form would be ideal for post processing.

The UDF is provided with a shared library. If I try to rebuild the library, with changes to the source files, I get the following:

for d in lnx86/[23]*; do \
( \
cd $d; \
for f in ../../src/*.[ch] ../../src/makefile; do \
if [ ! -f `basename $f` ]; then \
echo "# linking to" $f "in" $d; \
ln -s $f .; \
fi; \
done; \
echo ""; \
echo "# building library in" $d; \
if [ "" = "1" ]; then \
echo "# using gcc64"; \
make ARCHC=gcc64 -k>makelog 2>&1; \
else \
if [ "" = "1" ]; then \
echo "# using gcc"; \
make ARCHC=gcc -k>makelog 2>&1; \
else \
make -k>makelog 2>&1; \
fi; \
fi;\
cat makelog; \
) \
done

# building library in lnx86/3d
make[1]: Entering directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'
make[1]: Circular udf_names.c <- udf_names.c dependency dropped.
make[2]: Entering directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'
make libudf.so "CFLAGS=-fpic -shared -ansi -Wall -m32 -O " "LDFLAGS=-shared -lm -m elf_i386"
make[3]: Entering directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'
make[3]: Circular udf_names.c <- udf_names.c dependency dropped.
# Compiling udf_names.o because of udf_names.c
cc -fpic -shared -ansi -Wall -m32 -O -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/cortex/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/client/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/tgrid/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/multiport/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/multiport/mpi_wrapper/include -I. -c udf_names.c
# Compiling uvdose_par_6326.o because of uvdose_par_6326.c
cc -fpic -shared -ansi -Wall -m32 -O -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/cortex/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/client/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/tgrid/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/multiport/src -I/usr/local/ansys_inc/v120/fluent/fluent12.0.16/multiport/mpi_wrapper/include -I. -c uvdose_par_6326.c
uvdose_par_6326.c: In function ‘uv_dosage’:
uvdose_par_6326.c:16: warning: unused variable ‘c’
# Linking libudf.so because of makefile udf_names.c udf_names.o uvdose_par_6326.o
ld -shared -lm -m elf_i386 udf_names.o udf_names.o uvdose_par_6326.o -o libudf.so
udf_names.o: In function `UDF_Inquire_Release':
udf_names.c: (.text+0x0): multiple definition of `UDF_Inquire_Release'
udf_names.o:udf_names.c: (.text+0x0): first defined here
udf_names.o: (.data.rel+0x0): multiple definition of `udf_data'
udf_names.o: (.data.rel+0x0): first defined here
udf_names.o: (.data+0x0): multiple definition of `n_udf_data'
udf_names.o: (.data+0x0): first defined here
make[3]: *** [libudf.so] Error 1
make[3]: Leaving directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'
make[2]: *** [lnx86] Error 2
make[2]: Leaving directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home4/rjones/UVFlowSim/MSWork/libudf/lnx86/3d'

The system I am workin with is the following:

Linux box running RedHat
X86 chip
FLUENT 12.0.16 Serial
3D, pbns, vof, ske

Thanks for any help that you can provide. I'm sure I'm missed showing some helpful, important information, so let me know and I'll add whatever helps.

Ryan

novice June 9, 2010 07:43

Hi
You said u r using the VOF model so please check whether the UDF is for multiphase or only for single phase.

Regards

banerji June 24, 2010 18:21

Sandia UDF for UV dose calculations
 
Hi Jones,

I also used Sandia UDF to calculate UV dose on Fluent 6.2.36 successfully and when I switched the same Fluent version you are using I am having trouble. I was advised to remove old libraries and build again but the outlet.dpm is empty ...did you manage to make it work? are you using Unix-version or Windows?

novice July 1, 2010 09:56

Hi Banerji and Jones,

May I ask u in which application u are calculating the UV doses. Is it in some food processing industry or Water purification etc.

Best Regards

banerji July 1, 2010 12:38

My application is for water purification

banerji July 3, 2010 18:54

Novice

do you by chance used fluent 12.1 version?

novice July 12, 2010 06:06

Hi Banerji
I haven't used the FLUENT 12.1 version yet? May i know y r u asking this?
One more question: may i know in which company (which country) u r working. I'm also in the same industry working in Germany.

Regards

banerji July 20, 2010 16:01

Novice, sorry to reply late. It is a Phd research at a US university.

I also solved the problem, my UDF was not compiling because my MS windows SDKs were old and I had to reiinstall Microsoft VS.

Thanks guys for shearing knowledge.

banerji July 20, 2010 16:12

Novice, your other question I forgot to answer was why I was asking whether you use Fluent 12. it is because I was thinking to send my code to someone using this version and compile it, then send to me a compiled folder for me to upload. this could have shown me quickly that the problem was the compiler and SDKs issues.

lauripar August 2, 2010 04:55

Hi all. I'm also calculating dose with Sandia UDF for UV dose calculations, but when I'm loading the UDF I get this error message:

open_udf_library: %1 is not a valid Win32 application

I'm using Fluent 12.1. what should I do to get it work?

banerji August 5, 2010 12:28

lauripar..sorry to reply late..but if you have not got it..

did you build your UDF before you load it? if not ..try copying only the C-file from libduf put it in the same folder with your case file then at the window you load compiled UDFs , go to add and search for the C-file and click build and then load. Hope this helps

lauripar August 6, 2010 01:29

Thanks for your reply Benerji... I tried your instructions but when I did so I got the following error message:

Error: open_udf_library: The system cannot find the file specified.

If you know what to do now, I would be clad to hear it. Thank you for helping.

lauripar August 6, 2010 01:42

When I looked at the log file at ...dp0\FFF\Fluent\libudf\win64\3d, there was following message:

NMAKE : U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.EXE"' : return code '0xc0000135'
Stop.

If some one has an answer what to do next, I would appreciate it.

banerji August 7, 2010 12:34

Lauripar: what I can see.. you have the compiling error..
so there are many things you have to check that take part in compilation.
1) make sure when you compile there is no any other folder or file in the folder where you put the case file and the C-file(i think the sandia C-file is named demand) .
2) check whether once you click on build there is any libduf folder created if not.. you might be getting NMAKE Error related to the compiler issues.
3) NMAKe errors might be due to the compiler. so check whether visual studio is installed and the environment are set properly.

lauripar August 9, 2010 02:43

Hi, I Started Fluent from SDK command promt and I had only demand2.c and case file in the folder. But when I built the library I got the following message and error:

> 1 file(s) copied.
(system "copy "C:\PROGRA~1\ANSYSI~1\v121\fluent"\fluent12.1.4\sr c\makefile_nt.udf libudf\win64\3d\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\3d")()
# Generating ud_io1.h
demand2.c
c:\program files\ansys inc\v121\fluent\fluent12.1.4\src\config.h(110) : error C2143: syntax error : missing '{' before ':'
c:\program files\ansys inc\v121\fluent\fluent12.1.4\src\config.h(110) : error C2059: syntax error : ':'
C:\PROGRA~1\ANSYSI~1\v121\fluent\fluent12.1.4\cort ex\src\dll.h(68) : error C2061: syntax error : identifier 'CX_DLL_GetProc'
C:\PROGRA~1\ANSYSI~1\v121\fluent\fluent12.1.4\cort ex\src\dll.h(68) : error C2059: syntax error : ';'
C:\PROGRA~1\ANSYSI~1\v121\fluent\fluent12.1.4\cort ex\src\dll.h(68) : error C2059: syntax error : 'type'

Banerji have you encountered this kind of problem or du you know what to do next?

banerji August 9, 2010 14:04

I also had many compilation issues when I switched from fluent 6 to fluent 12. Well looking at your errors they suggest error in Fluent header files which is strange. But as I can see it got errors when building ud_i01. I remember at this stage the error was it can't find kernel.dll file and I read online that my MS SDKs might not be up to date and when I checked in program files (C:\Program Files\Microsoft SDKs\Windows\v6.1) here before I had v5.0 which was the issue. so, check also here whether you have V6.

lauripar August 10, 2010 02:27

I checked my SDK and it is v7.1. I have windows 7 and 64 bit system, could some my problems be related to that?

banerji August 10, 2010 16:02

to know where the problem exactly is, I would suggest you first to check whether your C compiling system works properly by writting a basic C code (Hello world), compile it, if it works then you would move to Fluent to see why it is not compiling properly.

if you have not programed with C there are tutorials to do the Hello world in C if you google or search it on youtube.

lauripar August 11, 2010 06:19

I was able to compile. The Problem was that I didn't check the box "Visual c++ compilers" when I installed the SDK 7.1, when I reinstalled SDK and checked that box it solved my problem.

Actually there was line complaining about x64 compliers in the SDK command promt window before I reinstalled SDK and checked that box. I didn't notice it earlier, how stupid...

Thanks Banerji for your help!

zhang.limin January 26, 2011 14:50

Sandia UDF file is worked
 
Hi
I am doing CFD UV disinfection simulation in a company in Canada, I tried this file, It is working very well, I think that you may forget the series or parallel complying; second, you should inject particles by file injection or surface injection, using report samples to capture the output file using DPM.


All times are GMT -4. The time now is 00:14.