Home > atmlab > demos > qarts_zeeman_demo.m

qarts_zeeman_demo

PURPOSE ^

QARTS_ZEEMAN_DEMO A demonstration of including Zeeman in Qarts

SYNOPSIS ^

function [f,y0,y] = qarts_zeeman_demo( varargin )

DESCRIPTION ^

 QARTS_ZEEMAN_DEMO   A demonstration of including Zeeman in Qarts

    Calculates a limb sounding spectrum at 118.75 GHz, with and without
    activating the Zeeman part.

 FORMAT   [f,y0,y] = qarts_zeeman_demo( [ ztan ] )
        
 OUT   f          Frequency grid
       y0         Calculated spectrum without activating Zeeman.
       y          Calculated spectrum with Zeeman.
 OPT   ztan       Tangent altitude. Default is 95 km.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

qarts_zeeman_demo.m

SOURCE CODE ^

0001 % QARTS_ZEEMAN_DEMO   A demonstration of including Zeeman in Qarts
0002 %
0003 %    Calculates a limb sounding spectrum at 118.75 GHz, with and without
0004 %    activating the Zeeman part.
0005 %
0006 % FORMAT   [f,y0,y] = qarts_zeeman_demo( [ ztan ] )
0007 %
0008 % OUT   f          Frequency grid
0009 %       y0         Calculated spectrum without activating Zeeman.
0010 %       y          Calculated spectrum with Zeeman.
0011 % OPT   ztan       Tangent altitude. Default is 95 km.
0012 
0013 % 2013-06-27   Created by Patrick Eriksson.
0014 
0015 
0016 function [f,y0,y] = qarts_zeeman_demo( varargin )
0017 %
0018 [ztan] = optargs( varargin, { 95e3 } );
0019 
0020 
0021 %= Atmlab settings
0022 %
0023 arts_xmldata_path = atmlab( 'ARTS_XMLDATA_PATH' );
0024 %
0025 if isnan( arts_xmldata_path )
0026   error('You need to ARTS_XMLDATA_PATH to run this example.');
0027 end
0028 %
0029 fascod = fullfile( arts_xmldata_path, 'planets', 'Earth', 'Fascod' );
0030 
0031   
0032 %= Init Q structures
0033 %
0034 Q  = qarts;
0035 %
0036 Q.INCLUDES              = { fullfile( 'ARTS_INCLUDES', 'general.arts' ), ...
0037                             fullfile( 'ARTS_INCLUDES', 'agendas.arts' ), ...
0038                             fullfile( 'ARTS_INCLUDES', 'continua.arts' ), ...
0039                             fullfile( 'ARTS_INCLUDES', 'planet_earth.arts' ) };
0040 
0041 
0042 %= De-activate parts not used
0043 %
0044 Q.CLOUDBOX_DO           = false;
0045 Q.J_DO                  = false;
0046 Q.SENSOR_DO             = false;
0047 
0048 
0049 %= Define agendas
0050 %
0051 % Here we do it by using the predefined agenda templates.
0052 % This works only if the pre-defined agenda is names following the pattern:
0053 %    name_of_agenda__(Something)
0054 %
0055 Q.PPATH_AGENDA               = { 'ppath_agenda__FollowSensorLosPath'   };
0056 Q.PPATH_STEP_AGENDA          = { 'ppath_step_agenda__GeometricPath'    };
0057 Q.BLACKBODY_RADIATION_AGENDA = { 'blackbody_radiation_agenda__Planck'  };
0058 Q.IY_SPACE_AGENDA            = { 'iy_space_agenda__CosmicBackground'   };
0059 Q.IY_SURFACE_AGENDA          = { 'iy_surface_agenda__UseSurfaceRtprop' };
0060 Q.IY_MAIN_AGENDA             = { 'iy_main_agenda__Emission'            };
0061 
0062 
0063 %= Atmospheric species
0064 %
0065 Q.ABS_SPECIES(1).TAG{1}  = 'O2';
0066 Q.ABS_SPECIES(1).ATMDATA = gf_artsxml( fullfile( fascod, 'subarctic-summer', ...
0067                             'subarctic-summer.O2.xml' ), 'O2', 'vmr_field' ); 
0068 
0069 
0070 %= Temperature and geoemtrical altitudes are taken from CIRA86
0071 %
0072 Q.T.ATMDATA              = gf_artsxml( fullfile( arts_xmldata_path, ...
0073          'climatology', 'cira86', 'cira86.t.xml' ), 'Temperature', 't_field' );
0074 Q.Z.ATMDATA              = gf_artsxml( fullfile( arts_xmldata_path, ...
0075            'climatology', 'cira86', 'cira86.z.xml' ), 'Altitudes', 'z_field' );
0076 
0077 
0078 %= Set-up atmosphere and surface
0079 %
0080 Q.ATMOSPHERE_DIM       = 3;
0081 %
0082 Q.P_GRID               = z2p_simple( [0:1e3:120e3]' );
0083 %
0084 Q.LAT_GRID             = [60:2:80]'; 
0085 Q.LON_GRID             = [0:4:40]'; 
0086 %
0087 Q.REFELLIPSOID         = ellipsoidmodels( 'SphericalEarth' );
0088 Q.Z_SURFACE            = repmat( 500, length(Q.LAT_GRID), length(Q.LON_GRID));
0089 %
0090 mjd                    = date2mjd( 2008, 2, 15 ); % A dummy date
0091 %
0092 Q.VMR_FIELD            = qarts_vmr_field( Q );
0093 Q.T_FIELD              = qarts_atm_field( Q, 't', mjd );
0094 Q.Z_FIELD              = qarts_atm_field( Q, 'z', mjd );
0095 
0096 
0097 %= Absorption
0098 %
0099 Q.F_GRID               = 1.187503430e+11 + linspace( -5e6, 5e6, 201 )';
0100 %
0101 Q.ABS_LINES_FORMAT     = 'Hitran';
0102 Q.ABS_LINES            = fullfile( atmlab_example_data , 'line118ghz.hit' );
0103 %
0104 Q.ABSORPTION           = 'OnTheFly';
0105 
0106 
0107 %= Set RTE variables
0108 %
0109 Q.YCALC_WSMS           = { 'yCalc' };
0110 %
0111 Q.STOKES_DIM           = 4;
0112 Q.PPATH_LMAX           = 5e3;
0113 Q.IY_UNIT              = 'RJBT';
0114 %
0115 zplat                  = 600e3;
0116 Q.SENSOR_POS           = [ zplat, 49, 12 ];
0117 %
0118 Q.SENSOR_LOS           = [ geomztan2za(Q.REFELLIPSOID(1),zplat,ztan), 5 ];
0119 
0120 
0121 %= Make sure magnetic fields are zero
0122 %
0123 Q.MAG_U_FIELD          = [];
0124 Q.MAG_V_FIELD          = [];
0125 Q.MAG_W_FIELD          = [];
0126 
0127 
0128 %= Calculate spectrum
0129 %
0130 y0 = arts_y( Q );
0131 %
0132 f = Q.F_GRID;
0133 
0134 
0135 % Repeat with Zeeman activated
0136 %
0137 testdatafolder = fullfile( fileparts(atmlab('ARTS_INCLUDES')), 'testdata' );
0138 magdatafolder  = fullfile( atmlab('ARTS_XMLDATA_PATH'), 'planets', ...
0139                                                           'Earth', 'IGRF' );
0140 
0141 Q.ABS_SPECIES(1).TAG{1}   = 'O2-Z-66';
0142 %
0143 Q.PROPMAT_CLEARSKY_AGENDA = { 'propmat_clearsky_agenda__OnTheFly_Zeeman' };
0144 %
0145 Q.WSMS_AT_START{end+1} = [ 'ReadXML( isotopologue_quantum, "', ...
0146                           fullfile(testdatafolder,'isoquantum.xml'), '")' ];
0147 %
0148 Q.MAG_U.ATMDATA        = gf_artsxml( fullfile( magdatafolder, ...
0149                                 'IGRF11_2010_200km-5deg-5deg.B_u.xml.gz' ),...
0150                                      'Magnetic u-component', 'mag_field' ); 
0151 Q.MAG_V.ATMDATA        = gf_artsxml( fullfile( magdatafolder, ...
0152                                 'IGRF11_2010_200km-5deg-5deg.B_v.xml.gz' ),...
0153                                      'Magnetic v-component', 'mag_field' ); 
0154 Q.MAG_W.ATMDATA        = gf_artsxml( fullfile( magdatafolder, ...
0155                                 'IGRF11_2010_200km-5deg-5deg.B_w.xml.gz' ),...
0156                                      'Magnetic w-component', 'mag_field' ); 
0157 % Qpack2 makes this automatically:
0158 Q.MAG_U_FIELD          = qarts_atm_field( Q, 'mag_u', mjd );
0159 Q.MAG_V_FIELD          = qarts_atm_field( Q, 'mag_v', mjd );
0160 Q.MAG_W_FIELD          = qarts_atm_field( Q, 'mag_w', mjd );
0161 %
0162 y = arts_y( Q );
0163   
0164 
0165 %= Plot
0166 %
0167 if ~nargout
0168   i = 1 : Q.STOKES_DIM : length(y0);
0169   plot( Q.F_GRID/1e9, y0(i), Q.F_GRID/1e9, y(i) );
0170   xlabel( 'Frequency [GHz]' )
0171   ylabel( 'Brightness temperature [K]' )
0172   legend( 'I without Zeeman', 'I with Zeeman' )
0173 end
0174

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005