Skip to content

Commit

Permalink
Merge pull request #260 from brown-ccv/241-accept-vector-for-chamber-…
Browse files Browse the repository at this point in the history
…arguments

241 accept vector for chamber arguments
  • Loading branch information
CallieHsu authored Aug 4, 2023
2 parents 588fd0d + 3ffdd10 commit edd2e9c
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 189 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ jobs:
- uses: julia-actions/julia-runtest@v1
with:
annotate: true
- uses: julia-actions/julia-runtest@v1 # for threaded code
env:
JULIA_NUM_THREADS: 2
with:
annotate: true

2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Chamber"
uuid = "4ddda095-17ec-41dd-95c9-ce16dd2a2f48"
authors = ["CallieHsu <[email protected]> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pkg.add("Chamber")
## Usage
The main function in the `Chamber` package is `chamber`, which simulates the evolution of a magma chamber over time and returns a `DataFrame` with the solution data. The function takes the following arguments:
```julia
chamber(composition, end_time, log_volume_km3, InitialConc_H2O, InitialConc_CO2, log_vfr, depth, output_dirname)
chamber(composition, end_time, log_volume_km3, InitialConc_H2O, InitialConc_CO2, log_vfr, depth, output_dirname; kwargs...)
```
### Arguments
- `composition`: The magma composition. Use `Silicic()` for rhyolite composition (arc magma) or `Mafic()` for basalt composition (rift).
Expand All @@ -28,6 +28,9 @@ chamber(composition, end_time, log_volume_km3, InitialConc_H2O, InitialConc_CO2,
- `depth`: Depth of the magma chamber in meters.
- `output_dirname`: (Optional) Name of the output directory. Defaults to current timestamp.

### Keyword Arguments
- `plotfig`: (Optional, default: `true`). Generate and plot figures for each result if true.

### Returns
A `DataFrame` containing the solution with columns:
- `time`: Simulation timestamps (sec).
Expand Down Expand Up @@ -113,6 +116,26 @@ julia> chamber(composition, end_time, log_volume_km3, InitialConc_H2O, InitialCo
```
The output directory specified by `output_dirname` contains the generated files.

### Example 3: Performing Multi-Dataset Computations
This function also allows you to perform computations for all combinations of input parameters(`log_volume_km3`, `InitialConc_H2O`, `InitialConc_CO2`, `log_vfr`, `depth`) specified by multiple datasets provided as vectors.
```julia
julia> composition = Mafic()
julia> end_time = 3e9
julia> log_volume_km3 = 0.2
julia> InitialConc_H2O = [0.01, 0.02]
julia> InitialConc_CO2 = 0.001
julia> log_vfr = -3.3
julia> depth = [7e3, 8e3]
julia> output_dirname = "MyDirname"

julia> chamber(composition, end_time, log_volume_km3, InitialConc_H2O, InitialConc_CO2, log_vfr, depth, output_dirname)
Output path: YOUR_PATH\MyDirname\vol0.2_h2o0.01_gas0.001_vfr-3.3_dep7000.0
Output path: YOUR_PATH\MyDirname\vol0.2_h2o0.01_gas0.001_vfr-3.3_dep8000.0
Output path: YOUR_PATH\MyDirname\vol0.2_h2o0.02_gas0.001_vfr-3.3_dep7000.0
Output path: YOUR_PATH\MyDirname\vol0.2_h2o0.02_gas0.001_vfr-3.3_dep8000.0
"MyDirname"
```

## Notebook for Google Colaboratory
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brown-ccv/Chamber.jl/blob/master/notebooks/notebook_for_chamber.ipynb)

Expand Down
Loading

0 comments on commit edd2e9c

Please sign in to comment.