source: Sophya/trunk/Cosmo/SimLSS/cmvtransf.cc@ 3150

Last change on this file since 3150 was 3115, checked in by ansari, 19 years ago

Creation initiale du groupe Cosmo avec le repertoire SimLSS de
simulation de distribution de masse 3D des galaxies par CMV+Rz
18/12/2006

File size: 2.3 KB
Line 
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"
13#include "pkspectrum.h"
14
15void usage(void);
16void usage(void) {cout<<"cmvtuniv [k1,k2,npt] [h100,Om0,Ob0,tcmb]"<<endl;}
17
18int main(int narg,char *arg[])
19{
20 double k1 = 1e-6, k2 = 10.; int_4 npt = 100;
21 double h100 = 0.71, Om0 = 0.267804, Ob0 = 0.0444356, tcmb = T_CMB_Par;
22
23 if(narg>1) sscanf(arg[1],"%lf,%lf,%d",&k1,&k2,&npt);
24 if(k1<=0.) {cout<<"k1 must be >0"<<endl; return -1;}
25 if(npt<=0) npt = 100;
26 cout<<"k1="<<k1<<" k2="<<k2<<" npt="<<npt<<endl;
27 if(narg>2) sscanf(arg[2],"%lf,%lf,%lf,%lf",&h100,&Om0,&Ob0,&tcmb);
28 cout<<"h100="<<h100<<" Om0="<<Om0<<" Ob0="<<Ob0<<" Tcmb="<<tcmb<<endl;
29
30 cout<<"TransfertEisenstein with baryon"<<endl;
31 TransfertEisenstein tf(h100,Om0-Ob0,Ob0,tcmb);
32 cout<<"KPeak = "<<tf.KPeak()<<" 1/Mpc"<<endl;
33
34 cout<<endl<<"TransfertEisenstein with baryon without oscillation approx.1"<<endl;
35 TransfertEisenstein tfnosc1(h100,Om0-Ob0,Ob0,tcmb); // No oscillation approx.1
36 tfnosc1.SetNoOscEnv(1);
37
38 cout<<endl<<"TransfertEisenstein with baryon without oscillation approx.2"<<endl;
39 TransfertEisenstein tfnosc2(h100,Om0-Ob0,Ob0,tcmb); // No oscillation approx.2
40 tfnosc2.SetNoOscEnv(2);
41
42 cout<<endl<<"TransfertEisenstein without baryon"<<endl;
43 TransfertEisenstein tfnob(h100,Om0-Ob0,Ob0,tcmb,true); // No baryons
44
45 const int n = 5;
46 char *vname[n] = {"k","t","tnosc1","tnosc2","tnob"};
47 NTuple nt(n,vname);
48 double xnt[n];
49
50 double lnk1 = log10(k1), lnk2=log10(k2), dlnk=(lnk2-lnk1)/npt;
51 for(double lnk=lnk1;lnk<lnk2+dlnk/2.;lnk+=dlnk) {
52 double k = pow(10.,lnk);
53 xnt[0] = k;
54 xnt[1] = tf(k);
55 xnt[2] = tfnosc1(k);
56 xnt[3] = tfnosc2(k);
57 xnt[4] = tfnob(k);
58 nt.Fill(xnt);
59 }
60
61 cout<<">>>> Ecriture"<<endl;
62 string tag = "cmvtransf.ppf";
63 POutPersist pos(tag);
64 tag = "nt"; pos.PutObject(nt,tag);
65
66 return 0;
67}
68
69/*
70openppf cmvtransf.ppf
71
72set k k
73set k log10(k)
74
75n/plot nt.t%$k ! ! "nsta crossmarker3"
76n/plot nt.tnob%$k ! ! "nsta red crossmarker3 same"
77n/plot nt.tnosc1%$k ! ! "nsta blue circlemarker3 same"
78n/plot nt.tnosc2%$k ! ! "nsta green trianglemarker3 same"
79
80n/plot nt.t/tnosc1%$k ! ! "nsta crossmarker3"
81n/plot nt.t/tnosc2%$k ! ! "nsta crossmarker3 red same"
82*/
Note: See TracBrowser for help on using the repository browser.