Skip to content

Instantly share code, notes, and snippets.

View jorgensd's full-sized avatar

Jørgen Schartum Dokken jorgensd

View GitHub Profile
@jorgensd
jorgensd / script.py
Last active May 27, 2024 15:07
Remove interior nodes from projection
import dolfin
import numpy as np
class Walls(dolfin.SubDomain):
def inside(self, x, on_boundary):
return on_boundary
class Inlet(dolfin.SubDomain):
def inside(self, x, on_boundary):
return on_boundary and dolfin.near(x[2], 0.0, 1e-6)
@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 / script.py
Last active May 14, 2024 08:53
Using PETSc for performance profiling of external packages and your own functions
# Description: Minimal working example of PETSc logging with custom decorators
# Author: Henrik Finsberg and Jørgen S. Dokken
# SPDX-License-Identifier: MIT
import time
import numpy as np
import petsc4py
import argparse
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawTextHelpFormatter):
@jorgensd
jorgensd / README.md
Last active January 26, 2024 14:41
Meshviews with common parent integration failure

Parent mesh is a 2x1 unit square mesh Submesh for cells is full mesh Submesh for facets is single facet on left side.

Testing various ways of computing the product of two functions on the common boundary (single facet)

@jorgensd
jorgensd / .gitignore
Last active January 10, 2024 12:21
Parallel mesh collision detection in python
*.xdmf
*.h5
@jorgensd
jorgensd / Dockerfile
Last active January 4, 2024 10:35
Poisson problem timings with Hypre Boomeramg
# Can be built with
# docker build --build-arg="PETSC_VERSION=3.18.5" --build-arg="PETSC_SLEPC_OPTFLAGS=-O2" -t test_petsc3185_o2 . --progress=plain
# docker build --build-arg="PETSC_VERSION=3.19.6" --build-arg="PETSC_SLEPC_OPTFLAGS=-O2" -t test_petsc3196_o2 . --progress=plain
# docker build --build-arg="PETSC_VERSION=3.20.0" --build-arg="PETSC_SLEPC_OPTFLAGS=-O2" -t test_petsc3200_o2 . --progress=plain
# docker build --build-arg="PETSC_VERSION=3.20.3" --build-arg="PETSC_SLEPC_OPTFLAGS=-O2" -t test_petsc3203_o2 . --progress=plain
FROM ubuntu:22.04 as base
@jorgensd
jorgensd / .gitignore
Last active November 19, 2023 21:22
Scripting repo traffic
repo_stats
@jorgensd
jorgensd / notes.md
Last active November 16, 2023 19:03
DOLFINx benchmark vector

8982eb7848959d1fb93df789154f63ea9b48348c

  • Basix: f1d990870908c0dc5f9d76a7d2e1923fefa78eef

  • FFCx: d5a68e676365bde8dff379e2844fcc7341e7833a

  • UFL: 0fe782c97bcd1f7cc054a21861a45d7eaf1761ed

Runtime: 6.18358e-01

0edd19f3cbed5d9acc911610aef4703410123dad

@jorgensd
jorgensd / Dockerfile
Last active October 26, 2023 09:17
Building ftetwild
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common
RUN apt-get install -y git \
cmake \
g++ \
libgmp-dev
@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