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 2026 Jørgen S. Dokken and Simula Research Laboratory | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W |
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
| # Author Jorgen S. Dokken | |
| # SPDX license identifier: MIT | |
| import gmsh | |
| import scifem | |
| from mpi4py import MPI | |
| import basix.ufl | |
| import dolfinx.fem.petsc | |
| import ufl | |
| import numpy as np |
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 mpi4py import MPI | |
| try: | |
| from petsc4py import PETSc | |
| import dolfinx | |
| if not dolfinx.has_petsc: | |
| print("This demo requires DOLFINx to be compiled with PETSc enabled.") | |
| exit(0) |
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 ufl | |
| import basix | |
| import numpy as np | |
| from mpi4py import MPI | |
| comm = MPI.COMM_WORLD | |
| # (3) | |
| # | |
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 mpi4py import MPI | |
| import numpy as np | |
| import dolfinx | |
| import ufl | |
| import basix.ufl | |
| mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10) | |
| V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1, (2,))) | |
| u = dolfinx.fem.Function(V) |
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
| """ | |
| Hermite as coordinate element in DOLFINx | |
| Author: Jørgen S. Dokken | |
| SPDX License identifier: MIT | |
| """ | |
| from mpi4py import MPI | |
| import dolfinx | |
| import basix.ufl |
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 dataclasses import dataclass | |
| import shutil | |
| from mpi4py import MPI | |
| from petsc4py import PETSc | |
| import dolfinx.fem.petsc | |
| from dolfinx_external_operator import ( | |
| FEMExternalOperator, | |
| evaluate_external_operators, | |
| evaluate_operands, |
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 mpi4py import MPI | |
| import dolfinx | |
| import numpy as np | |
| from pathlib import Path | |
| cube = dolfinx.mesh.create_unit_cube(MPI.COMM_WORLD, nx=3, ny=3, nz=3) | |
| def left_cells(x): |
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
| # Consistently orient jump integrals on a mesh with a bifurcation | |
| # | |
| # The idea of this demo is to say that the jump at a bifurcation with three cells should be: | |
| # u(0) - u(1) - u(2) where u(0) is taken from the cell with the lowest value, while u(1) and u(2) are taken from the two other cells. | |
| # | |
| # \ / | |
| # \ u1 / u2 | |
| # \ / | |
| # \ / | |
| # \ / |
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
| # This file was generated by running | |
| # | |
| # python cmake/scripts/generate-cmakefiles.py from dolfinx/cpp | |
| # | |
| cmake_minimum_required(VERSION 3.19) | |
| set(PROJECT_NAME demo_real_space) | |
| project(${PROJECT_NAME} LANGUAGES C CXX) | |
| # Set C++20 standard |
NewerOlder