Skip to content

Commit

Permalink
Merge pull request #10 from VirtualPlanetaryLaboratory/dev
Browse files Browse the repository at this point in the history
updated documentation and re-added bp functionality
  • Loading branch information
caitlyn-wilhelm committed Dec 7, 2021
2 parents 359c518 + bec2997 commit 01b6388
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 43 deletions.
21 changes: 11 additions & 10 deletions docs/help.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
Running multi-planet
Running MultiPlanet
====================

To run :code:`multi-planet` on a large number of simulations, first run
:code:`vspace` to create the simulation folders. Then, in that same directory, type:
To run :code:`MultiPlanet` on a large number of simulations, first run :code:`VSPACE` to
create the simulation folders. Then, in that same directory, type:

.. code-block:: bash
multi-planet <input file> -c [number of cores] -q -bp -m [email]
multiplanet <input file> -c [number of cores] -q -bp -m [email]
Where the "input file" **must be the same file** used with :code:`vspace`. You can
Where the "input file" **must be the same file** used with :code:`VSPACE`. You can
specify the number of cores, but the default is the maximum number of cores.

There are three optional arguments for ``multi-planet``:
There are three optional arguments for ``MultiPlanet``:

:code:`-q`: there will be no output in the command line

:code:`-bp`: `bigplanet`_ will be ran in after ``multi-planet``.
:code:`-bp`: `BigPlanet`_ will be ran in conjunction with MultiPlanet.

.. _bigplanet: https://github.com/VirtualPlanetaryLaboratory/bigplanet
.. BigPlanet: https://github.com/VirtualPlanetaryLaboratory/bigplanet
:code:`-m`: emails the users at :code:`email` when the simulations are complete

``multi-planet`` keeps track of the status of the parameter sweep. Should the run halt
early for any reason, simply run ``multi-planet`` again it will restart all the simulations

``MultiPlanet`` keeps track of the status of the parameter sweep. Should the run halt
early for any reason, simply run ``MultiPlanet`` again it will restart all the simulations
that crashed and continue on with the parameter sweep. You can also check the status
of the parameter sweep with `mpstatus <mpstatus>`_.
13 changes: 6 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
multi-planet Documentation
==========================
MultiPlanet Documentation
=======

``multi-planet`` manages the exectution of a suite of `VPLanet <https://github.com/VirtualPlanetaryLaboratory/multi-planet>`_
simulations that were built with `VSPACE <https://github.com/VirtualPlanetaryLaboratory/vspace>`_.
``multi-planet`` performs simulations across multi-core computers and can be used to restart jobs that fail for any reason.
This repository also includes ``mpstatus``, which returns the current status of the parameter sweep.



.. toctree::
:maxdepth: 1

Expand All @@ -18,7 +16,8 @@ This repository also includes ``mpstatus``, which returns the current status of

.. note::

To maximize ``multi-planet``'s power, run ``vspace`` and ``mulit-planet -bp`` to automatically
build a bigplanet archive immediately after the simulations finish. Then create
bigplanet files from the archive as needed, and use ``bigplanet``'s scripting functions to
To maximize MultiPlanet's power, run ``VSPACE`` with the ``-bp`` option to automatically
build the [`BigPlanet`](https://github.com/VirtualPlanetaryLaboratory/bigplanet) archive
immediately after the simulations finish. Then create BigPlanet files from the
archive as needed, and use ``BigPlanet``'s scripting functions to
extract vectors and matrices for plotting, statistical analyses, etc.
12 changes: 5 additions & 7 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
Installation Guide
==================

There are two ways to install ``multi-planet``: 1) in conjunction with
There are two ways to install ``MultiPlanet``: 1) in conjunction with
`VPLanet <https://github.com/VirtualPlanetaryLaboratory/vplanet>`_ and
its other support scripts, or 2) from source.

To install bigplanet and the other ``VPLanet`` packages, use the command:
To install MultiPlanet and the other ``VPLanet`` packages, use the command:

.. code-block:: bash
python -m pip install vplanet
To install from source, first close the repo:


.. code-block:: bash
git clone https://github.com/VirtualPlanetaryLaboratory/multi-planet.git
and then go into the directory (bigplanet) and run the setup script:
and then go into the directory (MultiPlanet) and run the setup script:

.. code-block:: bash
cd multi-planet
cd multi-planet/
python setup.py install
The setup script installs the various dependencies, creates the ``multi-planet`` and ``mpstatus``
The setup script installs the various dependencies, creates the ``MultiPlanet`` and ``mpstatus``
executables, and adds them to your PATH.
10 changes: 5 additions & 5 deletions docs/mpstatus.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Status Reports
==============
Checking the status of the MultiPlanet Simulations
===================================================

To check the status of your simulations, type

.. code-block:: bash
mpstatus <input file>
where the *input file* **must be the same file** used with :code:`vspace` and
:code:`multi-planet`. The following will be printed to the command line:
where the "input file" **must be the same file** used with :code:`VSPACE` and :code:`MultiPlanet`.
The following will be printed to the command line:

.. code-block:: bash
--Multi-Planet Status--
--MultiPlanet Status--
Number of Simulations completed: 10
Number of Simulations in progress: 5
Number of Simulations remaining: 20
Expand Down
27 changes: 13 additions & 14 deletions multiplanet/multiplanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import argparse
import h5py
import numpy as np
#from bigplanet import *
#Sfrom bigplanet.bp_process import GatherData,DictToBP
from bigplanet.bp_get import GetVplanetHelp
from bigplanet.bp_process import GatherData,DictToBP

# --------------------------------------------------------------------

Expand Down Expand Up @@ -160,10 +160,9 @@ def par_worker(checkpoint_file,system_name,body_list,log_file,in_files,verbose,l

lock.acquire()
datalist = []
bigplanet == False
#if bigplanet == True:
#data = {}
#vplanet_help = GetVplanetHelp()
if bigplanet == True:
data = {}
vplanet_help = GetVplanetHelp()

with open(checkpoint_file, "r") as f:
for newline in f:
Expand Down Expand Up @@ -220,14 +219,14 @@ def par_worker(checkpoint_file,system_name,body_list,log_file,in_files,verbose,l
break
if verbose:
print(folder, "completed")
# if bigplanet == True:
# with h5py.File(h5_file, "a") as Master:
# group_name = folder.split("/")[-1]
# if group_name not in Master:
# data = GatherData(data, system_name, body_list,
# log_file, in_files, vplanet_help, folder, verbose)
# DictToBP(data, vplanet_help, Master,
# verbose, group_name, archive=True)
if bigplanet == True:
with h5py.File(h5_file, "a") as Master:
group_name = folder.split("/")[-1]
if group_name not in Master:
data = GatherData(data, system_name, body_list,
log_file, in_files, vplanet_help, folder, verbose)
DictToBP(data, vplanet_help, Master,
verbose, group_name, archive=True)
else:
for l in datalist:
if l[0] == folder:
Expand Down
9 changes: 9 additions & 0 deletions tests/Bigplanet/bpl.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sDestFolder MP_Bigplanet
sArchiveFile MP_Bigplanet.bpa

saBodyFiles earth.in venus.in sun.in

sPrimaryFile vpl.in



55 changes: 55 additions & 0 deletions tests/Bigplanet/earth.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Earthlike parameters
sName earth # Body's name
saModules radheat thermint

# Physical Properties
dMass -1.0 # Mass, negative -> Earth masses
dRadius -1.0 # Radius, negative -> Earth radii
dRotPeriod -1.0 # Rotation period, negative -> days
dObliquity 23.5
dRadGyra 0.5
# Orbital Properties
dEcc 0.0167 # Eccentricity
dSemi -1 # Semi-major axis, negative -> AU


# RADHEAT Parameters
# *Num* are in numbers of atoms, negative -> Earth vals
### 40K
d40KPowerMan -1
d40KPowerCore -1
d40KPowerCrust -1
### 232Th
d232ThPowerMan -1
d232ThPowerCore -1
d232ThPowerCrust -1
### 235U
d235UPowerMan -1
d235UPowerCore -1
d235UPowerCrust -1
### 238U
d238UPowerMan -1
d238UPowerCore -1
d238UPowerCrust -1

### THERMINT inputs.
dTMan 3000
dTCore 6000
#dViscJumpMan 2.40

saOutputOrder -Time -TMan -TUMan -TLMan -TCMB -TCore $
-HflowUMan -HflowMeltMan -RadPowerMan -RadPowerCore -RadPowerCrust $
-HflowCMB -HflowSecMan $
-TDotMan -TDotCore -TJumpLMan -TJumpUMan -RIC -RayleighMan -ViscUMan -ViscLMan $
-MeltMassFluxMan -FMeltUMan $
-MagMom -CoreBuoyTherm -CoreBuoyCompo -CoreBuoyTotal -MagPauseRad $
-BLUMan -BLLMan $
-238UPowerMan -238UNumMan -238UMassMan -238UPowerCore -238UNumCore -238UMassCore $
-238UPowerCrust -238UNumCrust -238UMassCrust $
-235UPowerMan -235UNumMan -235UMassMan -235UPowerCore -235UNumCore -235UMassCore $
-235UPowerCrust -235UNumCrust -235UMassCrust $
-232ThPowerMan -232ThNumMan -232ThMassMan -232ThPowerCore -232ThNumCore -232ThMassCore $
-232ThPowerCrust -232ThNumCrust -232ThMassCrust $
-40KPowerMan -40KNumMan -40KMassMan -40KPowerCore -40KNumCore -40KMassCore $
-40KPowerCrust -40KNumCrust -40KMassCrust ChiOC ChiIC MassChiOC MassChiIC MassOC MassIC $
-RadPowerTotal
9 changes: 9 additions & 0 deletions tests/Bigplanet/sun.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# sun parameters
sName sun
dMass 1
dSemi 0
dEcc 0
dRadius 0.00135
dLuminosity 3.846e26
sStellarModel none
saModules stellar
32 changes: 32 additions & 0 deletions tests/Bigplanet/test_bigplanet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import subprocess
import numpy as np
import os
import pathlib
import multiprocessing as mp
import warnings
import sys

def test_mp_bigplanet():
#gets current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))

#gets the number of cores on the machine
cores = mp.cpu_count()
if cores == 1:
warnings.warn("There is only 1 core on the machine",stacklevel=3)
else:
# Run vspace
if not (path / "MP_Bigplanet").exists():
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet
if not (path / ".MP_Bigplanet").exists():
subprocess.check_output(["multiplanet", "vspace.in", "-bp"], cwd=path)

file = path / "MP_Bigplanet.bpa"

assert os.path.isfile(file) == True

if __name__ == "__main__":
test_mp_bigplanet()
44 changes: 44 additions & 0 deletions tests/Bigplanet/vpl.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Example primary input file for VPLANET
sSystemName earth # System Name
iVerbose 5 # Verbosity level
bOverwrite 1 # Allow file overwrites?

# All space after a # is ignored, as is white space
# The first lowercase letter(s) denote the cast: b=boolean, i=int, d=double,
# s=string. An "a" indicates an array and multiple arguments are allowed/expected.

# List of "body files" that contain body-specific parameters
saBodyFiles sun.in $ # The host star
earth.in # Earth


# Array options can continue to the next line with a terminating "$". The $ can be
# at the end of the string or not. Comments are allowed afterwards.

# Input/Output Units
sUnitMass solar # Options: gram, kg, Earth, Neptune, Jupiter, solar
sUnitLength aU # Options: cm, m, km, Earth, Jupiter, solar, AU
sUnitTime YEARS # Options: sec, day, year, Myr, Gyr
sUnitAngle d # Options: deg, rad
sUnitTemp K

# Units specified in the primary input file are propagated into the bodies. Otherwise
# specifiy units on a per body basis in the body files.
# Most string arguments can be in any case and need only be unambiguous.

# Input/Output
bDoLog 1 # Write a log file?
iDigits 6 # Maximum number of digits to right of decimal
dMinValue 1e-10 # Minimum value of eccentricity/obliquity

# Option names must be exact in spelling and case.

# Evolution Parameters
bDoForward 1 # Perform a forward evolution?
bVarDt 1 # Use variable timestepping?
dEta 0.1 # Coefficient for variable timestepping
dStopTime 4.5e9 #1e10 # Stop time for evolution
dOutputTime 1e7 # 4.5e9 # Output timesteps (assuming in body files)

# Some options are only permitted in the primary file, some are forbidden.
# That should really be documented!
10 changes: 10 additions & 0 deletions tests/Bigplanet/vspace.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sSrcFolder .
sDestFolder MP_Bigplanet
sTrialName semi_

sBodyFile earth.in
dSemi [1, 2, n3] a

sBodyFile sun.in

sPrimaryFile vpl.in

0 comments on commit 01b6388

Please sign in to comment.