|
[Sponsors] |
March 2, 2016, 04:49 |
UDF error for Heat Generation
|
#1 |
New Member
marianna
Join Date: Mar 2016
Posts: 10
Rep Power: 10 |
Hi to everyone.
My Ansys get me this error chip-exec: calcolo: wrong return type: void udf function expected Error: received a fatal signal (Segmentation fault). Error: received a fatal signal (Segmentation fault). Error Object: #f I try this program in Matlab and in C, and it is ok...Ansys in my problem Can you help me?? #include "udf.h" /*COSTANTI FISICHE*/ #define Kb 1.3806488e-23 /*costante di Boltzmann [J/K]*/ #define q 1.60217657e-19 /*carica elettrone [C]*/ #define sigma 5.67044e-8 /*costante di Stefan-Boltzmann [W/m2K4]*/ /*DATI di TARGA MODULO*/ #define Voc_stc 22.8 #define Isc 4.73 #define Im_stc 4.45 #define Vm_stc 17.8 #define Ncelle 40 #define alfa_Isc 0.038 #define T_STC 25 #define size_Tc 36 // rendo la dimensione di tc una COSTANTE che posso modificare a piacimento /*DATI NECESSARI PER IL MODULO*/ #define aa 4.73e-4 #define bb 636 #define Eg0 1.21 #define PASSI 2000 /*CONDIZIONI AMBIENTALI*/ #define G 1000 #define Ta 32 /*PARAMETRI TEORICI*/ #define mCella 1.092024 #define Kph 3.284889e-1 #define Rs 1.022002e-02 /*resistenza serie*/ #define Rsh 200 /*TRASMITTANZE*/ #define etaPC 0.93 #define etaTPU 0.90 #define etaARC 0.85 /* PROTOTIPI FUNZIONI*/ real CalcoloElettrico (real Tc,int m, real I0_Stc,real Iph0, real A); //////////////////////////////////////////////////////////////////////////////////////////////// // SVILUPPO FUNZIONI// ///////////////////////////*Funzione CALCOLO ELETTRICO*////////////////////////////////////// real CalcoloElettrico(real Tc,int m, real I0_Stc, real Iph0,real A){ int colonna, dim_Tc,ii, ii1, ii2,i,iv; real I[PASSI]=0, V[PASSI]=0, Step=0, csi[PASSI]=0, delta=0,Eg=0, Eg1=0, Appoggio=0, Iph=0, Potenza[PASSI]=0, PMax=0, potenza=0, esp_corrente=0, moltip=0, Voc=0, Vm=0,I0=0; real Pmaxcella=0, etaN=0; Voc=Voc_stc/Ncelle; Vm=Vm_stc/Ncelle; //Inizializzazione dei vettori corrente I e tensione V for (colonna=0;colonna<PASSI; colonna++) I[colonna]=0; for (colonna=0;colonna<PASSI; colonna++) V[PASSI]=0; potenza=pow(Tc,2); Eg=Eg0-((potenza*aa)/(Tc+bb)); Eg1=q*Eg; I0=I0_Stc*(pow(Tc/298,3))*exp(-Eg1/Kb/Tc)/exp(-Eg1/Kb/298); Iph=Iph0*(1+alfa_Isc/100*(Tc-298.15))*G/1000;/*1000 irradianza standard*/ /*linsapce come si fa*/ Step=((0.98*Voc)-(Rs*Iph))/(PASSI-1); csi[0]=Rs*Iph; csi[PASSI-1]=0.98*Voc; for(i=1;i<PASSI-1;i++){ csi[i]=csi[i-1]+Step; } delta=q/(mCella*Kb*Tc); for(iv=0;iv<PASSI;iv++){ esp_corrente=delta*csi[iv]; moltip=I0*(exp(esp_corrente)-1); I[iv]=Iph-moltip-(csi[iv]/Rsh); V[iv]= csi[iv]-(Rs*I[iv]); } for(ii1=0;ii1<i;ii1++){ Potenza[ii1]=I[ii1]*V[ii1]; } for(ii2=1;ii2<i;ii2++){ if (Potenza[ii2]>=Potenza[ii2-1]) PMax=Potenza[ii2]; } Pmaxcella=PMax; etaN=Pmaxcella/(G*A); return etaN; } ///////////// ////////MAIN///////// //////////// DEFINE_SOURCE(calcolo,c, t, dS, eqn) { int m=0,iniz=0; real eta_STC=0, Vm=0, A=0, P_STC=0, I0_Stc=0, Iph0=0, Voc=0, T_STC_K=0, Ta_K=0, etaN=0, denominatore_esp=0, arg_esp=0, generazione=0; real temp=0; cell_t c; P_STC=Im_stc*Vm_stc;/* lo posso anche metter come DEFINE*/ /*Dati geometrici celle*/ A=12*12; A=A*pow(10,-4); Iph0=A*Kph*1000;/*1000 è l' irradianza GStc*/ Voc=Voc_stc/Ncelle; Vm=Vm_stc/Ncelle; /*rendimento condizioni standard*/ eta_STC= Vm_stc*Im_stc/(1000*A); T_STC_K=T_STC+273.15;/*conversione in K*/ Ta_K=Ta+273.15;/*conversione in K, CONTROLLARE IN ANSYS*/ denominatore_esp=mCella*Kb*(25+273.15); arg_esp=q*Voc/denominatore_esp; I0_Stc=(Iph0-Voc/Rsh)/exp(arg_esp); /* calcolo elettrico*/ temp=C_T(c,t); etaN=CalcoloElettrico(temp, m, I0_Stc, Iph0, A); generazione=((etaPC*etaTPU*etaARC)-etaN)*G; return generazione; } Last edited by mame; March 2, 2016 at 08:51. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf for valve closing a pipe using dynamic mesh | chem engineer | Fluent UDF and Scheme Programming | 2 | May 13, 2017 09:39 |
Fluent Radiation/porous media | Schmitt pierre-Louis | FLUENT | 26 | September 1, 2016 10:29 |
UDF Generation | mitalibasargi | Fluent UDF and Scheme Programming | 0 | February 26, 2014 07:10 |
udf for heat generation | sarah l | Fluent UDF and Scheme Programming | 1 | October 16, 2013 17:48 |
Help Parallelizing UDF | AndresC | FLUENT | 0 | February 25, 2010 15:50 |