Skip to content

Commit 2afe233

Browse files
committed
slight modifications to distributed volcanism to ensure we aren't trying to write beyond the bounds of an array
1 parent 401272c commit 2afe233

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

PhotochemPy/PhotochemPy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ def set_surfflux(self,spec,flx):
406406
raise PhotochemError('Only long-lived species can have boundary conditions')
407407
except ValueError:
408408
raise PhotochemError('species not in the model')
409-
if self.vars.lbound[ind] == 2 or self.vars.lbound[ind] == 3:
409+
if self.vars.lbound[ind] == 2:
410410
self.vars.sgflux[ind] = flx
411+
elif self.vars.lbound[ind] == 3:
412+
self.vars.distflux[ind] = flx
411413
else:
412414
print('mbound set to',self.vars.lbound[ind],'so the flux will not change')
413415

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# PhotochemPy [![Memcheck](https://img.shields.io/badge/memcheck-clean-green.svg?style=flat)]() [![Build Status](https://travis-ci.com/Nicholaswogan/PhotochemPy.svg?branch=main)](https://travis-ci.com/Nicholaswogan/PhotochemPy)
3-
PhotochemPy is a photochemical model of rocky planet's atmospheres. Given inputs, like the stellar UV flux, the atmospheric temperature structure, etc., this code will find the steady-state chemical composition of an atmosphere, or evolve atmospheres through time.
3+
PhotochemPy is a photochemical model of planet's atmospheres. Given inputs, like the stellar UV flux, the atmospheric temperature structure, etc., this code will find the steady-state chemical composition of an atmosphere, or evolve atmospheres through time.
44

55
<!-- [![Documentation Status](https://readthedocs.org/projects/photochempy/badge/?version=latest)](https://photochempy.readthedocs.io/en/latest/?badge=latest) -->
66

@@ -9,22 +9,22 @@ PhotochemPy is a Python wrapper to Fortran source code. This makes the code very
99
## Installation
1010

1111
**Requirements:**
12-
To install PhotochemPy, you must have the following installed on your system.
12+
- MacOS or any Linux OS.
1313
- `Python` (>3.6.0) with the `numpy` package. I suggest using [anaconda](https://www.anaconda.com/) to install these regardless of your operating system.
14-
- A Fortran and C compiler. I suggest the GNU compiler collection, version >9 (includes `gfortran`, `gcc`, etc.). If you are using a Mac, install it with Homebrew: `brew install gcc`. For other operating systems [follow this GNU installation guide](https://gcc.gnu.org/install/binaries.html).
14+
- A Fortran and C compiler (any should work). I suggest the GNU compiler collection (includes `gfortran`, `gcc`, etc.). If you are using a Mac, install it with Homebrew: `brew install gcc`.
1515

1616
**Python Module:** After satisfying the requirements, then follow these setups to install PhotochemPy
1717

1818
- Clone or download the github repository [`https://github.com/Nicholaswogan/PhotochemPy`](https://github.com/Nicholaswogan/PhotochemPy)
1919
- Navigate to the root directory of PhotochemPy, then install with `python -m pip install .`
2020

21-
**Fortran source:** If you prefer to use the code exclusively in Fortran, that is OK too. You can build `libphotochem` with CMake. Download or clone this respository, then from the root directory of the repository run
21+
**Fortran library:** If you prefer to use the code exclusively in Fortran, that is OK too. You can build `libphotochem` with CMake. Download or clone this respository, then from the root directory of the repository run
2222

2323
```sh
2424
mkdir build
2525
cd build
2626
cmake ..
27-
make -j # -j builds in parallel
27+
make -j
2828
```
2929

3030
## Examples/Tutorial

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
name="PhotochemPy",
1010
packages=['PhotochemPy'],
1111
python_requires='>3.6.0',
12-
version="0.2.4",
12+
version="0.2.5",
1313
license="MIT",
1414
install_requires=['numpy<=1.20','scipy'],
1515
author='Nicholas Wogan',

src/integrate.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ subroutine integrate(nsteps,converged,err)
447447
! height index (-1 given the staggered grid)
448448
! the 1 in the second postion tells minloc to return a scalar
449449
jdisth=minloc(Z,1, Z .ge. disth)-1
450-
if (disth.lt.z(1)) then
451-
jdisth = 1
450+
if (jdisth < 2) then
451+
jdisth = 2
452452
endif
453453

454454
ZTOP=Z(jdisth)-Z(1)

src/right_hand_side.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ subroutine right_hand_side(usol_flat,rhs,neq, err)
410410
! height index (-1 given the staggered grid)
411411
! the 1 in the second postion tells minloc to return a scalar
412412
jdisth=minloc(Z,1, Z .ge. disth)-1
413+
if (jdisth < 2) then
414+
jdisth = 2
415+
endif
413416

414417
ZTOP=Z(jdisth)-Z(1)
415418
ZTOP1=Z(jdisth)+0.5*DZ(jdistH)

0 commit comments

Comments
 (0)