Skip to content

Instantly share code, notes, and snippets.

View jhale's full-sized avatar
🤪

Jack S. Hale jhale

🤪
View GitHub Profile
@jhale
jhale / example.py
Created November 20, 2024 14:49
Numerical Methods for Variational Problems - Canonical Ordering Nodes
def lagrange_points(cell, degree):
"""Construct the locations of the equispaced Lagrange nodes on cell.
:param cell: the :class:`~.reference_elements.ReferenceCell`
:param degree: the degree of polynomials for which to construct nodes.
:returns: a rank 2 :class:`~numpy.array` whose rows are the
coordinates of the nodes.
The implementation of this function is left as an :ref:`exercise
@jhale
jhale / README.md
Last active August 1, 2025 14:07
Spack against standard software set on uni.lu clusters

Spack for FEniCS on University of Luxembourg clusters

This should also be useful for other clusters where you want to use components (e.g. MPI, compilers) from the module system.

Setting up Spack

Start a session for building

si -N 1 -n 16 -c 1 -t 0-02:00:00 # on iris: -C broadwell or -C skylake

@jhale
jhale / maclaurin_series_sum.py
Last active October 12, 2023 11:07
Issue with summation MAMATH
import numpy as np
import scipy as sp
np.set_printoptions(precision=15)
def maclaurin_series(n):
m2pi = -2 * np.pi
ns = np.arange(0, n)
xs = np.power(m2pi, ns) / sp.special.factorial(ns)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhale
jhale / 02_some_basics.ipynb
Created May 7, 2019 14:31
UL Scientific Python Draft Notebooks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhale
jhale / 03_numpy.ipynb
Created May 7, 2019 14:29
Draft notebooks from Scientific Python UL Course
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhale
jhale / rues-seminar.ipynb
Created September 23, 2015 13:21
Solving the Poisson Problem in 20 minutes with the FEniCS Project - RUES Seminar 23/9/2015
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhale
jhale / gist:f97256a9aab4a54430ba
Created March 10, 2015 14:40
Example of how to pass command scoped options to PETSc and SLEPc using DOLFIN
import sys
# Here I make two namespaces, ns_ and A_.
# You can make as many as you want, probably
# one for every KSP/SVD/EPS in your code.
args = [sys.argv[0]] + """
--petsc.ns_svd_type lapack
--petsc.A_mat_type aij
""".split()
@jhale
jhale / .gitignore
Last active August 29, 2015 13:56
Vagrant script to setup a basic FEniCS environment on an Ubuntu Server Cloud Image
.vagrant/