CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF works in 2D but not in 3D? Suggestions? (https://www.cfd-online.com/Forums/fluent/40107-udf-works-2d-but-not-3d-suggestions.html)

Brian March 13, 2006 11:36

UDF works in 2D but not in 3D? Suggestions?
 
I have a simple UDF to simulate sloshing of a tank. It works in 2D but not 3D. Anyone know why? I can't seem to find any documentation on 3D and UDF's. The UDF is below as a source term that I use in the BC's to the momentum eqn.

#include "udf.h"

#define period 1.689

#define amplitude 0.005

DEFINE_SOURCE(cell_x_source, cell, thread, dS, eqn) {

real source;

source =(-1.0*amplitude)*pow((2.0*M_PI/period),2.0)*C_R(cell,thread)*sin((2.0*M_PI/period)*CURRENT_TIME);

dS[eqn] = 0.0;

return source; }


kharicha March 14, 2006 08:11

Re: UDF works in 2D but not in 3D? Suggestions?
 
M_PI and CURRENT_TIME seem to not have been defined.... I assume you did it in your code....so ?

what do you mean by not working ? no compilling or not converging calculation ?

Brian March 14, 2006 08:34

Re: UDF works in 2D but not in 3D? Suggestions?
 
M_PI and CURRENT_TIME don't need to be defined. These are internal to the code. I use this as an interpreted UDF in 2D and it works (interprets, runs, etc...) fine. However, once I go to 3D the code crashes. It still interprets but I get an ACCESS_VIOLATION error when I try to run it.

kharicha March 14, 2006 09:13

Re: UDF works in 2D but not in 3D? Suggestions?
 
try to compile it, see if it is ok ? do you have an define adjust in your code ?

Brian March 14, 2006 11:34

Re: UDF works in 2D but not in 3D? Suggestions?
 
I don't have a c-compiler yet which is why I've been using the interpreted version. That shouldn't make a difference, should it? Also, I don't have a define adjust in my code. The only thing I do is use the UDF as a source term for the x-momentum equation.

kharicha March 14, 2006 11:45

Re: UDF works in 2D but not in 3D? Suggestions?
 
I suggest to start calculation without your udf, for some time steps...then activate the udf..and see if it works...

Brian March 14, 2006 13:26

Re: UDF works in 2D but not in 3D? Suggestions?
 
I've tried that already too. :)

kharicha March 15, 2006 02:29

Re: UDF works in 2D but not in 3D? Suggestions?
 
So without UDF the calculation work without bugs....mhh...

Try with replacing M_PI and CURRENT_TIME with constant numbers....


All times are GMT -4. The time now is 23:10.