[3115] | 1 | #include "sopnamsp.h"
|
---|
| 2 | #include "machdefs.h"
|
---|
| 3 | #include <iostream>
|
---|
| 4 | #include <stdlib.h>
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include <string.h>
|
---|
| 7 | #include <math.h>
|
---|
| 8 | #include <unistd.h>
|
---|
| 9 | #include "timing.h"
|
---|
| 10 | #include "ntuple.h"
|
---|
| 11 |
|
---|
| 12 | #include "constcosmo.h"
|
---|
[3196] | 13 | #include "geneutils.h"
|
---|
[3115] | 14 | #include "planckspectra.h"
|
---|
| 15 |
|
---|
| 16 | void compute_xroot(void);
|
---|
| 17 |
|
---|
| 18 | // cmvtstblack [T,nutest(Hz)] [deriv 0/1]
|
---|
| 19 |
|
---|
| 20 | int main(int narg,char *arg[])
|
---|
| 21 | {
|
---|
| 22 | //{compute_xroot(); return -41;}
|
---|
| 23 | double T = 2.718, nutest=-1.;
|
---|
[3347] | 24 | unsigned short funcderiv = 0;
|
---|
[3115] | 25 | double x0;
|
---|
| 26 |
|
---|
| 27 | if(narg>1) sscanf(arg[1],"%lf,%lf",&T,&nutest);
|
---|
| 28 | if(T<=0.) T = 2.718;
|
---|
[3347] | 29 | if(narg>2) sscanf(arg[2],"%hu",&funcderiv);
|
---|
| 30 | PlanckSpectra::SpectraFunc deriv = (funcderiv==0) ? PlanckSpectra::VALUE : PlanckSpectra::DERIV;
|
---|
[3115] | 31 |
|
---|
[3347] | 32 | cout<<"Temperature "<<T<<" K , deriv="<<(int)deriv<<endl;
|
---|
[3115] | 33 |
|
---|
| 34 | //--------------------------------- Radiance Frequence
|
---|
| 35 | // frequence planck radiance W/..
|
---|
| 36 | PlanckSpectra pradf(T);
|
---|
[3347] | 37 | pradf.SetSpectraFunc(deriv);
|
---|
| 38 | pradf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 39 | pradf.SetSpectraApprox(PlanckSpectra::PLANCK);
|
---|
| 40 | pradf.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 41 | pradf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 42 | PlanckSpectra phpradf(pradf);
|
---|
| 43 | phpradf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 44 |
|
---|
| 45 | // frequence rayleigh radiance W/..
|
---|
| 46 | PlanckSpectra rradf(T);
|
---|
[3347] | 47 | rradf.SetSpectraFunc(deriv);
|
---|
| 48 | rradf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 49 | rradf.SetSpectraApprox(PlanckSpectra::RAYLEIGH);
|
---|
| 50 | rradf.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 51 | rradf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 52 | PlanckSpectra phrradf(rradf);
|
---|
| 53 | phrradf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 54 |
|
---|
| 55 | // frequence wien radiance W/..
|
---|
| 56 | PlanckSpectra wradf(T);
|
---|
[3347] | 57 | wradf.SetSpectraFunc(deriv);
|
---|
| 58 | wradf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 59 | wradf.SetSpectraApprox(PlanckSpectra::WIEN);
|
---|
| 60 | wradf.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 61 | wradf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 62 | PlanckSpectra phwradf(wradf);
|
---|
| 63 | phwradf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 64 |
|
---|
| 65 | // Check
|
---|
| 66 | if(nutest<=0.) nutest = k_Boltzman_Cst*T/h_Planck_Cst;
|
---|
| 67 | cout<<"Test for t="<<T<<" K, nu="<<nutest<<" Hz"<<endl
|
---|
| 68 | <<" planck = "<<pradf(nutest)<<endl
|
---|
| 69 | <<" wien = "<<wradf(nutest)<<endl
|
---|
| 70 | <<" rayleigh = "<<rradf(nutest)<<endl;
|
---|
| 71 |
|
---|
| 72 | //--------------------------------- Densite Frequence
|
---|
| 73 | // frequence planck density W/..
|
---|
| 74 | PlanckSpectra pdensf(T);
|
---|
[3347] | 75 | pdensf.SetSpectraFunc(deriv);
|
---|
| 76 | pdensf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 77 | pdensf.SetSpectraApprox(PlanckSpectra::PLANCK);
|
---|
| 78 | pdensf.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 79 | pdensf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 80 | PlanckSpectra phpdensf(pdensf);
|
---|
| 81 | phpdensf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 82 |
|
---|
| 83 | // frequence rayleigh density W/..
|
---|
| 84 | PlanckSpectra rdensf(T);
|
---|
[3347] | 85 | rdensf.SetSpectraFunc(deriv);
|
---|
| 86 | rdensf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 87 | rdensf.SetSpectraApprox(PlanckSpectra::RAYLEIGH);
|
---|
| 88 | rdensf.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 89 | rdensf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 90 | PlanckSpectra phrdensf(rdensf);
|
---|
| 91 | phrdensf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 92 |
|
---|
| 93 | // frequence wien density W/..
|
---|
| 94 | PlanckSpectra wdensf(T);
|
---|
[3347] | 95 | wdensf.SetSpectraFunc(deriv);
|
---|
| 96 | wdensf.SetSpectraVar(PlanckSpectra::NU);
|
---|
| 97 | wdensf.SetSpectraApprox(PlanckSpectra::WIEN);
|
---|
| 98 | wdensf.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 99 | wdensf.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 100 | PlanckSpectra phwdensf(wdensf);
|
---|
| 101 | phwdensf.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 102 |
|
---|
| 103 | //--------------------------------- Radiance Longeur d'onde
|
---|
| 104 | // longueur d'onde planck radiance W/..
|
---|
| 105 | PlanckSpectra pradl(T);
|
---|
[3347] | 106 | pradl.SetSpectraFunc(deriv);
|
---|
| 107 | pradl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 108 | pradl.SetSpectraApprox(PlanckSpectra::PLANCK);
|
---|
| 109 | pradl.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 110 | pradl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 111 | PlanckSpectra phpradl(pradl);
|
---|
| 112 | phpradl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 113 |
|
---|
| 114 | // longueur d'onde rayleigh radiance W/..
|
---|
| 115 | PlanckSpectra rradl(T);
|
---|
[3347] | 116 | rradl.SetSpectraFunc(deriv);
|
---|
| 117 | rradl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 118 | rradl.SetSpectraApprox(PlanckSpectra::RAYLEIGH);
|
---|
| 119 | rradl.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 120 | rradl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 121 | PlanckSpectra phrradl(rradl);
|
---|
| 122 | phrradl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 123 |
|
---|
| 124 | // longueur d'onde wien radiance W/..
|
---|
| 125 | PlanckSpectra wradl(T);
|
---|
[3347] | 126 | wradl.SetSpectraFunc(deriv);
|
---|
| 127 | wradl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 128 | wradl.SetSpectraApprox(PlanckSpectra::WIEN);
|
---|
| 129 | wradl.SetSpectraUnit(PlanckSpectra::ANGSFLUX);
|
---|
| 130 | wradl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 131 | PlanckSpectra phwradl(wradl);
|
---|
| 132 | phwradl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 133 |
|
---|
| 134 | //--------------------------------- Densite Longeur d'onde
|
---|
| 135 | // longueur d'onde planck density W/..
|
---|
| 136 | PlanckSpectra pdensl(T);
|
---|
[3347] | 137 | pdensl.SetSpectraFunc(deriv);
|
---|
| 138 | pdensl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 139 | pdensl.SetSpectraApprox(PlanckSpectra::PLANCK);
|
---|
| 140 | pdensl.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 141 | pdensl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 142 | PlanckSpectra phpdensl(pdensl);
|
---|
| 143 | phpdensl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 144 |
|
---|
| 145 | // longueur d'onde rayleigh density W/..
|
---|
| 146 | PlanckSpectra rdensl(T);
|
---|
[3347] | 147 | rdensl.SetSpectraFunc(deriv);
|
---|
| 148 | rdensl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 149 | rdensl.SetSpectraApprox(PlanckSpectra::RAYLEIGH);
|
---|
| 150 | rdensl.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 151 | rdensl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 152 | PlanckSpectra phrdensl(rdensl);
|
---|
| 153 | phrdensl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 154 |
|
---|
| 155 | // longueur d'onde wien density W/..
|
---|
| 156 | PlanckSpectra wdensl(T);
|
---|
[3347] | 157 | wdensl.SetSpectraFunc(deriv);
|
---|
| 158 | wdensl.SetSpectraVar(PlanckSpectra::LAMBDA);
|
---|
| 159 | wdensl.SetSpectraApprox(PlanckSpectra::WIEN);
|
---|
| 160 | wdensl.SetSpectraUnit(PlanckSpectra::DENSENERG);
|
---|
| 161 | wdensl.SetSpectraPower(PlanckSpectra::POWER);
|
---|
| 162 | PlanckSpectra phwdensl(wdensl);
|
---|
| 163 | phwdensl.SetSpectraPower(PlanckSpectra::PHOTON);
|
---|
[3115] | 164 |
|
---|
| 165 | //--------------------------------- Le maximum des spectres de planck
|
---|
| 166 | cout<<endl;
|
---|
| 167 | double eps = 0.001;
|
---|
| 168 | x0 = pradf.WienLaw();
|
---|
| 169 | printf("Planck maximum for radiance energy: f = %e Hz -> %e W/m^2/sr/Hz\n",x0,pradf(x0));
|
---|
| 170 | printf(" check: = %e\n",pradf.FindMaximum(eps));
|
---|
| 171 | x0 = phpradf.WienLaw();
|
---|
| 172 | printf("Planck maximum for radiance photon: f = %e Hz -> %e ph/s/m^2/sr/Hz\n",x0,phpradf(x0));
|
---|
| 173 | printf(" check: = %e\n",phpradf.FindMaximum(eps));
|
---|
| 174 |
|
---|
| 175 | x0 = pdensf.WienLaw();
|
---|
| 176 | printf("Planck maximum for density energy: f = %e Hz -> %e J/m^3/Hz\n",x0,pdensf(x0));
|
---|
| 177 | printf(" check: = %e\n",pdensf.FindMaximum(eps));
|
---|
| 178 | x0 = phpdensf.WienLaw();
|
---|
| 179 | printf("Planck maximum for density photon: f = %e Hz -> %e ph/m^3/Hz\n",x0,phpdensf(x0));
|
---|
| 180 | printf(" check: = %e\n",phpdensf.FindMaximum(eps));
|
---|
| 181 |
|
---|
| 182 | x0 = pradl.WienLaw();
|
---|
| 183 | printf("Planck maximum for radiance energy: l = %e m -> %e W/m^2/sr/m\n",x0,pradl(x0));
|
---|
| 184 | printf(" check: = %e\n",pradl.FindMaximum(eps));
|
---|
| 185 | x0 = phpradl.WienLaw();
|
---|
| 186 | printf("Planck maximum for radiance photon: l = %e m -> %e ph/s/m^2/sr/m\n",x0,phpradl(x0));
|
---|
| 187 | printf(" check: = %e\n",phpradl.FindMaximum(eps));
|
---|
| 188 |
|
---|
| 189 | x0 = pdensl.WienLaw();
|
---|
| 190 | printf("Planck maximum for density energy: l = %e m -> %e J/m^3/m\n",x0,pdensl(x0));
|
---|
| 191 | printf(" check: = %e\n",pdensl.FindMaximum(eps));
|
---|
| 192 | x0 = phpdensl.WienLaw();
|
---|
| 193 | printf("Planck maximum for density photon: l = %e m -> %e ph/m^3/m\n",x0,phpdensl(x0));
|
---|
| 194 | printf(" check: = %e\n",phpdensl.FindMaximum(eps));
|
---|
| 195 |
|
---|
| 196 | //--------------------------------- La loi de Wien
|
---|
| 197 | cout<<endl;
|
---|
| 198 | x0 = wradf.WienLaw();
|
---|
| 199 | printf("Wien law for radiance energy: f = %e Hz -> %e W/m^2/sr/Hz\n",x0,wradf(x0));
|
---|
| 200 | printf(" check: = %e\n",wradf.FindMaximum(eps));
|
---|
| 201 | x0 = phwradf.WienLaw();
|
---|
| 202 | printf("Wien law for radiance photon: f = %e Hz -> %e ph/s/m^2/sr/Hz\n",x0,phwradf(x0));
|
---|
| 203 | printf(" check: = %e\n",phwradf.FindMaximum(eps));
|
---|
| 204 |
|
---|
| 205 | x0 = wdensf.WienLaw();
|
---|
| 206 | printf("Wien law for density energy: f = %e Hz -> %e J/m^3/Hz\n",x0,wdensf(x0));
|
---|
| 207 | printf(" check: = %e\n",wdensf.FindMaximum(eps));
|
---|
| 208 | x0 = phwdensf.WienLaw();
|
---|
| 209 | printf("Wien law for density photon: f = %e Hz -> %e ph/m^3/Hz\n",x0,phwdensf(x0));
|
---|
| 210 | printf(" check: = %e\n",phwdensf.FindMaximum(eps));
|
---|
| 211 |
|
---|
| 212 | x0 = wradl.WienLaw();
|
---|
| 213 | printf("Wien law for radiance energy: l = %e m -> %e W/m^2/sr/m\n",x0,wradl(x0));
|
---|
| 214 | printf(" check: = %e\n",wradl.FindMaximum(eps));
|
---|
| 215 | x0 = phwradl.WienLaw();
|
---|
| 216 | printf("Wien law for radiance photon: l = %e m -> %e ph/s/m^2/sr/m\n",x0,phwradl(x0));
|
---|
| 217 | printf(" check: = %e\n",phwradl.FindMaximum(eps));
|
---|
| 218 |
|
---|
| 219 | x0 = wdensl.WienLaw();
|
---|
| 220 | printf("Wien law for density energy: l = %e m -> %e J/m^3/m\n",x0,wdensl(x0));
|
---|
| 221 | printf(" check: = %e\n",wdensl.FindMaximum(eps));
|
---|
| 222 | x0 = phwdensl.WienLaw();
|
---|
| 223 | printf("Wien law for density photon: l = %e m -> %e ph/m^3/m\n",x0,phwdensl(x0));
|
---|
| 224 | printf(" check: = %e\n",phwdensl.FindMaximum(eps));
|
---|
| 225 |
|
---|
| 226 | //--------------------------------- Densite totale d'energie
|
---|
| 227 | cout<<endl;
|
---|
| 228 | cout<<"Densite totale d'energie: "<<pdensf.PlanckEnergie()<<" J/m^3"<<endl;
|
---|
| 229 | if(! deriv) {
|
---|
| 230 | double x1,x2,perc,dxinc;
|
---|
| 231 | x0 = pdensf.WienLaw(); x1=x0/100.; x2=x0*100.; perc=0.1; dxinc=x0/1000.;
|
---|
| 232 | cout<<" check by integration: "<<IntegrateFunc(pdensf,x1,x2,perc,dxinc)<<" J/m^3"<<endl;
|
---|
| 233 | x1=log10(x0/100.); x2=log10(x0*100.); perc=0.1; dxinc=(x2-x1)/100.;
|
---|
| 234 | cout<<" check by integration: "<<IntegrateFuncLog(pdensf,x1,x2,perc,dxinc)<<" J/m^3"<<endl;
|
---|
| 235 |
|
---|
| 236 | x0 = pdensl.WienLaw(); x1=x0/100.; x2=x0*100.; perc=0.1; dxinc=x0/1000.;
|
---|
| 237 | cout<<" check by integration: "<<IntegrateFunc(pdensl,x1,x2,perc,dxinc)<<" J/m^3"<<endl;
|
---|
| 238 | x1=log10(x0/100.); x2=log10(x0*100.); perc=0.1; dxinc=(x2-x1)/100.;
|
---|
| 239 | cout<<" check by integration: "<<IntegrateFuncLog(pdensl,x1,x2,perc,dxinc)<<" J/m^3"<<endl;
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | //--------------------------------- Densite totale de photons
|
---|
| 243 | cout<<endl;
|
---|
| 244 | cout<<"Densite totale de photons: "<<pdensf.PlanckPhoton()<<" ph/m^3"<<endl;
|
---|
| 245 | if(! deriv) {
|
---|
| 246 | double x1,x2,perc,dxinc;
|
---|
| 247 | x0 = phpdensf.WienLaw(); x1=x0/100.; x2=x0*100.; perc=0.1; dxinc=x0/1000.;
|
---|
| 248 | cout<<" check by integration: "<<IntegrateFunc(phpdensf,x1,x2,perc,dxinc)<<" ph/m^3"<<endl;
|
---|
| 249 | x1=log10(x0/100.); x2=log10(x0*100.); perc=0.1; dxinc=(x2-x1)/100.;
|
---|
| 250 | cout<<" check by integration: "<<IntegrateFuncLog(phpdensf,x1,x2,perc,dxinc)<<" ph/m^3"<<endl;
|
---|
| 251 |
|
---|
| 252 | x0 = phpdensl.WienLaw(); x1=x0/100.; x2=x0*100.; perc=0.1; dxinc=x0/1000.;
|
---|
| 253 | cout<<" check by integration: "<<IntegrateFunc(phpdensl,x1,x2,perc,dxinc)<<" ph/m^3"<<endl;
|
---|
| 254 | x1=log10(x0/100.); x2=log10(x0*100.); perc=0.1; dxinc=(x2-x1)/100.;
|
---|
| 255 | cout<<" check by integration: "<<IntegrateFuncLog(phpdensl,x1,x2,perc,dxinc)<<" ph/m^3"<<endl;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | //--------------------------------- NTuple
|
---|
| 259 | cout<<endl;
|
---|
| 260 | int npt = 1000;
|
---|
| 261 | double frac = 10000.;
|
---|
| 262 | x0 = wradf.WienLaw();
|
---|
| 263 | double xmin = x0/frac, xmax = x0*frac;
|
---|
| 264 | cout<<"xmin="<<xmin<<" Hz, xmax="<<xmax<<" Hz"<<endl;
|
---|
| 265 | double lnx1 = log10(xmin), lnx2 = log10(xmax), dlnx = (lnx2-lnx1)/npt;
|
---|
| 266 | cout<<"lnx1="<<lnx1<<", lnx2="<<lnx2<<", dlnx="<<dlnx<<endl;
|
---|
| 267 |
|
---|
| 268 | const int n = 14;
|
---|
| 269 | char *vname[n] = {"f","l","prf","prl","pdf","pdl","rrf","rrl","rdf","rdl","wrf","wrl","wdf","wdl"};
|
---|
| 270 | NTuple nt(n,vname);
|
---|
| 271 | double xnt[n];
|
---|
| 272 | for(double lx=lnx1;lx<lnx2+dlnx/2.;lx+=dlnx) {
|
---|
| 273 | double f = pow(10.,lx);
|
---|
| 274 | double l = wradf.F2L(f);
|
---|
| 275 | xnt[0] = f;
|
---|
| 276 | xnt[1] = l;
|
---|
| 277 | xnt[2] = pradf(f);
|
---|
| 278 | xnt[3] = pradl(l);
|
---|
| 279 | xnt[4] = pdensf(f);
|
---|
| 280 | xnt[5] = pdensl(l);
|
---|
| 281 | xnt[6] = rradf(f);
|
---|
| 282 | xnt[7] = rradl(l);
|
---|
| 283 | xnt[8] = rdensf(f);
|
---|
| 284 | xnt[9] = rdensl(l);
|
---|
| 285 | xnt[10] = wradf(f);
|
---|
| 286 | xnt[11] = wradl(l);
|
---|
| 287 | xnt[12] = wdensf(f);
|
---|
| 288 | xnt[13] = wdensl(l);
|
---|
| 289 | nt.Fill(xnt);
|
---|
| 290 | }
|
---|
| 291 |
|
---|
| 292 | cout<<"\n>>>> Ecriture"<<endl;
|
---|
| 293 | string tag = "cmvtstblack.ppf";
|
---|
| 294 | POutPersist pos(tag);
|
---|
| 295 | tag = "nt"; pos.PutObject(nt,tag);
|
---|
| 296 |
|
---|
| 297 | return 0;
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 | //---------------------------------------
|
---|
| 301 | void compute_xroot(void)
|
---|
| 302 | // Pour calculer les x qui donnent le maximum de f(x) pour:
|
---|
| 303 | // f(x) = x^n * exp(-x)
|
---|
| 304 | // ou
|
---|
| 305 | // f(x) = x^n / (exp(x)-1)
|
---|
| 306 | // ou
|
---|
| 307 | // f(x) = x^n * exp(x) / (exp(x)-1)^2
|
---|
| 308 | {
|
---|
| 309 | double n = 3.;
|
---|
| 310 | cout<<"n="<<n<<endl;
|
---|
| 311 | int npt=10;
|
---|
| 312 | double xmin=0.1,xmax=10., dx=(xmax-xmin)/npt;
|
---|
| 313 | for(int itry=0;itry<100;itry++) {
|
---|
| 314 | double x0=xmin, v0=-1e10;
|
---|
| 315 | for(double x=xmin;x<xmax+dx/2.; x+=dx) {
|
---|
| 316 | double f = pow(x,n) * exp(-x); // Wien ou dWein/dT
|
---|
| 317 | //double f = pow(x,n) / (exp(x)-1); // Planck
|
---|
| 318 | //double f = pow(x,n) * exp(x) / ((exp(x)-1)*(exp(x)-1)); // dPlanck/dT
|
---|
| 319 | if(f>v0) {v0=f; x0=x;}
|
---|
| 320 | }
|
---|
| 321 | printf("x0 = %.18f , v0=%.18f , dx=%e\n",x0,v0,dx);
|
---|
| 322 | xmin = x0-dx; xmax = x0+dx; dx=(xmax-xmin)/npt;
|
---|
| 323 | if(dx<1e-15) break;
|
---|
| 324 | }
|
---|
| 325 | }
|
---|
| 326 |
|
---|
| 327 |
|
---|
| 328 | /*
|
---|
| 329 | openppf cmvtstblack.ppf
|
---|
| 330 |
|
---|
| 331 | # Energie
|
---|
| 332 | set fac 1.
|
---|
| 333 | # Photon
|
---|
| 334 | set fac (6.6260693e-34*f)
|
---|
| 335 |
|
---|
| 336 | n/plot nt.log10(f)%log10(l)
|
---|
| 337 |
|
---|
| 338 | # radiance frequence
|
---|
| 339 | n/plot nt.prf/${fac}%log10(f) ! ! "nsta connectpoints"
|
---|
| 340 | n/plot nt.rrf/${fac}%log10(f) ! ! "nsta connectpoints red same"
|
---|
| 341 | n/plot nt.wrf/${fac}%log10(f) ! ! "nsta connectpoints blue same"
|
---|
| 342 |
|
---|
| 343 | # radiance longeur d'onde
|
---|
| 344 | n/plot nt.prl/${fac}%log10(l) ! ! "nsta connectpoints"
|
---|
| 345 | n/plot nt.rrl/${fac}%log10(l) ! ! "nsta connectpoints red same"
|
---|
| 346 | n/plot nt.wrl/${fac}%log10(l) ! ! "nsta connectpoints blue same"
|
---|
| 347 |
|
---|
| 348 | # densite frequence
|
---|
| 349 | n/plot nt.pdf/${fac}%log10(f) ! ! "nsta connectpoints"
|
---|
| 350 | n/plot nt.rdf/${fac}%log10(f) ! ! "nsta connectpoints red same"
|
---|
| 351 | n/plot nt.wdf/${fac}%log10(f) ! ! "nsta connectpoints blue same"
|
---|
| 352 |
|
---|
| 353 | # densite longeur d'onde
|
---|
| 354 | n/plot nt.pdl/${fac}%log10(l) ! ! "nsta connectpoints"
|
---|
| 355 | n/plot nt.rdl/${fac}%log10(l) ! ! "nsta connectpoints red same"
|
---|
| 356 | n/plot nt.wdl/${fac}%log10(l) ! ! "nsta connectpoints blue same"
|
---|
| 357 |
|
---|
| 358 | # Check: p(l)dl = p(f)df avec dl = c/f^2 df = l^2/c df
|
---|
| 359 | n/plot nt.prf%log10(f) ! ! "nsta connectpoints"
|
---|
| 360 | n/plot nt.prl*2.998e8/(f*f)%log10(f) ! ! "nsta connectpoints red same"
|
---|
| 361 |
|
---|
| 362 | */
|
---|