CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Elliptic equation UDF (https://www.cfd-online.com/Forums/fluent/35884-elliptic-equation-udf.html)

dieter February 28, 2005 10:45

Elliptic equation UDF
 
Hi,

Has anyone ever implemented in fluent an elliptic differential equation (helmholtz) of the form: a*LAPLACIAN(phi)=phi-1, with phi the scalar field that has to be resolved and a a constant? I tried to program it in a UDF using User defined scalars (UDS), but it didn't work. the solution is not stable (as I expected). does anyone knows a better implementation? Could anyone help me? its urgent!

this is how I programmed it now:

in the ADJUST function:

C_UDSI(c,t,F)=MAX(MIN(C_UDSI(c,t,F),const_1),const _2);

C_UDSI(c,t,DFDX) = C_UDSI_G(c,t,F)[0]; /*with this you can calculate the derivative of an UDS, [0] denotes the x-component*/ C_UDSI(c,t,DFDY) = C_UDSI_G(c,t,F)[1]; C_UDSI(c,t,DFDZ) = C_UDSI_G(c,t,F)[2]; C_UDSI(c,t,D2FDX2) = C_UDSI_G(c,t,DFDX)[0]; C_UDSI(c,t,D2FDY2) = C_UDSI_G(c,t,DFDY)[1]; C_UDSI(c,t,D2FDZ2) = C_UDSI_G(c,t,DFDZ)[2];

C_UDSI(c,t,F) =a*(C_UDSI(c,t,D2FDX2)+ C_UDSI(c,t,D2FDY2)+ C_UDSI(c,t,D2FDZ2))+1.;

thanks for your help Dieter

mcfiggis March 7, 2005 05:28

Re: Elliptic equation UDF
 
I think you've mistaken Fluent for Mathcad. To solve this equation:

1. Turn off the convective flux. 2. Set the diffusivity of the scalar to a. 3. Set the source term for the UDS to C_UDSI(c,ct,0)-1, which you'll have to linearise: dS[eqn] = 1.

All these things can be found in the UDF manual.



All times are GMT -4. The time now is 06:15.