5. Radiative transfer simulation

Examples

The user can easily learn about how to use the RT simulation tools from a shell script, ./examples/Job.csh, and the example I/O files in ./examples.

Usage of "mcarats" executables

The following executables will be installed in ./bin directory after the installation:

mcarats3d: for a 3-D model atmosphere

mcarats2d: for a 2-D model atmosphere

mcarats1d: for a 1-D model atmosphere

The usage of the RT simulation tools is, for example, as follows:

% ./bin/mcarats3d ptot solver recomp configfile newoutfile (oldoutfile)

ptot : Total number of incident photons. The format is integer or real (e.g., 1000000 or 1.0e+6)

solver : Radiative transfer solver

=0: F3D, Fully-3-Dimensional radiative transfer

=1: P3D, Partially-3-Dimensional radiative transfer

=2: ICA, Independent Column (or pixel) Approximation

recomp : Recomputation switch

=0: New experiment without previous results: Q = Qnew

=1: Recomputation/average: Q = f*Qnew + (1-f)*Qold, where f=ptot_new/(ptot_new + ptot_old)

=2: Integration/adding: Q = Qnew + Qold

configfile: Configuration file containing the namelist input

newoutfile: New output file

oldoutfile: Old file containing precomputed results (optional)

For example, when the user operates the following,

% ./bin/mcarats3d 1e5 0 0 ./examples/case3/conf_rs0067 out

then the output data file, ./out, will be generated. Next, this simulation results can be improved by adding photons:

% ./bin/mcarats3d 1e5 0 1 ./examples/case3/conf_rs0067 out2 out

The new output file, ./out2, contains results for total 200,000 incident photons. This recomputation process can be done recursively, and this function may be useful in some cases.

Possible problems

1) Invalid input format

The most frequent error is caused by invalid input format of the configuration file that contains namelist parameters. Format for namelist input may slightly differ by Fortran compiler. Please read carefully the compiler manual for valid namelist input format. In addition, if the code reported reading error of namelist input or external input files, then check the configuration file or the external input files is written in valid format as described here.

2) Invalid input values

The other common error is from invalid input values. In this case, diagnostics might be reported from the codes (in some cases). Change the values for the input variables in valid ranges. Especially, input values for a variable should be integer if the variable is declared as integer. In addition, some variables should be in specific ranges. Check also whether the arguments of each array variable are not out of bounds. See the descriptions of the input variables.

3) Output results are noisy

This may be due to small number of trajectories simulated. Increase the number ptot, in this case.

5) Bug?

In other cases, there is no advise from the developers. Please feel free to ask any question to developers, who hope to reply to all questions as long as there is enough time. If you find any bug, please report to the developers.

Tips using tools

To simulate for several similar cases with small differences, there is a useful tool,

./shl/replconfig.awk

that is an awk script. This tool can replace one parameter value in the input configuration file. A limitation is that the variable to be replaced should be scalar (i.e., not array variable). For example, we can replace the value for variable fmax in

./examples/case3/conf_rs0067

by

% awk -f ./shl/replconfig.awk fmax 0.6 < ./examples/case3/conf_rs0067 > ./conf

Then the new ./conf file contains a line as "fmax = 0.6". This is useful to perform many simulations, as follows:

% awk -f ./shl/replconfig.awk fmax 0.0 < ./examples/case3/conf_rs0067 > ./conf

% ./bin/mcarats3d 1e5 0 0 ./conf ./out-fmax0.0

% awk -f ./shl/replconfig.awk fmax 0.2 < ./examples/case3/conf_rs0067 > ./conf

% ./bin/mcarats3 1e5 0 0 ./conf ./out-fmax0.2

% awk -f ./shl/replconfig.awk fmax 0.4 < ./examples/case3/conf_rs0067 > ./conf

% ./bin/mcarats3d 1e5 0 0 ./conf ./out-fmax0.4

% awk -f ./shl/replconfig.awk fmax 0.6 < ./examples/case3/conf_rs0067 > ./conf

% ./bin/mcarats3d 1e5 0 0 ./conf ./out-fmax0.6

% awk -f ./shl/replconfig.awk fmax 0.8 < ./examples/case3/conf_rs0067 > ./conf

% ./bin/mcarats3d 1e5 0 0./conf ./out-fmax0.8

% rm -f ./conf

Quick visualization using GrADS

To quickly visualize output data from the RT codes ("mcarats*"), a tool, pgrads, is provided. This converts the output data file to GrADSformat files. If GrADS is installed in your system, you can try the followings:

% ./bin/mcarats3d 1e5 0 0 ./examples/case3/conf_rs0067 out

% ./bin/pgrads 1 3 0 ./out

% grads -l

...

ga-> open out.gd.ctl

Scanning description file: out.gd.ctl

Data file out.gd is open as file 1

LON set to 1 64

LAT set to 1 64

LEV set to 1 1

Time values set: 2000:1:0:0 2000:1:0:0

ga-> set gxout shaded

ga-> set mproj off

ga-> set clevs 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Number of clevs = 11

ga-> d rad

Contouring at clevs = 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

ga-> set t 2

Time values set: 2001:1:0:0 2001:1:0:0

ga-> set clevs 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Number of clevs = 11

ga-> d rad

Contouring at clevs = 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

ga-> quit

No hardcopy metafile open

GX package terminated

When "d rad" command is entered, the window displays images. Details of pgrads command are written here.

Next