CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   to correct me an udf program (

farida hamadi December 18, 2004 06:54

to correct me an udf program
I will want to know if my program that I have write to calculate the temperature of the surface during the interaction pulsed laser with matter is correct.

this is my program

/*user defined function to calculate temperature and velocity*/ /*fluent6*/ /************************************************** **/ #include"udf.h"

DEFINE_PROFILE(unsteady_temperature,thread, position) { int t,its; float gamma=1.66; float cgp=8.3144e7 ; float avogn=6.02e23; float bk=1.38e-23; float bkcgs=1.38e-16; // propriétés du matériau (Fer) float amass=27; float rhom=6.98; float rhos=7.8; float difftm=0.07; float diffts=0.14; float capcm=0.748; float capcs=0.628; float tfus=1808; float clv=6088; float clm=276; float b0=3.9e13; float a=0.55; float tamb=300; float coefabs=0.5; float romsros=rhom/rhos; float ab0=a*b0; float tau=-1.e-9; //ns float F=1.75; //j/cm2 float rl=0.05; //mm float u=amass*clv/(avogn*bk); float dens=amass/avogn/bkcgs; int ts=1800; float eps=0.001; float cnorm[10000]; float v0,vv,vdv,vm,vg,psatur,aiabs,precul,exputs,rmrsvv, tevap,diff,tconv,absi,tcond,tetoil,difsrl,vd,absmw ,abs1,rhog,prbar,pablat,pabar,veject,alpha,tempera ture;

float tl=26e-9; float tp=6e-9; float tlp=tl*(tl-tp); float anorm=1000; cnorm[0]=1000;

face_t f; begin_f_loop(f, thread) { t = RP_Get_Real("flow-time");

if(t >0 && t<tp) {aiabs=2.*F*coefabs*t/(tp*tl);} if(t>=tp && t<=tl) {aiabs=2.*F*coefabs*(tl-t)/tlp; } if(t > tl) {aiabs =0;}

if(aiabs==0)goto etiq2; ts=1800; for(its=1;its<=9200;++its) { ts=ts+1; exputs=exp(-u/ts); v0=sqrt(gamma*cgp/amass*ts); vv=v0*exputs; vdv=romsros*vv; psatur=b0*exputs/sqrt(ts); precul=a*psatur; vm= sqrt(2.*precul/rhom); rmrsvv=romsros*vv; difsrl=difftm/rl; vd=0.5*(rmrsvv+sqrt(rmrsvv*rmrsvv+4*romsros*difsrl *vm)); tetoil=tfus+0.9*(ts-tfus); tconv=rhom*(capcm*tetoil+clm)*vm*difftm/(vd*rl)-rhos*capcs*tamb*vd; tcond=rhos*capcs*(tfus-tamb)*vd/sqrt(difftm/diffts+vd*rl/diffts); tevap=rhom*vv*clv; absi=tconv+tcond+tevap; cnorm[its]=(abs(aiabs-absi))/aiabs; if(cnorm[its]<cnorm[its-1]) {anorm=cnorm[its]; }



veject=sqrt((gamma*cgp*ts)/amass); veject= veject*0.01; goto etiq1;}

goto etiq2; etiq1: continue; etiq2: continue;

F_PROFILE(f, thread, position) = ts; } end_f_loop(f, thread) }

All times are GMT -4. The time now is 04:53.