|
[Sponsors] |
Source Term - UDF Parse error (but simulation seems to work) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 5, 2015, 04:11 |
Source Term - UDF Parse error (but simulation seems to work)
|
#1 |
New Member
Lamboram
Join Date: Jul 2011
Location: Munich
Posts: 16
Rep Power: 15 |
Hello all,
this is the code I used for my source term heat generation. When I try to interpret it in Fluent. I get Parse error (line 3). But then I simulated it, the results are sensible and converged. What could be possibly wrong here. #include "udf.h" DEFINE_SOURCE(heat_source,cell,thread,dS,eqn) { real source; real time; source = 0.0; time = CURRENT_TIME; if (time >= 0 && time <= 10) source = 129639.04; else if (time >= 11 && time <= 50) source = 56939.5; else if (time >= 51 && time <= 1140) source = 21606.5; else if (time > 1140) source = 14234.87; else source = 0.0; return source; } Cheers, Ram |
|
October 5, 2015, 08:18 |
|
#2 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
If possible avoid the use of interpreted UDFs. The compiled UDF is more "safe".
|
|
October 6, 2015, 12:07 |
|
#3 |
Senior Member
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21 |
||
October 8, 2015, 07:55 |
|
#4 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
|
||
October 8, 2015, 09:06 |
|
#5 |
Senior Member
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21 |
Ok, but those just say that compiling a UDF is more efficient, both in speed and memory usage. There is nothing there about it being "safer".
Also, some of the points are a bit misleading. For instance, compiled UDFs also take up computer memory once they're loaded. And interpreted UDFs also create code that is shared with the solver. Compiled UDFs are overall better, but interpreted are great for quick tests or when you don't have a compiler installed. One very good thing about interpreted UDFs in the past was that if wanted your code ready to run on every machine you had to re-compile it several times: win/linux, 32/64 bits, 2d/3d, single/double precision, serial/parallel. But with 16.0 compiling is as easy (and free!) in Windows as it is in Linux. Fluent will also auto-compile your UDF as needed, so no more of those multiple compilers. Cheers. |
|
Tags |
compiled, fluent, heat generation, source term, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 11:59 |
ATTENTION! Reliability problems in CFX 5.7 | Joseph | CFX | 14 | April 20, 2010 16:45 |
UDF Source Term Units? | Brian | FLUENT | 1 | October 24, 2005 10:15 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |