Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request, push]
jobs:
benchmark:
runs-on: ubuntu-latest
container: dolfinx/dolfinx:v0.9.0
container: dolfinx/dolfinx:v0.10.0

steps:
- name: Checkout code
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ on: [pull_request, push]

jobs:
run-tests:
name: run-tests (fenics-dolfinx v${{ matrix.dolfinx }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
dolfinx: ['0.9.0', '0.10.0']

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -20,7 +26,7 @@ jobs:
- name: Create Conda environment
shell: bash -l {0}
run: |
conda install -c conda-forge fenics-dolfinx=0.9.0 scifem adios4dolfinx
conda install -c conda-forge fenics-dolfinx=${{ matrix.dolfinx }} scifem adios4dolfinx

- name: Install local package and dependencies
shell: bash -l {0}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ on: [pull_request, push]

jobs:
run-tests:
name: run-tests (fenics-dolfinx ${{ matrix.container_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container_version: [v0.9.0, nightly]
container_version: [v0.9.0, v0.10.0, nightly]
container: dolfinx/dolfinx:${{ matrix.container_version }}
steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ lint = ["ruff", "mypy"]
docs = ["sphinx", "sphinx-book-theme", "sphinx-design", "matplotlib"]

[project.urls]
Homepage = "https://github.com/RemDelaporteMathurin/FESTIM"
Issues = "https://github.com/RemDelaporteMathurin/FESTIM/issues"
Homepage = "https://github.com/festim-dev/FESTIM"
Issues = "https://github.com/festim-dev/FESTIM/issues"


[tool.setuptools_scm]
Expand Down
5 changes: 2 additions & 3 deletions src/festim/exports/average_surface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from dolfinx import fem
from scifem import assemble_scalar

from festim.exports.surface_quantity import SurfaceQuantity
Expand Down Expand Up @@ -27,6 +26,6 @@ def compute(self, ds):
"""

self.value = assemble_scalar(
fem.form(self.field.solution * ds(self.surface.id))
) / assemble_scalar(fem.form(1 * ds(self.surface.id)))
self.field.solution * ds(self.surface.id)
) / assemble_scalar(1 * ds(self.surface.id))
self.data.append(self.value)
5 changes: 2 additions & 3 deletions src/festim/exports/average_volume.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from dolfinx import fem
from scifem import assemble_scalar

from festim.exports.volume_quantity import VolumeQuantity
Expand Down Expand Up @@ -26,6 +25,6 @@ def compute(self, u, dx, entity_maps=None):
subdomain, and appends it to the data list
"""
self.value = assemble_scalar(
fem.form(u * dx(self.volume.id), entity_maps=entity_maps)
) / assemble_scalar(fem.form(1 * dx(self.volume.id)))
u * dx(self.volume.id), entity_maps=entity_maps
) / assemble_scalar(1 * dx(self.volume.id))
self.data.append(self.value)
5 changes: 1 addition & 4 deletions src/festim/exports/total_surface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ufl
from dolfinx import fem
from scifem import assemble_scalar

from festim.exports.surface_quantity import SurfaceQuantity
Expand Down Expand Up @@ -29,7 +28,5 @@ def compute(self, ds: ufl.Measure):
Args:
ds (ufl.Measure): surface measure of the model
"""
self.value = assemble_scalar(
fem.form(self.field.solution * ds(self.surface.id))
)
self.value = assemble_scalar(self.field.solution * ds(self.surface.id))
self.data.append(self.value)
5 changes: 1 addition & 4 deletions src/festim/exports/total_volume.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ufl
from dolfinx import fem
from scifem import assemble_scalar

from festim.exports.volume_quantity import VolumeQuantity
Expand Down Expand Up @@ -31,7 +30,5 @@ def compute(self, u, dx: ufl.Measure, entity_maps=None):
dx: volume measure of the model
entity_maps: entity maps relating parent mesh and submesh
"""
self.value = assemble_scalar(
fem.form(u * dx(self.volume.id), entity_maps=entity_maps)
)
self.value = assemble_scalar(u * dx(self.volume.id), entity_maps=entity_maps)
self.data.append(self.value)
1 change: 0 additions & 1 deletion src/festim/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ def create_solver(self):
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_mat_solver_type": linear_solver,
"snes_monitor": None,
}
else:
petsc_options = self.petsc_options
Expand Down
40 changes: 21 additions & 19 deletions test/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from petsc4py import PETSc

import basix
import dolfinx
import numpy as np
import tqdm.autonotebook
from dolfinx.fem import (
Expand All @@ -17,12 +18,9 @@
locate_dofs_geometrical,
locate_dofs_topological,
)
from dolfinx.fem.petsc import (
NonlinearProblem,
)
from dolfinx.fem.petsc import NonlinearProblem
from dolfinx.io import XDMFFile
from dolfinx.mesh import create_mesh, locate_entities, meshtags
from dolfinx.nls.petsc import NewtonSolver
from test_permeation_problem import test_permeation_problem
from ufl import (
FacetNormal,
Expand Down Expand Up @@ -111,24 +109,28 @@ def siverts_law(T, S_0, E_S, pressure):

dt = 1 / 20
final_time = 50
num_steps = int(final_time / dt)

F = dot(D * grad(u), grad(v)) * dx(1)
F += ((u - u_n) / dt) * v * dx(1)

problem = NonlinearProblem(F, u, bcs=bcs)
solver = NewtonSolver(MPI.COMM_WORLD, problem)
solver.convergence_criterion = "incremental"
solver.rtol = 1e-10
solver.atol = 1e10
solver.report = True
ksp = solver.krylov_solver
opts = PETSc.Options()
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_type"] = "gamg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
ksp.setFromOptions()
petsc_options = {
"snes_type": "newtonls",
"snes_linesearch_type": "none",
"snes_stol": 1e-8,
"snes_atol": 0,
"snes_rtol": 0,
"snes_max_it": 30,
"ksp_type": "cg",
"pc_type": "gamg",
}

solver = NonlinearProblem(
F,
u,
bcs=bcs,
petsc_options=petsc_options,
petsc_options_prefix="festim_solver",
)

temp_dir = tempfile.TemporaryDirectory()
mobile_xdmf = XDMFFile(
Expand All @@ -146,7 +148,7 @@ def siverts_law(T, S_0, E_S, pressure):
progress.update(float(dt))
t += float(dt)

solver.solve(u)
_ = solver.solve()

mobile_xdmf.write_function(u, t)

Expand Down
3 changes: 1 addition & 2 deletions test/test_permeation_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def test_permeation_problem(mesh_size=1001):
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_type"] = "gamg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
ksp.setFromOptions()
elif Version(dolfinx.__version__) > Version("0.9.0"):
snes = my_model.solver.solver
Expand All @@ -109,9 +108,9 @@ def test_permeation_problem(mesh_size=1001):
opts[f"{option_prefix}snes_atol"] = 0
opts[f"{option_prefix}snes_rtol"] = 0
opts[f"{option_prefix}snes_stol"] = 1e-8
opts[f"{option_prefix}snes_max_it"] = 30
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_type"] = "gamg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
snes.setFromOptions()

my_model.run()
Expand Down
Loading