Skip to content
/ ipas Public

A Python implementation of the Ice Particle Aggregate Simulator

License

Notifications You must be signed in to change notification settings

ASRCsoft/ipas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipas

Build Status Documentation Status

A Python implementation of the Ice Particle Aggregate Simulator

Installation

pip install git+https://github.com/ASRCsoft/ipas.git

Crystals (monomers)

import numpy as np
import ipas.crystals as crys

# create a hexagonal crystal centered at (1,0,0)
crystal = crys.IceCrystal(length=4, width=6, center=[1, 0, 0])
crystal.points # get a numpy array containing the crystal vertices
# rotate the crystal 45 degrees around the y-axis and 90 degrees
# around the z-axis
crystal.rotate_to([0,np.pi/4,np.pi/2])
# return a shapely MultiLineString representing the crystal edges,
# which plots automatically in a jupyter notebook
crystal.plot()

crystal

# project the crystal onto the xy plane, returning a shapely Polygon
crystal.projectxy()

crystal_projection

Clusters (aggregates)

# use the crystal to start a cluster
cluster = crys.IceCluster(crystal)
# add a new crystal to the cluster
crystal2 = crys.IceCrystal(length=4, width=6)
cluster.add_crystal_from_above(crystal2)
cluster.plot() # same as IceCrystal.plot()

cluster

# plot the 2D projection of the cluster along with an ellipse fit to
# the area of the projection
cluster.plot_ellipse()

cluster_ellipse

Simulations

import ipas.lab as lab
# create 100 clusters of 2 crystals each with a simulation similar to
# the IDL IPAS code
batch = lab.sim_clusters(length=4, width=6, nclusters=100, ncrystals=2)
# get more information about the available options for simulating ice
# clusters
help(lab.sim_clusters)
# fit ellipses to the x-, y-, and z-axis views of the cluster and use
# them to calculate aspect ratios
batch.calc_aspect_ratios()
batch.ratios # return a list of the aspect ratios
# plot a histogram of the aspect ratios, passing arguments to
# matplotlib.pyplot.hist()
batch.plot_aspect_ratios(bins=20)

aspect_ratios

# view the first cluster in the batch
cluster = batch.clusters[0]
cluster.plot()

cluster0

About

A Python implementation of the Ice Particle Aggregate Simulator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages