Code Monkey home page Code Monkey logo

music-box's People

Contributors

alexjamesgarza avatar andrewjconley avatar boulderdaze avatar eadlg2 avatar k20shores avatar mattldawson avatar s-omas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

music-box's Issues

MusicBox photolysis rates from NetCDF file (Use Case 7)

Use case 7: Simple box model with photolysis rates from file

This scenario is the same as Use Case 6, except that the user has decided to drag the chamber outside and do an experiment with natural photolysis. A colleague provides a NetCDF file with typical ambient photolysis rates at the surface in the parking lot of the laboratory for every day of the year in a file named parking_lot_photo_rates.nc, which is copied to the configuration/ folder. The photo rates were measured in 2005, so the NetCDF file has one dimension named time with units of days since 0001-01-01 00:00:00 UTC (a recognized MusicBox format) and the first time in the file corresponds to 1 Jan 2005 00:00:00 UTC. The experiment is performed for 2.5 hours starting at 13:00:00 PDT (UTC-8) on June 12, 2020.

The my_config.json file is updated to:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5,
    “simulation start” : {
      “time zone” : “UTC-8”,
      “year” : 2020,
      “month” : “June”,
      “day” : 12,
      “hour” : 13
    }
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”
    }
  },
  “photolysis” : {
    “O3 O1D” : { “initial value [s-1]” : 0.0032 },
    “O3 O3P” : { “initial value [s-1]” : 0.0012 }
  },
  “evolving conditions” : {
    “emissions.csv” : { },
    “wall_loss_rates_011519.txt” : {
      “delimiter” : “;”,
      “time axis” : “columns”,
      “properties” : {
        “simtime” : {
          “MusicBox name” : “time”,
          “units” : “hr”
        },
        “*” : {
          “MusicBox name” : “LOSS.*”,
          “units” : “min-1”
        }
      }
    },
    “parking_lot_photo_rates.nc” : {
      “time offset” : { “years” : 15 },
      “properties” : {
        “*” : { “MusicBox name” : “PHOT.*” }
      }
    }
  }
}

NOTES:

  • Time units can be specified with units in the key or as date/time objects. For example, the following are equivalent:
“simulation length [hr]” : 2.5
“simulation length” : { “hours” : 2.5 }

… as are:

“time offset” : { “years” : 15 }
“time offset” : { “yr” : 15 }
“time offset [years]” : 15
“time offset [yr]” : 15

This allows for complex times to be specified:

“simulation length” : { “days” : 3, “hours” : 12, “minutes” : 30 }

Restructure music-box and related repos

Move musica library code to a separate repo named musica-core, which will be a submodule of music-box, MICM_Chemistry, TUV etc. so each of these can run tests independently of music-box

MusicBox with CAM input data (Use Case 16 - final Use Case)

Use Case 16: Box model with CAM input data

In this scenario, the user would like to use CAM output as the input data for a box model simulation with TUV photolysis rates. (Scenarios with output from other 3-D models will follow a similar pattern.) The user would like to use most chemical species concentrations from the CAM simulation data for the specified MusicBox simulation start date/time as initial conditions, and use the environmental conditions (temperature, pressure, and solar zenith angle) along with methane concentrations from the CAM simulation starting at the MusicBox simulation start date/time as evolving conditions. The output from the CAM simulation is in a file named cam_output.nc, which is copied to the configuration/ folder. The my_config.json file is created as:

{
  “initial conditions” : {
    “cam_output.nc” : {
      “format”   : “CAM”,
      “priority” : 2
    }
  },
  “evolving conditions” : {
    “cam_output.nc” : {
      “auto-map” : false,
      “format”   : “CAM”,
      “priority” : 1,
      “properties” : {
        “temperature”        : { },
        “pressure”           : { },
        “solar zenith angle” : { },
        “CH4”                : { }
      }
    }
  },
  “box model options” : {
    “grid”                    : “column”,
    “latitude [deg N]”        : 32.754828,
    “longitude [deg S]”       : -117.161289,
    “pressure [Pa]”           : 101325.0
    “start”                   : { “time zone” : “UTC-8”,
                                  “year” : 2015,
                                  “month” : 3,
                                  “day” : 15,
                                  “hour” : 12.0,
                                  “min” : 15.0 },
    “chemistry time step [m]” : 2.0,
    “output time step [h]”    : 1.0,
    “simulation length [h]”   : 24.0
  },
  “photolysis module” : { “TUV” : { } }
}

NOTES:

  • The priority properties are used in this case to indicate that the evolving values take precedence.
  • The specified pressure is used to identify the vertical layer to use for the box model
  • The vertical layer is identified based on conditions at the start of the simulation and does not change during the simulation

Specify units in MusicBox input data file (Use Case 3)

Use case 3: Units specified in input file

This scenario is the same as Use Case 2, except that the user has decided to specify the non-standard units of pressure in the input file, rather than in the configuration file. They have also chosen to use an ampersand (‘&’) as the delimiting character. They modify the init_cond.csv file to be:

CONC.NO2& CONC.NO& CONC.O3& CONC.ISOP& CONC.MONO& CONC.SESQ& ENV.temperature& ENV.pressure.atm
2.0e-7& 1.0e-7&1.0e-6& 5.0e-5& 8.0e-5& 9.0e-5& 298.0& 1.0

… and the my_config.json file to be:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”
    }
  }
}

NOTES:

  • In addition to specific characters, whitespace (spaces and tabs) may be specified as the delimiter for text files using “delimiter” : “\w”.
  • If the delimiting character is specified as whitespace (‘\w’), units (or property names) that include spaces in text files can be included as:
‘CONC.ISOP.molecule m-3’
“CONC.ISOP.molecule m-3”
CONC.ISOP.’molecule m-3’
CONC.ISOP.”molecule m-3”

Missing plots for Reaction Rates

After running the code, using the GUI, the plots for the molecule concentrations are there, but there are no reaction rates to plot.

MusicBox with BOXMOX configuration (Use Case 15)

Use Case 15: BOXMOX chamber simulation

In this scenario, the user has an existing BOXMOX configuration for their chamber experiments. First, they copy the chamber_experiment/ folder from the BOXMOX example input files to the configuration/ folder they created in the MusicBox workflow (page 1). They did not install the NetCDF library during their build of MusicBox because they only do chamber experiment modeling without TUV and with fixed photolysis rates. Thus, they use the ASCII outputs (which are the default when the NetCDF library is not included in the build). Despite the default ASCII output, we explicitly specify the output format and file name, just to show how to do this when a non-default format/name is required. The my_config.json file is then:

{
  “initial conditions” : {
    “chamber_experiment/InitialConditions.csv” : {
      “format” : “BOXMOX initial conditions”
    }
  },
  “evolving conditions” : {
    “chamber_experiment/Environment.csv” : {
      “format” : “BOXMOX environment”
    },
    “chamber_experiment/PhotolysisRates.csv” : {
      “format” : “BOXMOX photolysis rates”
    }
  },
  “box model options” : {
    “grid”                    : “box”,
    “chemistry time step [s]” : 30.0,
    “output time step [m]”    : 1.0,
    “simulation length [h]”   : 1.0
  },
  “output file” : {
    “format” : “CSV”,
    “name” : “my_output.csv”
  }
}

NOTES:

  • The conversion between property names and units from BOXMOX to MusicBox will be automatic, except when different chemical species names are used in BOXMOX input files than in the MusicBox mechanism.
  • All of the options described in Use Cases 1–14 are available in these simulations, including multiple input files with different formats.
  • Differences in species names between BOXMOX input files and MusicBox mechanisms must be provided by the user

MusicBox with TUV photolysis (Use Case 10)

Use case 10: Simple box model with TUV photolysis

The user wants to run a simple 48-hour (or any length of time) box model run with TUV photolysis. No input data exists for this scenario, so the user creates a NetCDF file in the native MusicBox format for a column of grid cells with the initial chemical species concentrations in each cell, and names the file my_initial_conditions.nc. They also create a my_evolving_conditions.nc file (also in the native MusicBox format) for 24-hour profiles of temperature, pressure, and methane and formaldehyde concentrations for each grid cell in the column and a 24-hour profile of solar zenith angle for the column, all at 2-hour intervals (or any interval they want). The environmental conditions will be reused every 24 hours to make up the 48-hour simulation time.

To run this scenario, they first copy the two NetCDF files to the configuration/ folder they created (see page 1 workflow) and write a my_config.json file that looks like this:

{
  “initial conditions” : {
    “my_initial_conditions.nc” : {}
  },
  “evolving conditions” : {
    “my_evolving_conditions.nc” : {
      “cycle time [hr]” : 24
    }
  },
  “box model options” : {
    “grid”                      : “column”,
    “pressure [Pa]”             : 101325.0,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 48.0
  },
  “photolysis module” : { “TUV” : { } }
}

They then follow the remainder of the workflow on page 1.

NOTES:

  • Because MusicBox has a standard csv and a standard NetCDF format, input files with a .nc extension (unless otherwise specified) are assumed to be in the standard format—i.e., species names, environmental condition names (temperature, pressure, etc.) and units are all in the standard MusicBox format.
  • For box model configuration properties (in this case, the time steps), MusicBox recognizes several unit abbreviations (here, min and hr, but also s, sec, m, h, hour, etc.) and makes the appropriate conversions.
  • Because TUV requires a column of data, if only a single grid cell is present in the input data, an error is returned when the model is run.
  • The order of the elements of the configuration file is arbitrary—e.g., it could have been box model options, then initial conditions, then photolysis, etc.
  • If any required property (e.g., temperature) is not present in any of the input data files and is not set in the configuration file to a constant or scaled value, then an error is returned when the model is run.
  • The input data (in this case, at 2-hour intervals) will be linearly interpolated to the chemistry time step (here, 5.0 min).
  • When the NetCDF library is used during the MusicBox build, the default output is NetCDF. However, output in ASCII csv files can be specified.
  • The simulation start time is assumed to be the earliest start time of the evolving input data, unless otherwise specified.
  • The default output file name for NetCDF output is MusicBox_output.nc, but this can be changed in the configuration file.
  • To specify ASCII output to a file named my_output.csv, you would add this to the my_config.json:
      “output file” : { “format” : “CSV”, “name” : “my_output.csv” }
  • The specified pressure is used to identify the vertical layer to use for the box model
  • The vertical layer is identified based on conditions at the start of the simulation and does not change during the simulation

MusicBox with fixed and scaled photolysis rates (Use Case 13)

Use Case 13: Simple box model with fixed and scaled photolysis rates

This scenario is the same as Use Case 12, except that the user would like to specify that O2 photolysis (which is present in the chemical mechanism but is not calculated by TUV) should be fixed at a constant value, and that propanal photolysis be calculated as the acetaldehyde photolysis rate times a scaling factor.

Again, the input files are the same as in Use Cases 10–12, but the configuration file is now:

{
  “initial conditions” : {
    “my_initial_conditions.nc” : {
      “properties” : {
        “NO”  : { “scale factor” : 0.8 },
        “NO2” : { “scale factor” : 0.8 }
      }
    }
  },
  “evolving conditions” : {
    “my_evolving_conditions.nc” : {
      “cycle time [hr]” : 24,
      “properties” : {
        “METHANE” : {
          “scale factor” : 1.05,
          “MusicBox name” : “CH4”
        }
      }
    }
  },
  “box model options” : {
    “grid”                      : “column”,
    “pressure [Pa]”             : 101325.0,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 48.0

  },
  “photolysis module” : {
    “TUV” : {
      “ACET” : {
        “MusicBox reaction name” : “C3H6O”,
        “scale factor”  : 0.92
      }
    }
  },
  “photolysis” : {
    “O2” : { “initial value [s-1]” : 2.5e-6 }
  }
}

NOTES:

  • Mapping propanal photolysis to the TUV acetaldehyde photolysis rate does not break the mapping for acetaldehyde in MusicBox—i.e., acetaldehyde and propanal are both photolyzed during the simulation.

MusicBox emissions from input file as evolving conditions (Use Case 5)

Use case 5: Simple box model with emissions

This scenario is the same as Use Case 4, except that the chamber experiment has been modified to include emissions of isoprene, monoterpenes, and sesquiterpenes that vary over the 2.5 hour experiment. The user adds a file named emissions.csv to the configuration/ folder with the following contents:

time.hr, EMIS.ISOP, EMIS.MONO, EMIS.SESQ
0.0, 0.0, 0.0, 0.0
0.2, 0.1, 0.05, 0.05
1.0, 0.2, 0.1, 0.1
1.5, 0.0, 0.0, 0.0

The EMIS. indicates an emissions rate. The my_config.json file is updated to:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”
    }
  },
  “photolysis” : {
    “O3 O1D” : { “initial value [s-1]” : 0.0032 },
    “O3 O3P” : { “initial value [s-1]” : 0.0012 }
  },
  “evolving conditions” : {
    “emissions.csv” : { }
  }
}

NOTES:

  • The non-standard units for time (hours) are specified in the emissions file
  • Because units for the emissions are not specified, they are assumed to be in the MusicBox standard units (mol m-3 s-1)
  • The emissions file uses the standard MusicBox delimiter (comma) and structure (time axis along rows)
  • During the simulation, the emissions rates are updated at the simulation times specified in the emissions file.
  • If a time specified in the emissions file (or any evolving conditions file) does not fall on a chemistry time step, the time-step that includes the specified time is split on the specified time. Output times are unchanged.

MusicBox as a preprocessor for input data (Use Case 9)

Use case 9: Preprocessing of box model data

This scenario is the same as Use Case 8, except that the user is now happy with the configuration of the model and would like to combine all the input data into a few files in standard MusicBox format to use for several experiments.

Without changing the my_config.json file from Use Case 8 and instead of running the box model, the user runs:

./MusicBox --preprocess-only out ../configuration/my_config.json

This creates a folder named out/ if it does not already exist, reads the input and configuration data, and creates three files in the out/ folder: initial_conditions.nc, evolving_conditions.nc, and my_config.json. These files contain all the data required to run Use Case 8 in standard MusicBox format, with all the configuration-specified property values and transformations moved to the initial and evolving conditions files. The my_config.json file in out/ now contains:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5,
    “simulation start” : {
      “time zone” : “UTC-8”,
      “year” : 2020,
      “month” : “June”,
      “day” : 12,
      “hour” : 13
    }
  },
  “initial conditions” : {
    “initial_conditions.nc” : { }
      “properties” : {
        “ISOP” : { “variability” : “tethered” }
      },
      “linear combinations” : {
        “NOx” : {
          “properties” : {
            “NO” : { },
            “NO2” : { }
          },
          “scale factor” : 1.2,
          “variability” : “tethered”
        }
      }
  },
  “evolving conditions” : {
    “evolving_conditions.nc” : { }
  }
}

These files can then be used to run Use Case 8.

NOTES:

  • If the NetCDF library is installed, the generated input files are in NetCDF format, otherwise they are in csv format.
  • This preprocessing tool can be used to develop the library of standard conditions that will be included in MusicBox

Plan MusicBox website

  • where would this be hosted?
  • who at NCAR could help with this?
  • what will be the content (user instructions, develop resources, published mechanisms, ...)?
  • how does this fit in with other documentation sources without duplication? (Doxygen, GitHub wiki, ...)

Last molecular concentration plot missing.

The O3 plot is broken. conc.O3 seems to exist in the csv file, but it isn't plotted

2021-01-07 17:35:02,534 - Internal Server Error: /plots/get
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/music-box-interactive/interactive/plots/views.py", line 27, in get
    buffer = output_plot(str(props))
  File "/music-box-interactive/interactive/plots/plot_setup.py", line 90, in output_plot
    subset = csv[['time', ' ' + str(prop)]]
  File "/usr/local/lib64/python3.7/site-packages/pandas/core/frame.py", line 3030, in __getitem__
    indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]
  File "/usr/local/lib64/python3.7/site-packages/pandas/core/indexing.py", line 1265, in _get_listlike_indexer
    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
  File "/usr/local/lib64/python3.7/site-packages/pandas/core/indexing.py", line 1315, in _validate_read_indexer
    raise KeyError(f"{not_found} not in index")
KeyError: "[' CONC.O3'] not in index"
[07/Jan/2021 17:35:02] "GET /plots/get?type=CONC.O3 HTTP/1.1" 500 77017
[07/Jan/2021 17:35:52] "GET /model/download HTTP/1.1" 200 53895

Use input data file with MusicBox configuration (Use Case 2)

Use Case 2: Simple box model with input file
This scenario is the same as Use Case 1, except that the user has decided to add additional species to the initial conditions of the chamber and move their concentrations and the environmental conditions to an input file. They choose a comma-separated text file in standard MusicBox format for the initial concentrations. They create a file named init_cond.csv with the following contents (the column order is arbitrary):

CONC.NO2, CONC.NO, CONC.O3, CONC.ISOP, CONC.MONO, CONC.SESQ, ENV.temperature, ENV.pressure
2.0e-7, 1.0e-7, 1.0e-6, 5.0e-5, 8.0e-5, 9.0e-5, 298.0, 1.0

Here, the CONC. prefix indicates that the property is a chemical species concentration and ENV. indicates that the property is an environmental property. The user then modifies the my_config.json file to be (differences are highlighted in red):

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5
  },
  “initial conditions” : {
    “init_cond.csv” : {
      “properties” : { 
        “ENV.pressure” : { “units” : “atm” }
      }
    }
  }
}

NOTES:

  • As the user does not specify units for the input species concentrations, they are assumed to be in the standard MusicBox units of moles m–3.
  • Temperature is in the standard units (K), but pressure is in non-MusicBox units of atm, so the user must specify the units in the configuration file.

MusicBox with species mapping and no SZA (Use Case 12)

Use Case 12: Simple box model with species name mapping and no solar zenith angle

This scenario is the same as Use Case 11, but the user received the evolving conditions from a colleague who uses the name METHANE instead of CH4. Additionally, the solar zenith angle is not present in the evolving conditions, but the latitude, longitude, time, and date (all with standard MusicBox names and units) are present.

Again, the input files are the same as Use Cases 10 and 11, but the configuration becomes:

{
  “initial conditions” : {
    “my_initial_conditions.nc” : {
      “properties” : {
        “NO”  : { “scale factor” : 0.8 },
        “NO2” : { “scale factor” : 0.8 }
      }
    }
  },
  “evolving conditions” : {
    “my_evolving_conditions.nc” : {
      “cycle time [hr]” : 24,
      “properties” : {
        “METHANE” : {
          “scale factor” : 1.05,
          “MusicBox name” : “CH4”
        }
      }
    }
  },
  “box model options” : {
    “grid”                      : “column”,
    “pressure [Pa]”             : 101325.0,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 48.0

  },
  “photolysis module” : { “TUV” : { } }
}

NOTES:

  • The solar zenith angle is automatically computed when it is not present in the evolving conditions. The computation is based on the latitude, longitude, time, and date. The configuration file does not explicitly specify this automatic computation.

Bond Dissociation Enthalpy

We need to include heating due to bond energy changes in the MUSICA system to support WACCM simulations.

In the upper atmosphere, bond dissociation enthalpy contributes to two changes in heating rates. Those heating rates start to become relevant in the upper stratosphere.

  1. Absorbed solar flux for O3 and O2 leads to both heating and bond dissociation. If one computes solar heating without removing the bond dissociation, the solar heating is too large.
  2. Polar mesospheric heating. A significant portion of the heating rate of upper atmosphere wintertime heating in the poles is due to exothermic reactions

In the CAM-chem system, these computations have been performed in two places. The exothermic heating has been computed as part of the solution of the mechanism. The bond dissociation endothermic heating has been computed as a separate (shortward of 200nm and longward of 200nm) radiative transfer (Beer's Law) computation.

MusicBox tethering and scaling (Use Case 8)

Use case 8: Simple box model with tethering and scaling

This scenario is the same as Use Case 7, but the user would like to tether the isoprene and NOx conditions to the initial conditions adjusted by a scaling factor. The my_config.json file is updated to:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5,
    “simulation start” : {
      “time zone” : “UTC-8”,
      “year” : 2020,
      “month” : “June”,
      “day” : 12,
      “hour” : 13
    }
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”,
      “properties” : {
        “CONC.ISOP” : { “variability” : “tethered” }
      },
      “linear combinations” : {
        “NOx” : {
          “properties” : {
            “CONC.NO” : { },
            “CONC.NO2” : { }
          },
          “scale factor” : 1.2,
          “variability” : “tethered”
        }
      }
    }
  },
  “photolysis” : {
    “O3 O1D” : { “initial value [s-1]” : 0.0032 },
    “O3 O3P” : { “initial value [s-1]” : 0.0012 }
  },
  “evolving conditions” : {
    “emissions.csv” : { },
    “wall_loss_rates_011519.txt” : {
      “delimiter” : “;”,
      “time axis” : “columns”,
      “properties” : {
        “simtime” : {
          “MusicBox name” : “time”,
          “units” : “hr”
        },
        “*” : {
          “MusicBox name” : “LOSS.*”,
          “units” : “min-1”
        }
      }
    },
    “parking_lot_photo_rates.nc” : {
      “time offset” : { “years” : 15 },
      “properties” : {
        “*” : { “MusicBox name” : “PHOT.*” }
      }
    }
  }
}

NOTES:

  • The name given to the linear combination (“NOx”) does not need to appear anywhere in the input data or the mechanism. It is just used to label the linear combination.
  • Scaling can also be applied to the individual species concentrations in the linear combination:
“NOx” : {
  “properties” : {
    “CONC.NO” : { “scale factor” : 0.9 },
    “CONC.NO2” : { }
  },
  “scale factor” : 1.2,
  “variability” : “tethered”
}

In this case, the tethered NOx concentration would be:

[NOx] = 1.2 * ( 0.9 * [NO] + [NO2] )
  • Fixed and prognosed variabilities can be specified with:
“variability” : “fixed”
“variability” : “prognosed”

MusicBox with multiple input files (Use Case 14)

Use Case 14: Simple box model with multiple inputs

This scenario is the same as Use Case 13, but the user has decided to use initial conditions for isoprene from a different input file (my_other_initial_conditions.nc), which is in the standard MusicBox format, and the evolving profile of formaldehyde from a different input file (my_other_evolving_conditions.nc), also in the standard MusicBox format.

The original input files from Use Cases 10–13 are unchanged, but the two new input files are added to the configuration/ folder. It is necessary to tell MusicBox not to use isoprene and formaldehyde from the original files, and to use only isoprene and formaldehyde from the new files. So, the configuration file now is:

{
  “initial conditions” : {
    “my_initial_conditions.nc” : {
      “properties” : {
        “NO”   : { “scale factor” : 0.8 },
        “NO2”  : { “scale factor” : 0.8 },
        “ISOP” : { “skip” : true }
      }
    },
    “my_other_initial_conditions.nc” : {
      “auto-map” : false,
      “properties” : {
        “ISOP” : { }
      }
    }
  },
  “evolving conditions” : {
    “my_evolving_conditions.nc” : {
      “cycle time [hr]” : 24,
      “properties” : {
        “METHANE” : {
          “scale factor” : 1.05,
          “MusicBox name” : “CH4”
        },
        “FORM” : { “skip” : true }
      }
    },
    “my_other_evolving_conditions.nc” : {
      “auto-map” : false,
      “properties” : {
        “FORM” : { }
      }
    }
  },
  “box model options” : {
    “grid”                      : “column”,
    “pressure [Pa]”             : 101325.0,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 48.0

  },
  “photolysis module” : {
    “TUV” : {
      “ACET” : {
        “MusicBox reaction name” : “C3H6O”,
        “scale factor”  : 0.92
      }
    }
  },
  “photolysis” : {
    “O2” : { “initial value [s-1]” : 2.5e-6 }
  }
}

NOTES:

  • Again, the order of the files is arbitrary.
  • The auto-map flag is true by default and specifies whether chemical species, environmental properties, photolysis reactions, etc. should be automatically mapped by name.
  • The skip flag indicates that the automatic mapping from this element (species, environmental condition, photolysis rate, etc.) should be disabled.

Allow varying-height box simulations

Allow users to specify box height as an initial/evolving condition and specify emissions rates in mol m-2 s-1. (For boundary layer simulations)

Requested by Rajesh Kumar during testing

Sponsors and Partners

At the moment, our only sponsor is NSF.

We (according to Gabi) don't have any partners.

Let's reduce the sponsorship page to NSF for right now.
Let's remove the "Partners"

Let's add a page for "Contributors" that has all the other groups and institutions.

Edge case: Run model out-of-the-box

If I start the server, and click the "Run Model" button without doing anything, the model fails
"GET /conditions/load-example?example=0 HTTP/1.1" 302 0
....
"GET /model/check-load HTTP/1.1" 200 40
['my_config.json']
{'model_connected': True}
[06/Feb/2021 13:30:24] "GET /model/run HTTP/1.1" 200 25

...

Screen Shot 2021-02-06 at 6 30 46 AM

MusicBox with NOx scaling (Use Case 11)

Use case 11: Simple box model with NOx scaling

This scenario is the same as Use Case 10, except that the user would like to do a run where the initial NO and NO2 concentrations are scaled down by 20%, and the methane concentration profile is scaled up by 5%. The input files are the same as in Use Case 10, but the configuration file is now:

{
  “initial conditions” : {
    “my_initial_conditions.nc” : {
      “properties” : {
        “NO”  : { “scale factor” : 0.8 },
        “NO2” : { “scale factor” : 0.8 }
      }
    }
  },
  “evolving conditions” : {
    “my_evolving_conditions.nc” : {
      “cycle time [hr]” : 24,
      “properties” : {
        “CH4” : { “scale factor” : 1.05 }
      }
    }
  },
  “box model options” : {
    “grid”                      : “column”,
    “pressure [Pa]”             : 101325.0,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 48.0

  },
  “photolysis module” : { “TUV” : { } }
}

NOTES:

  • White space (spaces, tabs, new lines, etc.) are ignored in the configuration file, unless they are inside quotes (“” or ‘’)

MusicBox with fixed photolysis rates (Use Case 4)

Use case 4: Simple box model with photolysis

This scenario is the same as Use Case 3, except that the chamber experiment now includes photolysis. The photolysis rate constants for the chamber are determined by the user and specified in a revised my_config.json file:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”
    }
  },
  “photolysis” : {
    “O3 O1D” : { “initial value [s-1]” : 0.0032 },
    “O3 O3P” : { “initial value [s-1]” : 0.0012 }
  }
}

NOTES:

  • The names of the photolysis reactions (“O3 O1D” and “O3 O3P”) correspond to their names in the MICM mechanism.
  • By default, when a photolysis module is not used to calculate photolysis rates, all photolysis rates are assumed to be 0.0 s-1 unless included in the input data or configuration file.
  • The photolysis rate constants remain constant throughout the simulation (i.e., lights on throughout the 2.5 hour simulation).
    Alternately, the photolysis rates could have been included in the initial conditions file under columns labeled:
PHOT.O3 O1D
PHOT.O3 O3P

User documentation

This model needs an introductory guide or user's guide. It should be part of the released docker-hub image. It should include instructions for:

  • running the model
  • documentation sources for more diverse questions
  • minor changes to the mechanism (rate constants)
  • major changes to the mechanism
  • accessing other mechanisms
  • changing the environmental conditions
  • what else?

MusicBox with non-standard loss rates file (Use Case 6)

Use case 6: Simple box model with non-standard loss rates

This scenario is the same as Use Case 5, except that the user has been provided a list of wall-loss rates for the chamber from a colleague. The loss rates are in a non-standard text file named wall_loss_rates_011519.txt that is copied to the configuration/ folder and contains:

simtime; 0.0; 0.3, 0.6, 0.9, 1.2
ISOP; 0.010, 0.012, 0.013, 0.014, 0.015
NO; 0.015, 0.016, 0.017, 0.018, 0.019
NO2; 0.015, 0.016, 0.017, 0.018, 0.019
MONO; 0.010, 0.012, 0.013, 0.014, 0.015
SESQ; 0.010, 0.012, 0.013, 0.014, 0.015

The times are in hours and the loss rates are in min-1. The my_config.json is updated to:

{
  “box model options” : {
    “grid”                      : “box”,
    “chemistry time step [min]” : 5.0,
    “output time step [hr]”     : 1.0,
    “simulation length [hr]”    : 2.5
  },
  “initial conditions” : {
    “init_cond.csv” : { 
      “delimiter” : “&”
    }
  },
  “photolysis” : {
    “O3 O1D” : { “initial value [s-1]” : 0.0032 },
    “O3 O3P” : { “initial value [s-1]” : 0.0012 }
  },
  “evolving conditions” : {
    “emissions.csv” : { },
    “wall_loss_rates_011519.txt” : {
      “delimiter” : “;”,
      “time axis” : “columns”,
      “properties” : {
        “simtime” : {
          “MusicBox name” : “time”,
          “units” : “hr”
        },
        “*” : {
          “MusicBox name” : “LOSS.*”,
          “units” : “min-1”
        }
      }
    }
  }
}

NOTES:

  • The non-standard delimiter and time axis are specified in the configuration file.
  • The simtime column is mapped to the MusicBox time and flagged as being in hours.
  • The mapping of every property in the wall loss rates file is first attempted with the prefix LOSS., which MusicBox identifies as a loss rate. If the mapping is successful, the units are specified as being in min-1. If the mapping is unsuccessful (e.g., if pressure or temperature had been specified in this file), then the original name (without the prefix) is used to do the mapping, with standard units.

Update MusicBox instructions

  • instructions for replacing an existing local copy of music-box
  • make URL a link
  • print URL like as last line in container running web service
  • review/update command-line with Docker instructions
  • add command-line w/o Docker instructions

ERROR: Edit Mechanism > Molecules > H2O > View reactions

NameError at /mechanism/searchR
name 'reaction_search' is not defined

Request URL: http://127.0.0.1:8000/mechanism/searchR?query=H2O
3.1.5
NameError
name 'reaction_search' is not defined
/music-box-interactive/interactive/mechanism/views.py, line 161, in search_reactions
/usr/bin/python3
3.7.5

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/music-box-interactive/interactive/mechanism/views.py", line 161, in search_reactions
resultlist = reaction_search(query)

Exception Type: NameError at /mechanism/searchR
Exception Value: name 'reaction_search' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.