Beginner Tutorial

From krc
Revision as of 21:02, 13 July 2017 by Aaron (Talk | contribs)

Jump to: navigation, search

Contents

Download KRC or check which Version you have

To start using KRC, be sure you have already downloaded latest version. If you already have KRC, but do not know if you have the latest version, you can check which version you have here.

Once you have the latest version, it is time to start using KRC.

Getting Started

To start using KRC, you must first start the Davinci Interface. To learn more about Davinci visit the DavinciWiki

Type the following:

$ davinci
dv> 

Now, you can start using KRC.

Type the following:

dv> krc()

This command will bring up a the KRC Main Menu:

 This runs the full krc binary mode with the following inputs

IMPORTANT: This interface supports only KRC > v2.3.2

lat       = latitude **Required**
lon       = east longitude (default = 0)
body      = name of the body (Default = "Mars")
bodytype  = kind of body - "planet", "minor", "comet" (Default = "planet")
hour      = hour of day for data to return (default=-32768, all hours)
ls        = ls for data to return (default=-32768, all seasons)
INERTIA   = thermal inertia of upper layers (default from 2ppd TES)
Mat1      = material of upper layers, sets COND, DENSITY, SPEC_HEAT (Default="basalt")
Por1      = porosity of upper layers, affects DENSITY (Default=0.4)
INERTIA2  = thermal inertia of lower layers (Default from 2ppd TES)
Mat2      = material of lower layers, sets COND2, DENS2, SpHeat2 (Default="Mat1")
Por2      = porosity of lower layers, affects DENS2 (Default=Por1)
thick     = top layer thickness (default=0, no layering)
TDEEP     = set bottom layer temperature (default TDEEP=0, IB=0, insulating)
JBARE     = force frost free at specified season (default JBARE=0, no forcing)
SLOPE     = surface slope in degrees (default = 0)
ALBEDO    = albedo (default from lat,lon 2ppd TES)
TAUD      = dust visible opacity (default TAUD= 0.30)
ELEV      = elevation km (default from lat,lon 2ppd MOLA)
SLOAZI    = slope azimuth in degrees east from north (default = 0)
DELLS     = ~delta Ls desired (sets DELJUL automatically, Default = 1)
DELJUL    = delta julian date to increment by (Default = 1.9083)
DJUL      = if LKEY="T", starting Ls (Default = 0.1)
           or start julian date offset from J2000
LKEY      = use Ls DJUL input rather than jullian date (Default ="T")
JDISK     = start "season" to output (Default = 721)
N5        = number of "seasons" to run (Default = 1080)
N24       = number of outputs per day (Default = 96)
LkofT     = use temperature dependant properties (Default = "T")
TPREDICT  = use forward prediction of temperatures for speed (Default ="T")
stability = check for model stability (Default = 0)
outusage  = displays the bin52 file type usage

KRC-ONE like option:
T         = sets a one-point like mode where a TI is returned
           for the specified conditions. This can be an array.

These values are from the standard KRC input file. Defaults from above are
used in place of the master.inp file values.
 
Enter for more usage
Read TEXT file: 61 lines

Real Value Parameters (Values from default input file)
############################################################################
ALBEDO  = .25       EMISS   = 1.00      INERTIA = 200.0     COND2   = 2.77     
DENS2   = 928.0     PERIOD  = 1.0275    SPEC_HEAT= 647.      DENSITY = 1600.    
CABR    = 0.11      AMW     = 43.5      ABRPHA  = -0.00     PTOTAL  = 546.0    
FANON   = .055      TATM    = 200.      TDEEP   = 180.0     SpHeat2 = 1711.    
TAUD    = 0.3       DUSTA   = .90       TAURAT  = 0.5       TWILI   = 0.0      
ARC2    = 0.5       ARC3    = -0.00     SLOPE   = 0.0       SLOAZI  = 90.      
TFROST  = 146.0     CFROST  = 589944.   AFROST  = .65       FEMIS   = 0.95     
AF1     = 0.54      AF2     = 0.0009    FROEXT  = 50.       FD32    = 0.0      
RLAY    = 1.2000    FLAY    = .1800     CONVF   = 2.0000    DEPTH   = 0.0      
DRSET   = 0.0       DDT     = .0020     GGT     = 0.1       DTMAX   = 0.1      
DJUL    = -1222.69  DELJUL  = 17.174822 SOLARDEC= 00.0      DAU     = 1.465    
LsubS   = .0        SOLCON  = 1368.     GRAV    = 3.727     AtmCp   = 735.9    
ConUp0  = 0.038640  ConUp1  = -0.002145 ConUp2  = 0.002347  ConUp3  = -0.000750
ConLo0  = 2.766722  ConLo1  = -1.298966 ConLo2  = 0.629224  ConLo3  = -0.527291
SphUp0  = 646.6275  SphUp1  = 246.6678  SphUp2  = -49.8216  SphUp3  = 7.9520   
SphLo0  = 1710.648  SphLo1  = 721.8740  SphLo2  = 57.44873  SphLo3  = 24.37532

Enter for more
Integer Value Parameters (Values from default input file)
############################################################################
N1      = 20        N2      = 384       N3      = 15        N4      = 19       
N5      = 120       N24     = 24        IB      = 0         IC      = 7        
NRSET   = 3         NMHA    = 24        NRUN    = 0         JDISK   = 81       
IDOWN   = 0         FlxP14  = 45        FlxP15  = 65        KPREF   = 1        
K4OUT   = 52        JBARE   = 0         Notif   = 20        IDISK2  = 0        
end     = 0        

Boolean Parameters (Values from default input file)
############################################################################
LP1     = F         LP2     = T         LP3     = F         LP4     = F        
LP5     = F         LP6     = F         LPGLOB  = F         LVFA    = F        
LVFT    = F         LkofT   = F         LPORB   = T         LKEY    = F        
LSC     = F         spare   = F         LOCAL   = T         Prt76   = F        
LPTAVE  = F         Prt78   = F         Prt79   = F         L_ONE   = F        

Found Default File: $DV_SCRIPT_FILES/krc_support/porb_defaults/Mars_Mars.porb.hdf
Enter for more
K4OUT = 52.  This interface only supports bin52 output which encapsulates most of the other file formats
NOTE: Recommended parameter changes are listed in the first section.
Please use these paramters with caution. They are meant for advanced users.

N1 (the number of layers, Default=29) is calculated in the function evalN1_krc()
    This function relies on various parameters including FLAY, RLAY, length of the year
    to calculate the minimum number of layers required to reach seasonal skindepth stability
N2 (the number of calculations per day, Default=288) is calculated in the functin evalN2_krc()
    This function relies varous parameters including FLAY, N24, PERIOD

The default model iterates for 2 years before
outputing a full year (N5-JDISK) of data at 1/360th year intervals (DELJUL),
starting at DJUL=0 (in Ls), JDISK=721, DELJUL=1.9083
from 24.0/N24 to 24 by 24.0/N24 (15 minutes with N24=96).

First layer is set at FLAY=0.18 skin depths.
Each successive layer is increased by a factor of RLAY=1.2.

ALBEDO and TAUD can be dynamic if input as
2 x n x 1 arrays. Ls = column 1 and ALBEDO/TAUD = column 2

See the helplist distributed with KRC for variable meanings and default values.

C.Edwards + S.Piqueux 2/13

This menu offers quick guides to the basic input parameters

The next step is to generate simple runs with KRC.

Simple Runs

Try designating a specific location to run the KRC model.

Use the landing site of the Curiosity Rover within Gale Crater.

Latitude: 4.5o S Longitude: 137.4o E

KRC takes positive values for Northern latitudes and negative values for Southern latitudes. But KRC only takes positive values for longitude. Therefore, Western longitudes must be subtracted from 360o to be input as positive Eastern longitude values.

See the Helplist, Input Parameter Glossary. or use the KRC Main Menu to learn input parameter variable names and definitions.

dv> krc(lat=-4.5,lon=137.4)


dv> krc(lat = -4.5, lon = 137.4)

You should see the following output. If you do not see this message, check the previous line and try again.

Found Default File: $DV_SCRIPT_FILES/krc_support/porb_defaults/Mars_Mars.porb.hdf
./nfs/software/davinci_install/share/davinci//library/script_files/krc_support/ti_map2ppd_v4.vicar: VICAR bsq image: 720x360x1, 32 bits
./nfs/software/davinci_install/share/davinci//library/script_files/krc_support/albedo_2ppd.vicar: VICAR bsq image: 720x360x1, 32 bits
./nfs/software/davinci_install/share/davinci//library/script_files/krc_support/mola_2ppd.vicar: VICAR bsq image: 720x360x1, 32 bits

Running KRC model with:

Output:
    Every ~1.000 Ls (1.9083 JD) for 360 seasons starting at 0.10 Ls
    For 96 times per day, every 15 local minutes
    Running model WITH NO temperature prediction
    because DELJUL < 3.0779

For a Surface With:
    29 Layers with uniform material properties and 384 daily model time steps
    and T-dependant material properties
    and an insulating bottom edge condition

With Observation Parameters:
    LATITUDE:  -4.50    LONGITUDE: 137.40
    ELEVATION: -3.606km^    SLOPE/AZIMUTH: 0.00/0.00deg
    ALBEDO: 0.228^        OPACITY: 0.300
    HOUR: All        LS: All

Upper Material:
    INERTIA: 230.00
    CONDUCTIVITY: 0.0502*
    DENSITY: 1770.00*
    SPECIFIC HEAT: 595.55
    POROSITY: 0.40

* = derived value unless overwritten by user
^ = from TES 2ppd map unless overwritten by user
& = ajusted for max authorized value

struct, 14 elements
    tsurf: 96x1x360 array of double, bsq format [276,480 bytes]
    tbol: 96x1x360 array of double, bsq format [276,480 bytes]
    tatm: 96x1x360 array of double, bsq format [276,480 bytes]
    down_ir: 96x1x360 array of double, bsq format [276,480 bytes]
    down_vis: 96x1x360 array of double, bsq format [276,480 bytes]
    time: 96x1x1 array of float, bsq format [384 bytes]
    ls: 1x1x360 array of double, bsq format [2,880 bytes]
    lat: -4.500000000    
    elev: -3.605580091    
    layer: struct, 8 elements
        thickness: 28x2x1 array of double, bsq format [448 bytes]
        center: 28x2x1 array of double, bsq format [448 bytes]
        top: 28x2x1 array of double, bsq format [448 bytes]
        center_mass: 28x1x1 array of double, bsq format [224 bytes]
        mass_burden: 28x1x1 array of double, bsq format [224 bytes]
        thermal_scales: 28x1x1 array of double, bsq format [224 bytes]
        tmax: 28x1x360 array of double, bsq format [80,640 bytes]
        tmin: 28x1x360 array of double, bsq format [80,640 bytes]
    anc: struct, 11 elements
        krccom: struct, 5 elements...
        JDate: 1x1x360 array of double, bsq format [2,880 bytes]You need not worry about most of this output, as you will most likely not need to investigate the output or script files.  
        ref_pressure: 1x1x360 array of double, bsq format [2,880 bytes]
        taud: 1x1x360 array of double, bsq format [2,880 bytes]
        total_frost: 1x1x360 array of double, bsq format [2,880 bytes]
        avg_heat_flow: 1x1x360 array of double, bsq format [2,880 bytes]
        frost_alb: 1x1x360 array of double, bsq format [2,880 bytes]
        frost: 1x1x360 array of double, bsq format [2,880 bytes]
        tatm_predict: 1x1x360 array of double, bsq format [2,880 bytes]
        delta_t_rms: 1x1x360 array of double, bsq format [2,880 bytes]
        converge_days: 1x1x360 array of double, bsq format [2,880 bytes]
    version: "v3.2.1"
    alb: 0.2282352895    
    body: "Mars"

Interpreting the Output

You need not worry about the first few lines of output, as you will most likely not need to investigate the output or script files.

The rest of the output is a multi-element structure consisting of model outputs as well as the initial input parameters. Some of these outputs (i.e. Kinetic Surface Temperature, tsurf, Bolometeric Temperature, tbol, and Atmospheric Temperature, tatm, are three dimensional elements where the first dimension contains the values for all hours of a single day, and the third dimension contains all values for all LS of a single year.

More Runs

Now, add some more input parameters into the model. The following line is an example of possible variables that might be included in a simple run.

dv> krc(lat = -4.5, lon = 137.4, ELEV = -4.4, SLOPE = 1.2, SLOAZI = 43)

Elevation is in units of kilometers, slope and azimuth (SLOAZI) are both in degrees. The output should be similar to the previous Run, but with the new specific parameters.

Remember, you can learn more about the KRC parameters in the Helplist, Input Parameter Glossary. or use the KRC Main Menu

Plot model Parameters

Description

The ability to plot temperature variations with KRC is one of the most useful features with the KRC Davinci Interface. It provides a method to visually inspect surface properties based on changes in time over the course of a single day or an entire year.

We will be plotting the output from the previous run. You must declare this run as a variable in order to plot the output. For example, use KRC_Out.

Example 1: Diurnal Temperature

First, plot Kinetic Surface Temperature as a function of hours for a given season of the year. The seasons are contained in the element "ls". There are 360 values for possible season indicators. Keep in mind ls[1,1,90] is not LS of 90, it is index 90 of ls. LS 90 = ls[1,1,105]

dv> KRC_Out = krc(lat = -4.5, lon = 137.4, ELEV = -4.4, SLOPE = 1.2, SLOAZI = 43)

dv> pplot(KRC_Out.tsurf[,,105], Xaxis = KRC_Out.time, xlabel = "Hour", ylabel = "Kinetic Surface Temperature (K)", plot_title = "Diurnal Temperature", "Daily Temp"]


Hour1PM.png

Example 2: Seasonal Temperature

Next, plot Kinetic Surface Temperature as a function of season for a given hour of the day. The given hour of the day is defined by the


dv> pplot(KRC_Out.tsurf[52,,], Xaxis = KRC_Out.ls, xlabel = "Seasonal Indicator", ylabel = "Kinetic Surface Temperature (K)", plot_title = "Seasonal Temperature", "Seasonal Temp")


ls90.png

Example 3: Multiple Curves in Same Plot

Now, plot several times of day on the same plot throughout an entire year. Each curve represents a different time of the day. Notice the x-axis range is 0 to 360 (i.e. the full range of LS, or a full year).

dv> pplot({KRC_Out.tsurf[24,,],KRC_Out.tsurf[48,,],KRC_Out.tsurf[72,,]},{"Hour = 6 AM", "Hour = 12 PM", "Hour = 6 PM"}, xaxis = gale.ls, xlabel = "Hour", ylabel = "Kinetic Surface Temperature (K)", plot_title = "Diurnal Temperatures Changes at Specific Times", key = "top left")


Multihour Over Year.png


Example 4: Plotting an Entire Season or Day

Now, plot all seasons over an entire day. This will show how daily temperatures change over the course of a year. Each curve will represent a different time of year. Notice the x-axis range is 0 to 24 (i.e. the hours in a day).

dv> pplot(KRC_Out.tsurf[,,], Xaxis = KRC_Out.ls, xlabel = "Seasonal Indicator", ylabel = "Kinetic Surface Temperature (K)", plot_title = " Temperature", "Seasonal Temp")


full year 2.png

Knowing What to Plot Based on Analysis' Needs

The choice on what to plot completely depends on the particular science goals.

Therefore, it is paramount to understand exactly what In order to know what KRC is incredibly flexible and has a wide range of functionality. Therefore, it is important to learn the basic capability of KRC. What can it do? How does it work? How specific can conditions be adjusted within the model? In short, KRC can do a great deal and can vary almost any condition desired. The goal of this wiki page is to introduce new users to KRC and reveal the full capabilities of KRC to both general and more advanced users. Good luck, and happy modeling. Once you fully understand your science goals, and what you hope to prove, determine or represent, you can plot the output.

KRC Modes

Description

There are two modes to use within KRC; Normal and OnePoint. However, OnePoint Mode has an alternative version called Simulated OnePoint Mode.

Normal Mode

This is

OnePoint Mode

KRC OnePoint Mode is used to calculate the Thermal Inertia of a location based on surface temperature.

Type the following:

dv> krc_one()

This should bring up the KRC OnePoint Main Menu:

This runs krc in one point mode and derives TI from input temperature.

$1      = surface kinetic or bolometric temperature
lat     = latitude (default = 0)
lon     = east longitude (default = 0)
elev    = elevation km (default from lat,lon 2ppd MOLA)
alb     = albedo (default from lat,lon 2ppd TES)
tau     = dust visible opacity (default = 0.30)
slope   = surface slope in degrees (default = 0)
azim    = slope azimuth in degrees east from north (default = 0)
hour    = hour of day for data (default=2)
bol     = match to bolometric temps (default=0)
ls      = Lsubs (default=0)
struct  = Output ancillary info (default=0)

Notice the input parameters names are different from Normal Mode.


NOTE: KRC OnePoint Mode currently does not work.

Simulated OnePoint Mode

This is an unofficial mode of operation of KRC. To use this

Personal tools