### Install MoSt package Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/install.tex Standard installation sequence for the MoSt package. ```bash tar -zxvf Most16.tgz cd Most16 ./configure.sh ./most.x ``` ```bash gunzip Most16.tgz tar -xvf Most16.tar cd Most16 ./configure.sh ./most.x ``` -------------------------------- ### Install ExoPlaSim Source: https://github.com/alphaparrot/exoplasim/blob/master/README.rst Standard installation methods for the package using pip or setup.py. ```bash pip install exoplasim ``` ```bash python setup.py install ``` -------------------------------- ### Install with Optional Dependencies Source: https://github.com/alphaparrot/exoplasim/blob/master/README.rst Install ExoPlaSim with support for specific output formats like HDF5 or NetCDF. ```bash pip install exoplasim[netCDF4] ``` ```bash pip install exoplasim[HDF5] ``` ```bash pip install exoplasim[netCDF4,HDF5] ``` -------------------------------- ### Install ExoPlaSim with netCDF and HDF5 support Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/postprocessor.md Use this command to ensure the necessary dependencies for netCDF and HDF5 output formats are installed. ```default pip install exoplasim[netCDF4,HDF5] ``` -------------------------------- ### Setup Aquaplanet Simulation Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/exoplasim_tutorial.ipynb Initialize a TLaquaplanet model with specific stellar and orbital parameters. ```python proxb = exo.TLaquaplanet(workdir="proximab",modelname="proxima_b",resolution='T21',layers=10,ncpus=4,precision=8,outputtype='.nc') ``` ```python proxb.configure(startemp=3000.0, flux=1300.0,rotationperiod=11.2) ``` ```python proxb.exportcfg() ``` ```python proxb.cfgpostprocessor(ftype='regular',extension='.nc',mode='synchronous',physfilter=True) proxb.cfgpostprocessor(ftype='snapshot',extension='.nc',mode='synchronous',physfilter=True) ``` ```python proxb.run(clean=False) ``` -------------------------------- ### Namelist configuration examples Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Puma_UG_17/pumaburn.tex Configuration parameters for controlling selection, coordinate systems, and output formats. ```text HTYPE=G VTYPE=P MODLEV=2,3,4 hPa=500,1000 LATS=40 LONS=80 CODE=130,152 NETCDF=1 CYCLICAL=0 MEAN=0 HHMM=0 HEAD7=0815 MARS=1 MULTI=12 ``` -------------------------------- ### GUI Configuration File Format Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/gui.tex Example structure of the GUI.cfg file defining window properties, plot types, and geometry. ```text [Window 00] <- window number (0..8) Array:CSU <- array name Plot:ISOCS <- picture type Palette:U <- colour palette Title:Zonal Wind [m/s] <- window title Geometry: 529 299 2 3 <- width height left top [Window 01] Array:SPAN Plot:ISOSH Palette:AMPLI Title:Spherical Harmonics Ps Geometry: 529 299 535 3 ... ``` -------------------------------- ### Configure output variables via Namelist Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/pumaburn.tex Example namelist configuration for defining output variables, pressure levels, and file formats. ```text VTYPE = Pressure HTYPE = Grid CODE = 130,131,132 hPa = 200,500,700,850,1000 MEAN = 0 GRIB = 0 NETCDF = 0 ``` -------------------------------- ### exoplasim.printsysconfig(ncpus=4) Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Prints the system configuration file generated during the initial installation of ExoPlaSim. ```APIDOC ## exoplasim.printsysconfig(ncpus=4) ### Description Print the system configuration file ExoPlaSim generated on its first installation. ### Parameters - **ncpus** (int) - Optional - Number of cores you want to use. The configuration differs for single-core vs parallel execution. ### Returns - **dict** - The contents of the configuration file as a dictionary. ``` -------------------------------- ### Launch Vis5D visualization Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/graphics_vis5d.tex Start the Vis5D application with a native .v5d data file. ```bash vis5d my_data.v5d ``` -------------------------------- ### Install Most17 via Shell Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Puma_UG_17/install.tex Standard installation sequence for the Most17 package. ```bash tar -zxvf Most17.tgz cd Most17 ./configure.sh ./most.x ``` ```bash gunzip Most17.tgz tar -xvf Most17.tar cd Most17 ./configure.sh ./most.x ``` -------------------------------- ### Example GrADS control file Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/graphics_grads.tex A sample .ctl file defining the grid, time steps, and variables for GrADS. ```text DSET ^puma_m.gra UNDEF 9e+09 XDEF 64 LINEAR 0.0000 5.6250 OPTIONS YREV YDEF 32 LEVELS -85.7606 -80.2688 -74.7445 -69.2130 -63.6786 -58.1430 -52.6065 -47.0696 -41.5325 -35.9951 -30.4576 -24.9199 -19.3822 -13.8445 -8.3067 -2.7689 2.7689 8.3067 13.8445 19.3822 24.9199 30.4576 35.9951 41.5325 47.0696 52.6065 58.1430 63.6786 69.2130 74.7445 80.2688 85.7606 ZDEF 1 LINEAR 1 1 TDEF 12 LINEAR 00:00Z01jan0001 1mo VARS 3 c139 0 99 139 0 0 c151 0 99 151 0 0 c175 0 99 175 0 0 ENDVARS ``` -------------------------------- ### List directory contents Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/install.tex Displays the file structure of the MoSt installation directory. ```bash home/Most16> ls -lG -rw-r--r-- 1 1548 cc_check.c <- Used by configure.sh -rwxr-xr-x 1 57 cleanplasim <- Delete run, bld and bin for PLASIM -rwxr-xr-x 1 51 cleanpuma <- Delete run, bld and bin for PUMA drwxr-xr-x 2 4096 common <- Topography files -rwxr-xr-x 1 3911 configure.sh <- The configure script -rw-r--r-- 1 308 csub.c <- Currently unused -rw-r--r-- 1 234 f90check.f90 <- Used by configure.sh -rw-r--r-- 1 3033 FAQ <- Frequently Asked Questions drwxr-xr-x 2 4096 images <- Directory for images -rw-r--r-- 1 154 makecheck <- Used by configure.sh -rw-r--r-- 1 85 makefile <- Used to "make" most.x -rw-r--r-- 1 107844 most.c <- Source for MoSt (Model Starter) -rw-r--r-- 1 6399 NEW_IN_VERSION_16 <- New in this version drwxr-xr-x 8 4096 plasim <- Planet Simulator directory drwxr-xr-x 2 4096 postprocessor <- Postprocessor directory drwxr-xr-x 8 4096 puma <- PUMA directory -rw-r--r-- 1 839 README <- Read this first -rw-r--r-- 1 191 README_MAC_USER <- Notes for MAC user -rw-r--r-- 1 698 README_WINDOWS_USER <- Notes for Windows user ``` -------------------------------- ### Model Prolog Initialization Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/ppp_8f90_source.html Initializes the PUMA model environment by allocating arrays and calling setup routines. ```Fortran subroutine prolog use pumamod call allocate_arrays call printparameter call inigau(nlat,sid,gwd) call inilat call legpri call readnl call initpm call legini(nlat,nlpp,nesp,nlev,plavor,sid,gwd) call initfd if (mypid == NROOT) then call ppp_write_i('NLAT',1,nlat) call ppp_write_i('NLEV',1,nlev) call ppp_write_i('NHELSUA',1,nhelsua) call ppp_write_r('SIGMH',NLEV,sigmah) endif return end ``` -------------------------------- ### Factor 6 Transformation Setup and Loop Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/fft991mod_8f90_source.html Initializes indices and performs the factor 6 FFT transformation, including complex trigonometric weight applications. ```Fortran 600 CONTINUE IA=1 IB=IA+(2*M-LA)*INC1 IC=IB+2*M*INC1 ID=IC+2*M*INC1 IE=IC IF=IB JA=1 JB=JA+JINK JC=JB+JINK JD=JC+JINK JE=JD+JINK JF=JE+JINK ! IF (LA.EQ.M) GO TO 690 ! DO 620 L=1,LA I=IBASE J=JBASE !DIR$ IVDEP DO 610 IJK=1,LOT C(JA+J)=(A(IA+I)+A(ID+I))+(A(IB+I)+A(IC+I)) C(JD+J)=(A(IA+I)-A(ID+I))-(A(IB+I)-A(IC+I)) C(JB+J)=((A(IA+I)-A(ID+I))+0.5*(A(IB+I)-A(IC+I))) & -(SIN60*(B(IB+I)+B(IC+I))) C(JF+J)=((A(IA+I)-A(ID+I))+0.5*(A(IB+I)-A(IC+I))) & +(SIN60*(B(IB+I)+B(IC+I))) C(JC+J)=((A(IA+I)+A(ID+I))-0.5*(A(IB+I)+A(IC+I))) & -(SIN60*(B(IB+I)-B(IC+I))) C(JE+J)=((A(IA+I)+A(ID+I))-0.5*(A(IB+I)+A(IC+I))) & +(SIN60*(B(IB+I)-B(IC+I))) I=I+INC3 J=J+INC4 610 CONTINUE IBASE=IBASE+INC1 JBASE=JBASE+INC2 620 CONTINUE ``` ```Fortran DO 650 K=LA,KSTOP,LA KB=K+K KC=KB+KB KD=KC+KB KE=KD+KB KF=KE+KB C1=TRIGS(KB+1) S1=TRIGS(KB+2) C2=TRIGS(KC+1) S2=TRIGS(KC+2) C3=TRIGS(KD+1) S3=TRIGS(KD+2) C4=TRIGS(KE+1) S4=TRIGS(KE+2) C5=TRIGS(KF+1) S5=TRIGS(KF+2) IBASE=0 DO 640 L=1,LA I=IBASE J=JBASE !DIR$ IVDEP DO 630 IJK=1,LOT ! A11(IJK)= (A(IE+I)+A(IB+I))+(A(IC+I)+A(IF+I)) A20(IJK)=(A(IA+I)+A(ID+I))-0.5*A11(IJK) A21(IJK)=SIN60*((A(IE+I)+A(IB+I))-(A(IC+I)+A(IF+I))) B11(IJK)= (B(IB+I)-B(IE+I))+(B(IC+I)-B(IF+I)) B20(IJK)=(B(IA+I)-B(ID+I))-0.5*B11(IJK) B21(IJK)=SIN60*((B(IB+I)-B(IE+I))-(B(IC+I)-B(IF+I))) ! C(JA+J)=(A(IA+I)+A(ID+I))+A11(IJK) D(JA+J)=(B(IA+I)-B(ID+I))+B11(IJK) C(JC+J)=C2*(A20(IJK)-B21(IJK))-S2*(B20(IJK)+A21(IJK)) D(JC+J)=S2*(A20(IJK)-B21(IJK))+C2*(B20(IJK)+A21(IJK)) C(JE+J)=C4*(A20(IJK)+B21(IJK))-S4*(B20(IJK)-A21(IJK)) D(JE+J)=S4*(A20(IJK)+B21(IJK))+C4*(B20(IJK)-A21(IJK)) ! A11(IJK)=(A(IE+I)-A(IB+I))+(A(IC+I)-A(IF+I)) B11(IJK)=(B(IE+I)+B(IB+I))-(B(IC+I)+B(IF+I)) A20(IJK)=(A(IA+I)-A(ID+I))-0.5*A11(IJK) A21(IJK)=SIN60*((A(IE+I)-A(IB+I))-(A(IC+I)-A(IF+I))) B20(IJK)=(B(IA+I)+B(ID+I))+0.5*B11(IJK) B21(IJK)=SIN60*((B(IE+I)+B(IB+I))+(B(IC+I)+B(IF+I))) ! C(JD+J)=C3*((A(IA+I)-A(ID+I))+A11(IJK))-S3*((B(IA+I)+B(ID+I & ))-B11(IJK)) D(JD+J)=S3*((A(IA+I)-A(ID+I))+A11(IJK))+C3*((B(IA+I)+B(ID+I & ))-B11(IJK)) C(JB+J)=C1*(A20(IJK)-B21(IJK))-S1*(B20(IJK)-A21(IJK)) D(JB+J)=S1*(A20(IJK)-B21(IJK))+C1*(B20(IJK)-A21(IJK)) C(JF+J)=C5*(A20(IJK)+B21(IJK))-S5*(B20(IJK)+A21(IJK)) D(JF+J)=S5*(A20(IJK)+B21(IJK))+C5*(B20(IJK)+A21(IJK)) ! I=I+INC3 J=J+INC4 630 CONTINUE IBASE=IBASE+INC1 JBASE=JBASE+INC2 640 CONTINUE ``` -------------------------------- ### Read SERVICE format data in Fortran Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/Plasim_UG_16/pumaburn.tex Example demonstrating how to read the 8-element header record followed by the data field in the SERVICE format. ```Fortran INTEGER HEAD(8) REAL FIELD(64,32) ! dimensions for T21 grids READ (10,ERR=888,END=999) HEAD READ (10,ERR=888,END=999) FIELD .... 888 STOP 'I/O ERR' 999 STOP 'EOF' .... ``` -------------------------------- ### Configure Model Parameters Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/tutorial.md Set physical, orbital, and atmospheric parameters for the planet and export the configuration to a file. The export allows for easy replication of the model setup. ```pycon >>> toi700d.configure(startemp=3480.0, flux=1167.0, # Stellar parameters >>> eccentricity=0.,obliquity=0.,fixedorbit=True, # Orbital parameters >>> synchronous=True,rotationperiod=37.426, # Rotation >>> radius=1.19,gravity=11.9,aquaplanet=True, # Bulk properties >>> pN2=1.47*(1-360e-6),pCO2=1.47*360e-6,ozone=False, # Atmosphere >>> timestep=30.0,snapshots=720,physicsfilter="gp|exp|sp") # Model dynamics >>> toi700d.exportcfg() ``` -------------------------------- ### Initialize PUMA Model Execution Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/ppp_8f90_source.html The main program block handles file initialization for interface information, calls setup routines, and performs model execution. ```Fortran program ppp ! open file ppp-puma interface information if (mypid == NROOT) then open(95,file="ppp-puma.txt",form='formatted') endif call resolution call prolog call gridpoint ! close file ppp-puma interface information if (mypid == NROOT) then close(95) endif stop end ``` -------------------------------- ### Initialize GUI Environment Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Sets up X11 display connection, screen parameters, and global configuration variables. ```c void initgui_(int *model, int *debug, int *lats, int *mrpid, int *mrnum) { int x,y,w,h; int argc = 1; int i,j; unsigned long valuemask = 0; /* ignore XGCvalues and use defaults */ XGCValues values; XEvent Event; struct timeval TimeVal; // Check for big endian computer // The bitmap format ".bmp" ist little endian BigEndian = CheckEndianess(); // Set seed for random number generator from clock gettimeofday(&TimeVal,NULL); Seed = TimeVal.tv_sec; Model = *model; Debug = *debug; Latitudes = *lats; MRpid = *mrpid; MRnum = *mrnum; if (MRpid >= 0) { sprintf(wtrun,"[%d] ",MRpid); wto = strlen(wtrun); } if (Debug) printf("initgui(%d,%d)\n",Model,Debug); if ((display=XOpenDisplay(display_name)) == NULL) { fprintf(stderr,"%s: cannot connect to X server %s\n", progname, XDisplayName(display_name)); exit(1); } screen_num = DefaultScreen(display); ScreenD = XDefaultDepth(display,screen_num); ScreenW = DisplayWidth (display,screen_num); ScreenH = DisplayHeight(display,screen_num); BlackPix = BlackPixel(display,screen_num); WhitePix = WhitePixel(display,screen_num); SmallScreen = ScreenH <= 768; if (SmallScreen) { WinRows = 2; NumWin = WinCols * WinRows; Grid = 0; } if (MRnum == 2) ScreenW /= 2; /* Run with two GUI's */ /* Fix defaults for multihead displays */ if (ScreenH > ScreenW && ScreenH > 1200) ScreenH = 1200; ``` -------------------------------- ### Initialize Help Window Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Configures and maps the help window using X11 library functions. ```c XSetWMProperties(display,HelpWindow,&HelpName,NULL,NULL,0,NULL,NULL,NULL); XSelectInput(display,HelpWindow,ButtonPressMask | ExposureMask); XMapWindow(display,HelpWindow); XMoveWindow(display,HelpWindow,x,y); DrawHelpWindow(); } ``` -------------------------------- ### NameError traceback example Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/plasim/src/specs/starspec_scratch.ipynb Example of a NameError occurring when a variable is not defined in the current scope. ```text Error (truncated): [0;32m---> 25 [0;31m [0mconst1 [0m [0;34m= [0m [0;36m2 [0m [0;34m* [0m [0mplanckh [0m [0;34m* [0m [0;34m( [0m [0mcc [0m [0;34m** [0m [0;36m2 [0m [0;34m) [0m [0;34m [0m [0m [0m [1;32m 26 [0m [0mconst2 [0m [0;34m= [0m [0mconst [0m [0;34m/ [0m [0mstarbbtemp [0m [0;34m [0m [0m [1;32m 27 [0m [0;34m [0m [0m [0;31mNameError [0m: global name 'planckh' is not defined ``` -------------------------------- ### guistart Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/guimod_8f90.html Initializes the PUMA GUI environment. ```APIDOC ## subroutine guistart() ### Description Initializes the graphical user interface for the PUMA model. ``` -------------------------------- ### Initialize and Run an ExoPlaSim Model Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Demonstrates the full lifecycle of a model run, from initialization and configuration to execution and cleanup. ```pycon >>> import exoplasim as exo >>> mymodel = exo.Model(workdir="mymodel_testrun",modelname="mymodel",resolution="T21",layers=10,ncpus=8) >>> mymodel.configure() >>> mymodel.exportcfg() >>> mymodel.run(years=100,crashifbroken=True) >>> mymodel.finalize("mymodel_output") ``` -------------------------------- ### Define start and stop coordinate variables Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c.html Declares integer variables for start and stop X/Y coordinates. ```c int Start_XH ``` ```c int Start_XL ``` ```c int Start_YH ``` ```c int Start_YL ``` ```c int Stop_XH ``` ```c int Stop_XL ``` ```c int Stop_YH ``` ```c int Stop_YL ``` -------------------------------- ### Install ExoPlaSim via Conda Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/index.md Installs required compilers and the ExoPlaSim package within a conda environment, followed by system configuration. ```bash conda install -c conda-forge gcc gxx gfortran "openmpi<5.0.1" python pip install exoplasim python -c "import exoplasim; exoplasim.sysconfigure()" ``` -------------------------------- ### Initialize Parameters Display Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Sets up the graphics context for displaying parameters in the window. ```c void ShowParcs(void) { char Text[80]; int len; float V; XSetFont(display, gc, BigFont->fid); ``` -------------------------------- ### Initialize ExoPlaSim Environment Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/exoplasim_tutorial.ipynb Import necessary libraries and set up the inline plotting environment. ```python import exoplasim as exo import matplotlib.pyplot as plt import numpy as np %matplotlib inline ``` -------------------------------- ### Initialize Environment Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/plasim/src/specs/combinedspec.ipynb Imports necessary libraries for numerical computation and plotting. ```python import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` -------------------------------- ### Runtime warning output Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/plasim/src/specs/starspec_scratch.ipynb Example of a RuntimeWarning regarding overflow in exponential calculations. ```text Output: /home/adiv/.local/lib/python2.7/site-packages/ipykernel_launcher.py:33: RuntimeWarning: overflow encountered in exp ``` -------------------------------- ### Define StartButton array Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c.html Initializes the XPoint array for the start button coordinates. ```c XPoint StartButton[3] = {{50,10},{80,25},{50,40}} ``` -------------------------------- ### Get Restart Arrays Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/mpimod_8f90_source.html Retrieves spectral or grid-point data from restart files. ```fortran subroutine mpgetsp(yn,p,kdim,klev) use mpimod character (len=*) :: yn real :: p(kdim,klev) real :: z(NESP,klev) z(:,:) = 0.0 if (mypid == NROOT) call get_restart_array(yn,z,NRSP,NESP,klev) call mpscsp(z,p,klev) return end subroutine mpgetsp ``` ```fortran subroutine mpgetgp(yn,p,kdim,klev) use mpimod character (len=*) :: yn real :: p(kdim,klev) real :: z(NUGP,klev) if (mypid == NROOT) call get_restart_array(yn,z,NUGP,NUGP,klev) call mpscgp(z,p,klev) return end subroutine mpgetgp ``` -------------------------------- ### Get Restart Array Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/restartmod_8f90_source.html Retrieves a real array from the restart file by name. ```Fortran subroutine get_restart_array(yn,pa,k1,k2,k3) use restartmod character (len=*) :: yn real :: pa(k2,k3) do j = 1 , nresnum if (trim(yn) == trim(yresnam(j))) then call fileseek(yn,j) read (nreaunit) pa(1:k1,:) nlastrec = nlastrec + 1 return endif enddo if (nexcheck == 1) then write(nud,*) '*** Error in get_restart_array ***' write(nud,*) 'Requested array {',yn,'} was not found' stop endif return end subroutine get_restart_array ``` -------------------------------- ### Get Restart Integer Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/restartmod_8f90_source.html Retrieves an integer value from the restart file by name. ```Fortran subroutine get_restart_integer(yn,kv) use restartmod character (len=*) :: yn integer :: kv do j = 1 , nresnum if (trim(yn) == trim(yresnam(j))) then call fileseek(yn,j) read (nreaunit) kv nlastrec = nlastrec + 1 return endif enddo if (nexcheck == 1) then write(nud,*) '*** Error in get_restart_integer ***' write(nud,*) 'Requested integer {',yn,'} was not found' stop endif return end subroutine get_restart_integer ``` -------------------------------- ### Initialize Window Attributes and Configuration Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Sets up window titles, default attributes, and loads configuration files for the PUMA application. ```c if (ScreenW > 2 * ScreenH && ScreenW >= 2048) ScreenW /= 2; for (i = 0 ; i < NUMWIN ; ++i) { WindowTitle[i] = CharAlloc(256,"WindowTitle"); if (wto == 0) sprintf(WindowTitle[i],"Window %d",i+1); else sprintf(WindowTitle[i],"%sWindow %d",wtrun,i+1); WinAtt[i].x = -1; WinAtt[i].y = -1; WinAtt[i].w = -1; WinAtt[i].h = -1; WinAtt[i].active = 1; } CreateTestWindow(); if (MRpid >= 0) sprintf(GUI_default,"GUI_%2.2d.cfg",MRpid); ReadConfig(GUI_default); if (MRpid >= 0) sprintf(GUI_config,"GUI_last_used_%2.2d.cfg",MRpid); ReadConfig(GUI_config); LoadFonts(); CreateControlWindow(); ``` -------------------------------- ### GUI Data Output Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/puma_8f90_source.html Example of sending grid point data to the GUI interface. ```Fortran if (ngui > 0) then zcs(:,:) = csu(:,:) call guiput("CSU" // char(0) ,zcs ,NLAT,NLEV,1) zcs(:,:) = csv(:,:) call guiput("CSV" // char(0) ,zcs ,NLAT,NLEV,1) zcs(:,:) = cst(:,:) call guiput("CST" // char(0) ,zcs ,NLAT,NLEV,1) zsp(:) = span(1:NRSP) call guiput("SPAN" // char(0) ,zsp ,NCSP,-NTP1,1) endif ``` -------------------------------- ### Initialize Spectral Arrays Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/plasim/src/specs/combinedspec-snow_ice.ipynb Sets up the initial spectral data arrays and wavelength ranges for snow and ice analysis. ```python import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` ```python sbdarti = np.concatenate((np.array([.970,.970,.970,.970,.970,.970,.970,.970,.970,.970,.970, .971,.972,.973,.974,.975,.975,.975,.975,.976,.977,.978, .979,.980,.980,.980,.980,.980,.980,.980,.980,.981,.982, .983,.984,.985,.985,.985,.985,.986,.987,.988,.989,.990, .990,.990,.990,.990,.990,.990,.990,.990,.990,.990,.990, .988,.987,.986,.985,.983,.982,.981,.980,.978,.977,.976, .975,.973,.972,.971,.970,.968,.967,.966,.965,.965,.965, .965,.965,.963,.962,.961,.960,.953,.952,.951,.950,.950, .950,.950,.950,.948,.945,.943,.940,.938,.935,.933,.930, .928,.925,.923,.920,.918,.915,.913,.910,.908,.907,.906, .905,.903,.902,.901,.900,.898,.895,.893,.890,.885,.880, .875,.870,.865,.860,.855,.850,.843,.842,.841,.840,.835, .830,.825,.820,.810,.800,.790,.780,.771,.762,.753,.745, .739,.733,.727,.720,.718,.715,.713,.710,.715,.720,.725, .730,.733,.735,.738,.740,.742,.743,.744,.745,.745,.745, .745,.745,.743,.742,.741,.740,.732,.724,.716,.710,.692, .674,.656,.640,.630,.620,.610,.600,.584,.568,.552,.535, .524,.513,.502,.490,.490,.490,.490,.490,.490,.490,.490, .490,.492,.493,.494,.495,.495,.495,.495,.495,.495,.495, .495,.495,.493,.492,.491,.490,.488,.485,.483,.480,.470, .460,.450,.440,.424,.408,.392,.375,.320,.264,.198,.150, .134,.118,.101,.085,.074,.063,.051,.040,.036,.032,.028, .025,.025,.025,.025,.025,.028,.030,.033,.035,.039,.043, .047,.050,.053,.055,.058,.060,.063,.065,.068,.070,.073, .075,.078,.080,.083,.085,.088,.090,.093,.095,.098,.100, .104,.108,.112,.115,.119,.123,.126,.130,.135,.140,.145, .150,.153,.155,.158,.160,.163,.165,.168,.170,.173,.175, .178,.180,.184,.188,.192,.195,.204,.213,.222,.230,.238, .246,.254,.260,.254,.248,.242,.235,.206,.177,.148,.120, .104,.088,.072,.055,.049,.043,.037,.030,.038,.035,.033, .030,.028,.025,.023,.020,.023,.022,.021,.020,.018,.017, .016,.015,.013,.012,.011,.010,.010,.010,.010,.010,.010, .010,.010,.010,.012,.013,.014,.015,.017,.018,.019,.020, .022,.023,.024,.025,.025,.025,.025,.025,.027,.030,.032, .035,.040,.045,.050,.055,.059,.063,.067,.070,.074,.078, .082,.085,.089,.093,.097,.100,.102,.103,.104,.105,.109, .113,.117,.120,.124,.128,.132,.135,.130,.125,.120,.115, .108,.100,.092,.085,.081,.077,.073,.070,.068,.065,.063, .062,.058,.055,.053,.050,.048,.047,.046,.045,.042,.040, .038,.035,.033,.032,.031,.030,.030,.030,.030,.030,.028, .027,.026,.025,.025,.025,.025,.025,.025,.025,.025,.025, .025,.025,.025,.025,.025,.025,.025,.025,.025,.025,.025, .025,.025,.025,.025,.025,.023,.022,.021,.020,.018,.017, .016,.015,.013,.012,.011,.010,.008,.007,.006,.005,.003, .002,.001,.000]),np.zeros(264))) wlalb2 = np.zeros(len(sbdarti)) for n in range(0,len(wlalb2)): wlalb2[n] = 0.25 + (4.0-0.25)*float(n)/(len(wlalb2)-1) ``` -------------------------------- ### Configure physicsfilter parameter Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Examples of specifying physics filters using the pipe-delimited syntax. ```python physicsfilter="gp|exp|sp" ``` ```python physicsfilter="gp|cesaro" ``` -------------------------------- ### Initialize Finite Difference Parameters Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/ppp_8f90_source.html Sets up initial temperature gradients and tropopause-related scaling factors. ```Fortran subroutine initfd use pumamod dimension zrmean(nlev) zfmode0 = sqrt(2.0) zfmode1 = 1.0 / sqrt(6.0) zfmode2 = -2.0 / 3.0 * sqrt(0.4) stg(1) = zfmode0 * tgr ! Ground temperature [K] sns(3) = zfmode1 * dtns ! North-South gradient [K] sep(5) = zfmode2 * dtep ! Equator-Pole gradient [K] ! Find sigma at dtrop zttrop = tgr - dtrop * ALR ztps = (zttrop/tgr)**(GA/(ALR*GASCON)) ! The North-South and Equator-Pole gradients are defined on z=0. ! gra() modifies the gradient from full at z=0 to zero at tropopause ! PUMA aquaplanet compatibility mode (sine function used) do jlev = 1 , nlev gra(jlev) = sin(0.5 * PI * (sigma(jlev) - ztps) / (1.0-ztps)) if (gra(jlev) < 0.0) gra(jlev) = 0.0 enddo return end ``` -------------------------------- ### Tarball File Extensions Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Examples of file extensions used for tarball output formats. ```text * .tar ``` ```text * .tar.gz ``` -------------------------------- ### Initialize Control Window Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Sets up the initial state and title for the PUMA control window. ```c void [CreateControlWindow](pumax_8c.html#a32a86742844c9c69ff991885e4519233)(void) { int [X](struct_map_image_struct.html#aaa7ba55126fe38d8113c9143d2528560),Y,W,H,B,D,x,y; char Title1[256]; char *WinconTitle1; char *WinconTitle3 = {"RUN finished - click on red stop button"}; Window Rootwin; Window Child; strcpy(Title1,"Unknown model"); if (Model == 0) // PUMA { if (MRpid < 0) strcpy(Title1,"PUMA - KlimaCampus Hamburg"); else sprintf(Title1,"Run %d: PUMA - KlimaCampus Hamburg",MRpid); } ``` -------------------------------- ### Configure and Export Model Settings Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/exoplasim_tutorial.ipynb Prepare the model configuration and write the configuration file to disk. ```python earth.configure() ``` ```python earth.exportcfg() ``` -------------------------------- ### Configure otherargs parameter Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Example of passing custom namelist parameters using the otherargs dictionary. ```python otherargs={"N_RUN_MONTHS@plasim_namelist":'4',"NGUI@plasim_namelist:'1'} ``` -------------------------------- ### initgui Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/latex/pumax_8c.tex Initializes the GUI environment with model parameters. ```APIDOC ## initgui ### Description Initializes the graphical user interface for the model. This function sets up the necessary parameters for the GUI session. ### Parameters - **model** (int*) - Pointer to model identifier - **debug** (int*) - Pointer to debug flag - **lats** (int*) - Pointer to latitude configuration - **mrpid** (int*) - Pointer to process ID - **mrnum** (int*) - Pointer to model number ``` -------------------------------- ### Get Restart Integer Subroutine Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/restartmod_8f90_source.html Retrieves an integer value from the restart file based on the variable name. ```Fortran subroutine get_restart_integer(yn,kv) use restartmod character (len=*) :: yn integer :: kv do j = 1 , nresnum if (trim(yn) == trim(yresnam(j))) then ``` -------------------------------- ### Initialize Diagnostics and Output Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/puma_8f90_source.html Initializes energy and entropy diagnostics and prepares the initial service record for output if the process is the root node. ```Fortran if(nenergy > 0) then allocate(denergy(NHOR,9)) denergy(:,:)=0. endif if(nentropy > 0) then allocate(dentropy(NHOR,9)) dentropy(:,:)=0. endif if(ndheat > 1 .and. mypid == NROOT) then open(9,file=efficiency_dat,form='formatted') endif ! ! write first service record containing sigma coordinates ! if (mypid == NROOT) then if (noutput > 0) then istep = [nstep](pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89) if (istep > 0) istep = istep + nafter ! next write after restart open(40,file=puma_output,form='unformatted') call [ntomin](puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3)(istep,imin,ihour,iday,imonth,iyear) zsig(1:nlev) = sigmh(:) zsig(nlev+1:) = 0.0 write(40) 333,0,iyear*10000+imonth*100+iday,0,nlon,nlat,nlev,ntru write(40) zsig endif ! (noutput > 0) endif ! (mypid == NROOT) return end subroutine prolog ``` -------------------------------- ### Initialize Albedo Arrays Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/plasim/src/specs/combinedspec.ipynb Prepares arrays for storing albedo calculations. ```python alb1 = np.zeros(100) alb2 = np.zeros(100) albb = np.zeros(100) teffs = np.linspace(2700,6000,num=100) ``` -------------------------------- ### get(year, snapshot=False, highcadence=False) Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Retrieves an open NetCDF data object for a specific year of model output. ```APIDOC ## get(year, snapshot=False, highcadence=False) ### Description Return an open NetCDF data object for the given year. Defaults to returning time-averaged output. ### Parameters - **year** (int) - Required - Integer year of output to return. - **snapshot** (bool) - Optional - If True, return the snapshot version. - **highcadence** (bool) - Optional - If True, return the high-cadence version. ### Returns - **netCDF4.Dataset** - An open netCDF4 data object. ``` -------------------------------- ### Initialize X11 Control Window Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c_source.html Configures window geometry, size hints, and properties before mapping the window to the display. ```c else if (Model == 1) sprintf(Title1,"SAM - KlimaCampus"); else if (Model == 2) { if (MRpid < 0) sprintf(Title1,"Planet Simulator (%s) - KlimaCampus",PlanetName); else sprintf(Title1,"Run %d: Planet Simulator (%s) - KlimaCampus",MRpid,PlanetName); } else if (Model == 3) sprintf(Title1,"Planet Simulator / LSG - KlimaCampus"); else printf("*** unknown model number %d in pumax ***\n",Model); WinconTitle1 = Title1; if (CowW < 920 || CowW > ScreenW) CowW = 920; if (NumWin < 5) CowH = 6 * FixFontHeight + 5; else CowH = NumWin * FixFontHeight + 5; if (CowX < 0 || CowX > ScreenW - CowW) CowX = (ScreenW - CowW) / 2; if (CowY < 0 || CowY > ScreenBot - CowH - WinTM - WinBM) CowY = ScreenBot - CowH - WinTM - WinBM; CowSizeHints.flags = PPosition | PSize | PMinSize | PMaxSize; CowSizeHints.min_width = CowW; CowSizeHints.min_height = CowH; CowSizeHints.max_width = ScreenW - WinLM - WinRM; CowSizeHints.max_height = CowH; if (MRnum == 2 && MRpid == 1) CowX += ScreenW; if (Debug) printf("Control Window %d/%d %dx%d\n",CowX,CowY,CowW,CowH); Cow = XCreateWindow(display,RootWindow(display,screen_num), // display, parent CowX,CowY,CowW,CowH, BorderWidth,CopyFromParent,InputOutput, // border, depth, class CopyFromParent,0,NULL); // visual, valuemask, attributes XStringListToTextProperty(&WinconTitle1,1,&WinconName1); XStringListToTextProperty(&WinconTitle3,1,&WinconName3); XStringListToTextProperty(&PauseTitle,1,&WinconPause); XStringListToTextProperty(&ReadyTitle,1,&WinconReady); XSetWMProtocols(display,Cow,&Delwin,1); XSetWMProperties(display,Cow,&WinconName1,NULL, NULL,0,&CowSizeHints,&wm_hints,&class_hints); XSelectInput(display,Cow,ButtonPressMask | KeyPressMask | ExposureMask); XMapWindow(display,Cow); } ``` -------------------------------- ### GUI Configuration Strings Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/puma/dox/html/pumax_8c.html Configuration file path definitions for the GUI. ```c char GUI_config[80] = "GUI_last_used.cfg" ``` ```c char GUI_default[80] = "GUI.cfg" ``` -------------------------------- ### exoplasim.compile_pyfft() Source: https://github.com/alphaparrot/exoplasim/blob/master/docs/source/exoplasim.md Compiles or recompiles the pyfft libraries required for ExoPlaSim. This operation requires meson, ninja, gfortran, and gcc to be installed on the system. ```APIDOC ## exoplasim.compile_pyfft() ### Description Compile or recompile the pyfft libraries. Requires meson, ninja, gfortran, and gcc. ``` -------------------------------- ### Initialize Environment and Load Data Source: https://github.com/alphaparrot/exoplasim/blob/master/exoplasim/PlanetGrid.ipynb Imports necessary libraries and loads the planetary grid dimensions from a NetCDF file. ```python import netCDF4 as nc import numpy as np import matplotlib; import pylab as plt; %matplotlib inline ``` ```python from mpl_toolkits.basemap import Basemap ``` ```python dims = nc.Dataset("T21.nc","r") ``` -------------------------------- ### ExoPlaSim Earthlike Model Initialization Error Source: https://github.com/alphaparrot/exoplasim/wiki/Known-bugs Example of an Earthlike model initialization that fails on Windows 10 due to missing shell commands or file paths. ```python testplanet= exo.Earthlike(workdir="testplanet_run",modelname="TESTPLANET",ncpus=a_ncpus,resolution="T21") ```