CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF : derivate of density (http://www.cfd-online.com/Forums/fluent/28183-udf-derivate-density.html)

D.Stratmann January 30, 2001 09:35

UDF : derivate of density
 
hello cfdler !

can anyone help me to create a user-defined-function ?

situation/case : since i want to compare my simulation results (using fluent) with schlieren-photography, i need to have another scalar for postprocessing.

i want to judge my results by postprocessing the change of density in x-coordinate : d(density)/dx.

best regards.

Dirk (university of dortmund, germany)

Greg Perkins January 31, 2001 22:33

Re: UDF : derivate of density
 
Try and copy the density into a user scalar and then copy the derivative of this to another location. If you do this within a DEFINE_ON_DEMAN will probable be easiest:

extern Domain *domain;

DEFINE_ON_DEMAND(Density_Grad) { Thread *thread; cell_t cell;

thread_loop_c(thread,domain)

{

begin_c_loop(cell,thread)

{

/* ---- copy deensity to UDS */

C_UDSI(cell,thread,0) = C_R(cell,thread);

/* --- store gradient d/dx in UDM */

C_UDMI(cell,thread,0) = C_UDSI_G(cell,thread,0)[0];

}

end_c_loop(cell,thread)

} }

Haven't tried it - but might work!

Greg

D.Stratmann February 2, 2001 04:02

Re: UDF : derivate of density
 
Many thanks to you, Greg.....

i will check it.

Best regards.............Dirk (university of dortmund, germany)


All times are GMT -4. The time now is 19:16.