Skip to content

Instantly share code, notes, and snippets.

View julesghub's full-sized avatar

Julian Giordani julesghub

View GitHub Profile
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Complex shapes in Underworld: Voxels, binvox and the Cow\n",
"\n",
"This notebook describes a possible method for importing complex geometries onto Underworld particles\n",
"\n",
@julesghub
julesghub / Dockerfile
Created September 14, 2017 05:16
uw2 docker dev with petsc-3.7.6
# get the development version
FROM underworldcode/underworld2_untested:dev
MAINTAINER [email protected]
# modify original underworldcode/underworld2 images
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive \
apt-get remove petsc-dev -yq && \
apt-get autoremove -yq && \
apt-get install -yq \
@julesghub
julesghub / gist:ab03139704b967e33f7917c38d7e98c8
Last active February 7, 2020 05:00
CodeClinic 10Aug2018
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@julesghub
julesghub / gist:b25e667825f51908886a049e766c2c29
Last active February 6, 2019 03:02
2D finite strain tensor functions
import numpy as np
# fst_var -> the swarm variable for the finite strain tensor
# vField -> the velocity field
gradV = vField.fn_gradient
srFn = fn.tensor.symmetric( gradV )
a_velocity = 0.5*(gradV[1] - gradV[2]) # angular velocity
def rotateTensor2D(t, theta):
@julesghub
julesghub / ex71.c
Last active April 8, 2019 06:13
Jules attempt at having a reflective condition on the top wall. SNES fails to converge under significant rotations (alpha). Also py3 petsc_gen_xdmf.py attached
static char help[] = "Poiseuille Flow in 2d and 3d channels with finite elements.\n\
We solve the Poiseuille flow problem in a rectangular\n\
domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\n\n";
/*F
A Poiseuille flow is a steady-state isoviscous Stokes flow in a pipe of constant cross-section. We discretize using the
finite element method on an unstructured mesh. The weak form equations are
\begin{align*}
< \nabla v, \nu (\nabla u + {\nabla u}^T) > - < \nabla\cdot v, p > + < v, \Delta \hat n >_{\Gamma_o} = 0
< q, \nabla\cdot u > = 0
@julesghub
julesghub / gist:b72ebc21c8ae6146bb4e6a5c7346c088
Created June 18, 2019 05:44
nn parallel test. Can run with 1-4 procs.
#!/usr/bin/env python
# coding: utf-8
import underworld as uw
import numpy as np
import glucifer
import time
# In[11]:
@julesghub
julesghub / k-d tree example.ipynb
Created July 1, 2019 01:24
2D k-d tree example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@julesghub
julesghub / gist:9d681e4930558dc7287e0ef7831678eb
Last active July 3, 2019 06:58
breaking OSMesa on raijin
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@julesghub
julesghub / StrainWeakening.c
Last active August 16, 2019 00:10
strainweakening in uw1
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Copyright (c) 2005-2010, Monash University
** All rights reserved.
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
@julesghub
julesghub / slcn_supg.ipynb
Last active August 19, 2019 03:11
The rotating cone problem SLCN vs SUPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.