Skip to content

Instantly share code, notes, and snippets.

@jorgensd
jorgensd / mwe_minimal_mesh.py
Last active March 12, 2025 12:34
Read mixed mesh in DOLFINx from VTKHDF
# Author: Jørgen S. Dokken
# SPDX-License-Identifier: MIT
import numpy as np
from mesh_converter import Mesh, CellType, vtk
points = np.array(
[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [2.0, 0.0],
[2., 2.], [3., 2.],[3,3],[2.5,2],[3, 2.5], [2.3, 2.7]], dtype=np.float64
)
@jorgensd
jorgensd / script.py
Created May 14, 2024 16:01
Write VTK HDF mesh from DOLFINx
# Author: Jørgen S. Dokken
# SPDX-License-Identifier: MIT
from pathlib import Path
from mpi4py import MPI
import h5py
@jorgensd
jorgensd / local_solver.py
Last active June 9, 2024 14:51
Local solver for DOLFINx
# Local solver using Scipy
# To be used with DOLFINx and a local-assembler
#
# Author: Jørgen S. Dokken
#
# License: MIT
import scipy
import scipy.linalg
import numpy

Install Instructions

Clone spack:

git clone https://github.com/spack/spack.git

Selecting Modules

#!/bin/bash
@jorgensd
jorgensd / mesh_checker.py
Last active June 20, 2024 11:39
Mesh topology verification, testing if there are cells that are only connected through edges or vertices
# Copyright (C) 2021 Chris Richardson, Jørgen S. Dokken
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import numba
import networkx
from collections import defaultdict
import h5py
import numpy as np
import datetime
@jorgensd
jorgensd / bash_commands.md
Last active February 27, 2025 08:13
Commands for bash file for rebuilding dolfinx/dolfinx-mpc

Bash commands

compile_demo(){
    cmake -G Ninja -B build-dir-${DOLFINX_MODE}${DOLFINX_PRECISION} -DCMAKE_BUILD_TYPE=${DOLFINX_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS="${DOLFINX_CMAKE_CXX_FLAGS}" . && ninja -j8 -C build-dir-${DOLFINX_MODE}${DOLFINX_PRECISION}
}

rebuild(){
    BASEDIR=$(pwd)
    cd /root/shared/"$1"

Docker

Install Docker and NVIDIA Container Toolkit

Docker

#Docker Installation 

sudo apt-get update
@rxaviers
rxaviers / gist:7360908
Last active December 12, 2025 14:32
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@sloria
sloria / bobp-python.md
Last active December 8, 2025 02:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens