// $Id: physicsuv.cpp,v 1.2 2010/09/17 15:19:37 thernis Exp $ #include "physicsuv.h" #include #include #include #include #include #include #include #include "rtmiscfunc.h" #include "scene.h" const unsigned int PhysicsUV::NBSAMP; const unsigned int PhysicsUV::NBLINES; PhysicsUV::PhysicsUV() { physicsName="UV emission"; wavelengthId=0; isgood=false; char *ppathtoxdr; string pathtoxdr; // ---- get the path where emission files are located ppathtoxdr=getenv("RT_UVEMISSIONPATH"); if (ppathtoxdr!=NULL) pathtoxdr.assign(ppathtoxdr); if (pathtoxdr.empty()) { cout << "The RT_UVEMISSIONPATH environment variable is not defined\nI just use the current directory" << endl; pathtoxdr="~/work/cpp/scraytrace/data"; } //pathtoxdr="/home/arnaud/work/cpp"; // ---- load the emission vs temperature tables // -- yisel FILE *pFile; string filename=pathtoxdr+"/yisel.xdr"; pFile = fopen (filename.c_str() , "r"); if (pFile == NULL) { cout << "Error opening file "<< filename << endl; exit(1); } XDR xdrs; xdrstdio_create(&xdrs, pFile, XDR_DECODE); float a; for (unsigned int j=0;j 3) return 0.; //unsigned int klineoffset=kline-1; float logte=log10(te); float yif=nearestneighbor1dinterp(logte,ti,NBSAMP,&yisel[waveid*NBSAMP]); float emiss=nearestneighbor1dinterp(logte,teg,NBSAMP,&emis[waveid*NBSAMP]); return(pow(float(10.),yif)*pow(float(10.),emiss)); } bool PhysicsUV::computeRadiation(const Cvec &vs,const float &r,const float &rho,float &btout,float &bpout,float &neout) { float temperature; float ner=pparentscene->pmod->Density(ChangetoDensityCoord(pparentscene->modelposition,vs),temperature); float uv=calcEmissivity(wavelengthId,temperature); neout=ner; bpout=uv; btout=uv*ner*ner; return 0; } void PhysicsUV::getConstFactors(float &btf,float &bpf,float &nef) { btf=pparentscene->los.ds; bpf=btf; nef=RSUN_CM*pparentscene->los.ds; }