|
[Sponsors] |
August 24, 2010, 08:32 |
Errors message: ACCESS_VIOLATION
|
#1 |
New Member
Emily
Join Date: Aug 2010
Posts: 5
Rep Power: 16 |
Hello, I am trying to model the heat transfer within a hydrogen fuel cell and I keep getting the message ACCESS_VIOLATION when I try applying my UDF.
#include "udf.h" DEFINE_INIT(init_func,d) { Domain *d; Thread *t; real sum_diss=0.; cell_t c; d = Get_Domain(1); } DEFINE_SOURCE(sink_mass, c, t, dS, eqn) { real sink_mass; sink_mass=-C_UDMI(c,t,0)*rau0*0.0166*(1-poros); return sink_mass; } DEFINE_SOURCE(energy_source, c, t, dS, eqn) { real energy_source; energy_source=-C_UDMI(c,t,0)*rau0*0.0166*(1-poros)*deltah/mh2; return energy_source; } DEFINE_EXECUTE_AT_END(execute_at_end) { real step =RP_Get_Real("physical-time-step"); Domain *domain = Get_Domain(1); int ID=2; Thread *t =Lookup_Thread(domain, ID); cell_t c; begin_c_loop(c,t) { double temper,P,hsmp,lnpeq,Peq, dxdt; temper=C_T(c,t); P=(C_R(c,t)*rgp*C_T(c,t)/mh2)*0.00001; hsmp= C_UDMI(c,t, 1 )*(HsMmaxprim-hsurm)+hsurm; lnpeq=A-B/temper+C*hsmp+D*pow(tan(pi*hsmp/2.0/HsMmaxprim),n)+E*pow(tan(pi*hsmp/2.0/HsMmaxprim),(-m)); Peq=exp(lnpeq); C_UDMI(c,t,0)=mh2*Ca*exp(Ea/(rgp*temper))*log(P/Peq)/0.0166; C_UDMI(c,t,1 )=C_UDMI(c,t,1 )+C_UDMI(c,t,0)*step; } end_c_loop(c,t) } I have defined things but didnt think that was important. Can anyone please tell me what is wrong with this code!! It is fairly urgent! Thank you for any help |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Building OpenFOAM1.7.0 from source | ata | OpenFOAM Installation | 46 | March 6, 2022 13:21 |
Transient simulation not converging | skabilan | OpenFOAM Running, Solving & CFD | 14 | December 16, 2019 23:12 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 15:33 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 02:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 18:07 |