Skip to content

Instantly share code, notes, and snippets.

@guyer
guyer / newton.ipynb
Created May 13, 2016 18:07
Jupyter notebook demonstrating Newton iterations in FIPy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guyer
guyer / crazycoupling1.ipynb
Last active July 14, 2016 16:17
Jupyter notebooks illustrating different ways to couple two equations over different spatial domains in FiPy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guyer
guyer / interpolationsDiscretizationsAndGradientsOhMy.ipynb
Last active October 18, 2020 19:04
IPython notebook illustrating some FiPy discretization and interpolation behavior
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guyer
guyer / exAztecOO.py
Last active March 5, 2018 19:59
PyTrilnos script that demonstrates memory leak even after calling `del`
#! ${PYTHON_EXECUTABLE}
# -*- python -*-
# @HEADER
# ***********************************************************************
#
# PyTrilinos: Python Interfaces to Trilinos Packages
# Copyright (2014) Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia
@guyer
guyer / conda-fipydependencies.txt
Last active April 5, 2018 02:53
conda install gmsh differences
This file has been truncated, but you can view the full file.
DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 3
TRACE conda.gateways.disk.test:file_path_is_writable(23): checking path is writable /data/guyer/miniconda2/pkgs/urls.txt
DEBUG conda.core.package_cache_data:_check_writable(236): package cache directory '/data/guyer/miniconda2/pkgs' writable: True
Solving environment: ...working... DEBUG conda.core.solve:solve_final_state(141): solving prefix /data/guyer/miniconda2/envs/fipy12
specs_to_remove: frozenset([])
specs_to_add: frozenset([MatchSpec(name=LowerStrMatch('scipy')), MatchSpec(name=LowerStrMatch('gmsh')), MatchSpec(name=LowerStrMatch('mpi4py')), MatchSpec(name=LowerStrMatch('python')), MatchSpec(name=LowerStrMatch('mayavi')), MatchSpec(name=LowerStrMatch('matplotlib')), MatchSpec(name=LowerStrMatch('trilinos')), MatchSpec(name=LowerStrMatch('pysparse')), MatchSpec(name=LowerStrMatch('numpy')), MatchSpec(name=LowerStrMatch('nomkl'))])
prune: False
TRACE conda.gateways.disk.test:file_path_is_writable(23): checking path is writable /us
@guyer
guyer / nix-shell_output.txt
Created September 5, 2018 20:44
nix output for FiPy on Mac OS X
$ nix-shell --pure
warning: dumping very large path (> 256 MiB); this may run out of memory
these derivations will be built:
/nix/store/yfyl2cq05lswwb47vj71h5fbzwpj5rk4-scikit-fmm-0.0.9.tar.gz.drv
/nix/store/2ykvqyvfp41rc1hq2vk4ys66c4msyl07-python2.7-scikit-fmm-0.0.9.drv
/nix/store/ap25cv9l4gig0sw0vxh3a4vbh967n90w-gmsh-3.0.6.drv
/nix/store/hmzya72gq1j92fj60zn2labci3ww2mlb-python2.7-tkinter-2.7.14.drv
/nix/store/mmyaxmp7zcsxnkzpiinp1q5xmfaka8is-pysparse-1.1.1-dev.tar.gz.drv
/nix/store/y86g8gr18ajb2frcis2dv474jaa1dpi3-python2.7-pysparse-1.1.1-dev.drv
/nix/store/p0kriliyjc5cgygyr4j2r1gx42qw1v17-fipy.drv
@guyer
guyer / coupledAdvectionDiffusionReaction.py
Created February 14, 2019 17:47
Cleaned up script to address [StackOverflow question](https://stackoverflow.com/q/53977269/2019542)
from fipy import *
g = 0.66
L = 10.
nx = 1000
mu1 = 1.
mu2 = 1.
K = 1.
D1 = 1.
D2 = 1.
@guyer
guyer / PCM_thermal_v0-SendOut.py
Last active April 8, 2019 21:28
Revisions to DeSantis thermal FiPy problem
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 2 15:14:40 2019
@author: ddesantis
"""
from fipy import *
import numpy as np
import matplotlib.pyplot as plt
$ gmsh test2D.geo -3 -nopopup -format msh -o teset2D.msh
Info : Running 'gmsh test2D.geo -3 -nopopup -format msh -o teset2D.msh' [Gmsh 3.0.6, 1 node, max. 1 thread]
Info : Started on Tue May 28 14:08:46 2019
Info : Reading 'test2D.geo'...
Info : Done reading 'test2D.geo'
Info : Finalized high order topology of periodic connections
Info : Meshing 1D...
Info : Meshing curve 5 (Line)
Info : Meshing curve 6 (Line)
Info : Meshing curve 7 (Line)
from fipy import CellVariable, Grid1D,Viewer, TransientTerm, DiffusionTerm, ImplicitSourceTerm
from fipy.tools import numerix
size, dl, q = 100, 3e-6, 14.1
Ds, Ks = 1e-4, 5.8e-4
order = 2
dt = dl ** 2 / (2 * Ds)
mesh = Grid1D(dx=dl, nx=size)
phi_s = CellVariable(name='substrate', mesh=mesh)