source: trunk/MESOSCALE/LMD_MM_MARS/SIMU/RUN/wrf_sounding.sci @ 2613

Last change on this file since 2613 was 258, checked in by aslmd, 13 years ago

MESOSCALE: user manual. finished nesting + tracers + LES. only postproc is missing.

File size: 4.0 KB
Line 
1// profile for WRF initialization
2// update: january 2008
3
4
5//// ----------------------------------------------
6//// Allow user to define input parameters
7//// ----------------------------------------------
8//lat=evstr(x_dialog('Latitude (deg)?','20'));
9//lon=evstr(x_dialog('East Longitude (deg)?','0'));
10//l_s=evstr(x_dialog('Aerocentric longitude (deg)?','90'));
11//lt=evstr(x_dialog('Local time ?','12'));
12//
13//alt=evstr(x_dialog('Altitude top (km)?','50'));
14//resol=evstr(x_dialog('Vertical resolution (points)?','100'));
15
16
17[finput]=file('open', 'input_coord', 'old');
18[vinput]=read(finput,6,1);
19
20lon   = vinput(1);
21lat   = vinput(2);
22l_s   = vinput(3);
23lt    = vinput(4);
24alt   = vinput(5);
25resol = vinput(6);
26
27disp(lon)
28disp(lat)
29disp(l_s)
30disp(lt)
31disp(alt)
32disp(resol)
33
34//vert_coord=evstr(x_dialog('Vertical coordinate type (1-4)?','3'));
35vert_coord = 3;
36//dust_scenario=evstr(x_dialog('Dust scenario (1-8)?','3'));
37dust_scenario = 3;
38//hireskey=evstr(x_dialog('High resolution (0-1)?','1'));
39hireskey=1;
40
41
42// create atltitude array at the required resolution
43alt_profile = [0,1,5,10,20,50,100,[linspace(200,alt*1000,resol)]];
44resol=resol+7;
45
46
47
48// MCD profiles
49//// - profils_mcd(Ls,Loct,Lat,Lon,dust,zkey,hireskey,xz)
50//getf('./profils_mcd.sci');
51exec('./profils_mcd.sci');//,7);
52[p,m] = profils_mcd(l_s,lt,lat,lon,dust_scenario,vert_coord,hireskey,alt_profile);
53
54
55// In Scilab arrays have to be initialized
56utab=ones(max(size(alt_profile)));
57vtab=ones(max(size(alt_profile)));
58ttab=ones(max(size(alt_profile)));
59
60
61// % "-espace occupe- . -precision apres la virgule- -type de nombre-"
62// \n pour passer a la ligne
63
64fid = mtlb_fopen("input_sounding","w")
65fid2= mtlb_fopen("input_more","w")
66fid3= mtlb_fopen("input_therm","w")
67  // pression de surface (1ere couche)
68     ref_p = p(1,1,1)  // equiv. a m(1,1,19)
69     ref_p_mbar = ref_p/100;
70     ref_dummy = 0;
71  // temp_pot de surface (1ere couche)
72     disp(m(1,1,15)); // equiv. a p(1,1,3)
73     //ref_temppot = m(1,1,15)*(610./ref_p)^(1.0/4.4);
74     ref_temppot = m(1,1,15)*(610./ref_p)^(1.0/3.9);
75  // ecriture   
76     mfprintf(fid,"%10.2f",ref_p_mbar);
77     mfprintf(fid,"%12.2f",ref_temppot);
78     mfprintf(fid,"%12.2f\n",ref_dummy);
79
80  // ecriture du profil
81for i=1:resol
82  dummy=0;
83  pression=p(1,i,1);
84  altitude=m(1,i,2);    // altitude zero MOLA
85  temperature=p(1,i,3);
86  density=p(1,i,2);
87  cp = m(1,i,8);
88  rr = m(1,i,49);
89  rcp = rr / cp ;
90  //temppot=temperature*(610./pression)^rcp;
91  //temppot=temperature*(610./pression)^(1.0/4.4);
92  temppot=temperature*(610./pression)^(1.0/3.9);
93  u=p(1,i,4);
94  v=p(1,i,5);
95
96      mfprintf(fid,"%10.2f",altitude);
97      mfprintf(fid,"%12.2f",temppot);
98      ttab(i)=temppot;
99      mfprintf(fid,"%12.2f",dummy);
100      mfprintf(fid,"%12.2f",u);
101      utab(i)=u;
102      mfprintf(fid,"%12.2f\n",v);
103      vtab(i)=v;
104      mfprintf(fid3,"%12.2f",rr);
105      mfprintf(fid3,"%12.2f",cp);
106      mfprintf(fid3,"%18.6e",pression);
107      mfprintf(fid3,"%18.6e",density);
108      mfprintf(fid3,"%12.2f\n",temperature);
109end
110altimetry=m(1,1,2)
111//altimetry=0. //OK
112surftemp=m(1,1,15)
113mfprintf(fid2,"%10.2f",altimetry);
114mfprintf(fid2,"%10.2f",surftemp);
115
116exit
117
118// Plot
119alt_profile=alt_profile/1000;
120xset("window",1)
121style = [1,5];
122strf = "111";
123leg = "Zonal@Meridional";
124rect = [0,min([utab,vtab])-5,max(alt_profile),max([utab,vtab])+5]; //BEWARE : xmin ymin xmax ymax
125plot2d([alt_profile',alt_profile'],[utab,vtab],style,strf,leg,rect);
126        // BEWARE : column vector in plot2d
127xtitle("MCD 4.2 wind profiles at longitude "+string(lon)+" deg, latitude "+string(max(lat))+" deg, localtime "+string(lt)+" h, ls "+string(l_s)+" deg","Altitude (km)","Wind (m/s)");
128
129xset("window",2)
130style = [1];
131strf = "111";
132leg = "";
133rect = [0,min(ttab)-5,max(alt_profile),max(ttab)+5]; //BEWARE : xmin ymin xmax ymax
134plot2d(alt_profile',ttab,style,strf,leg,rect);
135        // BEWARE : column vector in plot2d
136xtitle("MCD 4.2 temperature at longitude "+string(lon)+" deg, latitude "+string(max(lat))+" deg, localtime "+string(lt)+" h, ls "+string(l_s)+" deg","Altitude (km)","Temperature (K)");
137
138//exit
139
140
141
Note: See TracBrowser for help on using the repository browser.