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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gmsh | |
import numpy as np | |
from mpi4py import MPI | |
import argparse | |
rank = MPI.COMM_WORLD.rank | |
# http://www.compumag.org/jsite/images/stories/TEAM/problem30a.pdf | |
r1 = 0.02 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dolfinx | |
import numpy as np | |
import ufl | |
from mpi4py import MPI | |
gdim = 3 | |
shape = "tetrahedron" | |
degree = 1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dolfinx.plot | |
import pyvista | |
def plot(u, filename="figure.png"): | |
V = u.function_space | |
topology, cell_types = dolfinx.plot.create_vtk_topology(V) | |
# As we are dealing with a vector field, we reshape the underlying dof array to accommedate for the three dimensional space | |
num_dofs = V.dofmap.index_map.size_local + V.dofmap.index_map.num_ghosts | |
geometry = V.tabulate_dof_coordinates() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --name=test-spack ubuntu:18.04 | |
cd .. | |
apt-get update && apt-get install -y git | |
git clone https://github.com/spack/spack.git | |
apt-get install -y python | |
apt-get install -y build-essential | |
apt-get install -y make zip | |
. ./spack/share/spack/setup-env.sh | |
spack install [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Given the global indices of the master dofs in the multi point constraint, | |
/// create a new index map where all masters that where not previously ghosted | |
/// are added as ghosts. This function also converts the global master indices | |
/// @param[in] global_masters The list of master dofs (global index) | |
/// @param[in] offsets The offsets of the masters (relative to the slave | |
/// index) | |
void convert_masters_to_local_index(std::vector<std::int64_t>& global_masters, | |
std::vector<std::int32_t> offsets) | |
{ | |
dolfinx::common::Timer timer("~MPC: Create new index map a"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2021 Jørgen S. Dokken | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
# Code illustrating that the vertex to dof map for a vector CG-1 space is the identity | |
import dolfinx.io | |
from IPython import embed | |
import dolfinx | |
from mpi4py import MPI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dolfinx | |
from mpi4py import MPI | |
import ufl | |
import numpy as np | |
from petsc4py.PETSc import ScalarType | |
def transfer_submesh_data(u_parent: dolfinx.fem.Function, u_sub: dolfinx.fem.Function, | |
sub_to_parent_cells: np.ndarray, inverse: bool = False): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:22.04 | |
ENV DEB_PYTHON_INSTALL_LAYOUT=deb_system | |
RUN apt-get update && \ | |
apt-get install -q -y python3-pip | |
RUN python3 -m pip install --upgrade pip setuptools | |
RUN python3 -m pip install vaex dash numpy |
OlderNewer