2025-11-18T14:22:20.884401

Version 2.0 -- cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software

Blauth
In this paper, we present version 2.0 of cashocs. Our software automates the solution of PDE constrained optimization problems for shape optimization and optimal control. Since its inception, many new features and useful tools have been added to cashocs, making it even more flexible and efficient. The most significant additions are a framework for space mapping, the ability to solve topology optimization problems with a level-set approach, the support for parallelism via MPI, and the ability to handle additional (state) constraints. In this software update, we describe the key additions to cashocs, which is now even better-suited for solving complex PDE constrained optimization problems.
academic

Version 2.0 -- cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software

Basic Information

  • Paper ID: 2306.09828
  • Title: Version 2.0 -- cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software
  • Author: Sebastian Blauth (Fraunhofer ITWM, Kaiserslautern, Germany)
  • Classification: math.OC (Optimization and Control)
  • Publication Date: Submitted to arXiv on November 13, 2023; Published in SoftwareX 24
  • Paper Link: https://arxiv.org/abs/2306.09828
  • Software Version: v2.0.12
  • License: GNU GPL v3.0

Abstract

This paper presents the version 2.0 update of the cashocs software. cashocs is a computational software based on the adjoint method, specifically designed for automated solution of PDE-constrained optimization problems, including shape optimization and optimal control. Since its initial release, the software has incorporated numerous new features and utilities, making it more flexible and efficient. The most important new functionalities include: a space mapping framework, topology optimization solving capability based on level-set methods, parallel computing support via MPI, and the ability to handle additional (state) constraints.

Research Background and Motivation

Problem Definition

PDE-constrained optimization problems are widely prevalent in engineering and scientific computing, primarily encompassing:

  1. Shape Optimization Problems: Optimizing system performance by modifying geometric shapes
  2. Optimal Control Problems: Optimizing system behavior through control inputs
  3. Topology Optimization Problems: Optimizing structural performance by modifying material distribution

Research Significance

  • Such problems have important applications in aerospace, automotive industry, biomedical engineering, and other fields
  • Traditional solution methods have high computational complexity and require specialized numerical optimization techniques
  • Industrial applications commonly use commercial solvers, which lack direct optimization capabilities

Limitations of Existing Methods

  • Lack of unified software framework for handling different types of PDE-constrained optimization problems
  • Existing tools are insufficient in parallel computing and complex constraint handling
  • Solution efficiency for industrial-scale complex problems requires improvement

Core Contributions

  1. Space Mapping Framework: First complete implementation of space mapping techniques in PDE-constrained optimization software, supporting shape optimization and optimal control problems
  2. Topology Optimization Support: Integration of topology optimization solvers based on level-set methods, including state-of-the-art quasi-Newton methods
  3. Parallel Computing Capability: MPI-based parallel computing support enabling the software to run on high-performance computing systems
  4. Constraint Handling Mechanism: New quadratic penalty method and augmented Lagrangian method for handling additional state and control constraints
  5. User-Friendliness Improvements: Including automatic scaling, custom scalar products, improved remeshing workflows, etc.

Methodology Details

Software Architecture Design

cashocs 2.0 is based on modular design, supporting three major classes of optimization problems:

PDE Constrained Optimization Problems
├── cashocs.ShapeOptimizationProblem
├── cashocs.OptimalControlProblem  
├── cashocs.TopologyOptimizationProblem
├── Additional Constraints
│   ├── cashocs.ConstrainedShapeOptimizationProblem
│   └── cashocs.ConstrainedOptimalControlProblem
└── Space Mapping Problems
    ├── cashocs.space_mapping.shape_optimization.SpaceMappingProblem
    └── cashocs.space_mapping.optimal_control.SpaceMappingProblem

Space Mapping Technique

The space mapping method leverages model hierarchy, containing fine models (detailed, complex) and coarse models (approximate, computationally inexpensive):

  1. Model Hierarchy: Efficiently optimizes fine models through continuous optimization and correction of coarse model approximations
  2. Avoiding Direct Optimization: Eliminates the need for direct optimization of fine models, particularly suitable for industrial applications using commercial solvers
  3. Rapid Convergence: Experimental results demonstrate convergence within approximately 5 iterations

Topology Optimization Method

Employs level-set methods for solving topology optimization problems:

  1. Algorithm Support: Includes traditional topology optimization algorithms and novel quasi-Newton methods
  2. Automatic Adjoint System: While topology derivatives require user input, automatic derivation of adjoint systems has been implemented
  3. Extended Applicability: Extends cashocs' applicability to topology optimization with topological sensitivity information

Constraint Handling Mechanism

Implements two primary constraint handling methods:

  1. Quadratic Penalty Method: Handles constraints by adding penalty terms to the objective function
  2. Augmented Lagrangian Method: Hybrid method combining Lagrange multipliers and penalty functions
  3. Broad Applicability: Supports various constraint types including state constraints and control constraints

Experimental Setup

Technology Stack

  • Programming Language: Python
  • Core Dependencies: FEniCS, NumPy, PETSc, MPI
  • Mesh Processing: meshio, Gmsh
  • Version Control: git
  • Documentation: https://cashocs.readthedocs.io/

Example Problem Configuration

Space Mapping Shape Optimization Case:

  • Objective: Achieve uniform flow distribution across three outlet pipes
  • Fine Model: Navier-Stokes equations at Reynolds number 1000, solved using Ansys Fluent
  • Coarse Model: Linear Stokes system solved with FEniCS on coarse mesh

Experimental Results

Space Mapping Method Performance

Results from Figure 1 demonstrate:

  • Convergence Speed: Convergence achieved within approximately 5 iterations
  • Optimization Effectiveness: Final geometry achieves nearly perfect uniform flow distribution
  • Computational Efficiency: Significant efficiency improvement compared to direct fine model optimization

Parallel Computing Performance

  • Code Modification-Free: Most serial PDE-constrained optimization problems can be directly parallelized
  • High-Performance Computing: Supports solving large-scale optimization problems on HPC systems
  • FEniCS-Based: Fully leverages FEniCS' MPI support with minimal user-side code modifications

Remeshing Improvements

  • Extended Applicability: New remeshing workflow supports space mapping and constrained problems
  • Syntax Updates: Users must follow slightly different but still intuitive syntax
  • Performance Bottleneck: Remeshing itself remains non-parallelized due to Gmsh and meshio limitations

Space Mapping Technology Development

  • Space mapping methods for optimal control problems have been previously studied
  • Space mapping for shape optimization is a recently introduced technique
  • cashocs is the first software providing space mapping frameworks for both shape optimization and optimal control in PDE-constrained optimization

Topology Optimization Algorithms

  • Integrates recent topology optimization algorithms proposed by Amstutz and Andrä
  • Implements quasi-Newton topology optimization methods proposed by Blauth and Sturm
  • Room for improvement remains in automatic computation of topological sensitivity information

Conclusions and Discussion

Main Conclusions

  1. Functional Completeness: cashocs 2.0 significantly extends software functionality, becoming a comprehensive solution for PDE-constrained optimization
  2. Industrial Application Value: The space mapping framework is particularly suited for industrial applications, effectively leveraging existing commercial solvers
  3. Enhanced Computing Capability: MPI parallel support enables the software to handle large-scale practical problems
  4. Improved User-Friendliness: Multiple improvements enhance software usability and flexibility

Limitations

  1. Topology Derivative Computation: Topology derivatives in topology optimization still require manual user input
  2. Remeshing Bottleneck: Non-parallelized remeshing process may become a performance bottleneck for certain applications
  3. Tool Dependencies: Limitations imposed by external tools such as Gmsh and meshio

Future Directions

  1. Automatic Topology Derivatives: Develop methods for automatic computation of topology derivatives
  2. Parallel Remeshing: Improve parallel performance of remeshing workflows
  3. Additional Optimization Algorithms: Integrate more advanced optimization algorithms and constraint handling methods

In-Depth Evaluation

Strengths

  1. High Innovation: First integration of space mapping, topology optimization, and parallel computing in a single software
  2. High Practical Value: Particularly suitable for industrial applications with capability to integrate with existing commercial software
  3. Advanced Technology: Employs state-of-the-art numerical optimization techniques and algorithms
  4. Comprehensive Documentation: Provides detailed tutorials and documentation support
  5. Open Source Availability: GNU GPL license ensures software accessibility

Weaknesses

  1. Platform Dependency: Highly dependent on FEniCS ecosystem
  2. Learning Curve: Mastering PDE-constrained optimization concepts remains challenging for non-specialist users
  3. Performance Bottleneck: Serialized remeshing limits scalability for certain applications

Impact

  1. Academic Contribution: Provides important tools for PDE-constrained optimization research
  2. Industrial Value: Significantly enhances solution efficiency for industrial optimization problems
  3. Community Building: Open-source nature facilitates formation of active user and developer communities

Applicable Scenarios

  • Shape optimization design in aerospace industry
  • Fluid dynamics optimization in automotive industry
  • Device optimization in biomedical engineering
  • Topology optimization in structural engineering
  • Optimization projects requiring integration with commercial CFD software

References

Key references include:

  1. Blauth, S. (2021). cashocs: A Computational, Adjoint-Based Shape Optimization and Optimal Control Software. SoftwareX, 13, 100646.
  2. Blauth, S. (2023). Space Mapping for PDE Constrained Shape Optimization. SIAM J. Optim., 33(3), 1707–1733.
  3. Amstutz, S., & Andrä, H. (2006). A new algorithm for topology optimization using a level-set method. J. Comput. Phys., 216(2), 573–588.

Summary: cashocs 2.0 represents an important software update in the field of PDE-constrained optimization. By integrating advanced technologies such as space mapping, topology optimization, and parallel computing, it significantly enhances the software's functionality and practicality. This software is particularly well-suited for industrial and academic applications requiring efficient solution of complex optimization problems, making it an essential tool for researchers and engineers in this field.