Skip to content

Commit

Permalink
Merge branch 'dev/inequality_constraints' into curvature
Browse files Browse the repository at this point in the history
  • Loading branch information
sblauth committed Feb 6, 2024
2 parents f1fd658 + 0133295 commit da53216
Show file tree
Hide file tree
Showing 126 changed files with 707 additions and 319 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:

# Upload results to the Security tab
- name: Upload OSSAR results
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Check if release is a pre-release
id: check_version
uses: nowsprinting/check-version-format-action@v3
uses: nowsprinting/check-version-format-action@v4
with:
prefix: 'v'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
files: coverage.xml

- name: Upload coverage to codacy
continue-on-error: true
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ repos:


- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.1.1
hooks:
- id: black


- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

Expand All @@ -27,28 +27,28 @@ repos:


- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
files: cashocs/


- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.7
hooks:
- id: bandit
files: cashocs/


- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
rev: v3.0.3
hooks:
- id: pylint
files: cashocs/


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
files: cashocs/
Expand Down
4 changes: 3 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ build:
sphinx:
configuration: docs/source/conf.py
builder: dirhtml
fail_on_warning: true

formats: all
formats:
- pdf

python:
install:
Expand Down
4 changes: 2 additions & 2 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"description": "<p>cashocs is a computational, adjoint-based shape optimization and optimal control software.</p>",
"license": "GPL-3.0+",
"title": "cashocs v2.1.0-dev",
"version": "v2.1.0-dev",
"title": "cashocs v2.2.0-dev",
"version": "v2.2.0-dev",
"upload_type": "software",
"creators": [
{
Expand Down
32 changes: 24 additions & 8 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,28 @@ of the maintenance releases, please take a look at
`<https://github.com/sblauth/cashocs/releases>`_.


2.1.0 (in development)
2..0 (in development)
----------------------

* Add mesh quality constraints for shape optimization: These ensure that the angles of the triangles / dihedral angles of tetrahedrons cannot fall below a specified threshold.

* New configuration file parameters:

* Section ShapeGradient

* :ini:`test_for_intersections` is used to disable the (post mesh movement) check for intersections of the mesh, which ensures physically reasonable designs. This should not be set to `False`.

* Section MeshQualityConstraints

* This section includes parameters for the new mesh quality constraints for shape optimization



2.1.0 (February 6, 2024)
------------------------

* The class :py:class:`cashocs.DeformationHandler` cannot be used anymore. Instead, use the class by calling :py:class:`cashocs.geometry.DeformationHandler`.

* Add the keyword arguments :python:`pre_callback` and :python:`post_callback` to define callbacks when an optimization problem is instanciated.

* Callbacks can now have one parameter - the parameter supplied when being called during runtime is the optimization problem itself
Expand All @@ -28,6 +45,12 @@ of the maintenance releases, please take a look at

* :py:func:`cashocs.import_mesh` can now also directly import a Gmsh mesh file. Internally, the mesh is directly converted to xdmf and then read. At the moment, this only supports the conversion mode `physical`.

* Add the kwargs `linear_solver` and (where applicable) `adjoint_linear_solver`. These can be used to define custom python KSP objects via petsc4py, most importantly, custom python-based preconditioners can be used with these. The feature is covered in the undocumented demo "demos/shape_optimization/python_pc".

* Add the kwarg `newton_linearization` to the optimization problem classes. This can be used to specify which (alternative) linearization techniques can be used for solving the nonlinear state systems.

* The function :py:func:`cashocs.newton_solve` does not change the user-specified tolerance (in the ksp_options) anymore, unless the kwarg `inexact=True` is set. This means, that the user can use custom "inexact Newton" schemes (e.g., gain one digit in accuracy) too. The old default was to use the relative tolerance of the nonlinear iteration multiplied with a safety factor (0.1).

* New configuration file parameters:

* Section LineSearch
Expand All @@ -42,13 +65,6 @@ of the maintenance releases, please take a look at

* :ini:`remesh_iter` is used to perform a remeshing after a certain amount of iterations.

* Section ShapeGradient

* :ini:`test_for_intersections` is used to disable the (post mesh movement) check for intersections of the mesh, which ensures physically reasonable designs. This should not be set to `False`.

* Section MeshQualityConstraints

* This section includes parameters for the new mesh quality constraints for shape optimization


2.0.0 (May 16, 2023)
Expand Down
30 changes: 17 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ for the demo programs is located inside the "demos" folder.
Citing
======

If you use cashocs for your research, please cite the following paper
If you use cashocs for your research, please cite the following papers

.. code-block:: text
Expand All @@ -211,13 +211,14 @@ If you use cashocs for your research, please cite the following paper
SoftwareX, Volume 13, 2021
https://doi.org/10.1016/j.softx.2020.100646
as well as the preprint
as well as

.. code-block:: text
Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software
Sebastian Blauth
https://doi.org/10.48550/arXiv.2306.09828
SoftwareX, Volume 24, 2023
https://doi.org/10.1016/j.softx.2023.101577
Additionally, if you are using the nonlinear conjugate gradient methods for shape optimization implemented in cashocs, please cite the following paper
Expand Down Expand Up @@ -266,13 +267,16 @@ If you are using BibTeX, you can use the following entries
.. code-block:: bibtex
@Misc{Blauth2023Version,
author = {Sebastian Blauth},
title = {{Version 2.0 -- cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software}},
year = {2023},
archiveprefix = {arXiv},
eprint = {2306.09828},
primaryclass = {math.OC},
@Article{Blauth2023Version,
author = {Sebastian Blauth},
journal = {SoftwareX},
title = {{Version 2.0 - cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software}},
year = {2023},
issn = {2352-7110},
pages = {101577},
volume = {24},
doi = {https://doi.org/10.1016/j.softx.2023.101577},
keywords = {PDE constrained optimization, Shape optimization, Topology optimization, Space mapping},
}
Expand All @@ -281,7 +285,7 @@ If you are using BibTeX, you can use the following entries
@Article{Blauth2021Nonlinear,
author = {Sebastian Blauth},
journal = {SIAM J. Optim.},
title = {{N}onlinear {C}onjugate {G}radient {M}ethods for {PDE} {C}onstrained {S}hape {O}ptimization {B}ased on {S}teklov-{P}oincaré-{T}ype {M}etrics},
title = {{Nonlinear Conjugate Gradient Methods for PDE Constrained Shape Optimization Based on Steklov-Poincaré-Type Metrics}},
year = {2021},
number = {3},
pages = {1658--1689},
Expand All @@ -296,7 +300,7 @@ If you are using BibTeX, you can use the following entries
@Article{Blauth2023Space,
author = {Blauth, Sebastian},
journal = {SIAM J. Optim.},
title = {Space {M}apping for {PDE} {C}onstrained {S}hape {O}ptimization},
title = {{Space Mapping for PDE Constrained Shape Optimization}},
year = {2023},
issn = {1052-6234,1095-7189},
number = {3},
Expand All @@ -314,7 +318,7 @@ If you are using BibTeX, you can use the following entries
@Article{Blauth2023Quasi,
author = {Blauth, Sebastian and Sturm, Kevin},
journal = {Struct. Multidiscip. Optim.},
title = {Quasi-{N}ewton methods for topology optimization using a level-set method},
title = {{Quasi-Newton methods for topology optimization using a level-set method}},
year = {2023},
issn = {1615-147X,1615-1488},
number = {9},
Expand Down
6 changes: 2 additions & 4 deletions cashocs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down Expand Up @@ -49,7 +49,6 @@
from cashocs._utils import interpolate_levelset_function_to_cells
from cashocs._utils import Interpolator
from cashocs.geometry import compute_mesh_quality
from cashocs.geometry import DeformationHandler
from cashocs.geometry import interval_mesh
from cashocs.geometry import regular_box_mesh
from cashocs.geometry import regular_mesh
Expand All @@ -60,7 +59,7 @@
from cashocs.nonlinear_solvers import newton_solve
from cashocs.nonlinear_solvers import picard_iteration

__version__ = "2.1.0-dev"
__version__ = "2.2.0-dev"

__citation__ = """
@Article{Blauth2021cashocs,
Expand Down Expand Up @@ -132,7 +131,6 @@
"LogLevel",
"regular_mesh",
"regular_box_mesh",
"DeformationHandler",
"compute_mesh_quality",
"newton_solve",
"picard_iteration",
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_cli/_convert.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_cli/_extract_mesh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_constraints/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_constraints/constrained_problems.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_constraints/constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_constraints/solvers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/form_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/function_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/geometry_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_database/parameter_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_forms/control_form_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_forms/form_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
2 changes: 1 addition & 1 deletion cashocs/_forms/general_form_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 Sebastian Blauth
# Copyright (C) 2020-2024 Sebastian Blauth
#
# This file is part of cashocs.
#
Expand Down
Loading

0 comments on commit da53216

Please sign in to comment.