cashocs#

cashocs is a shape optimization and optimal control software for python.

cashocs is based on the finite element package FEniCS and uses its high-level unified form language UFL to treat general PDE constrained optimization problems, in particular, shape optimization and optimal control problems.

The documentation for cashocs can be found here.

Functions

create_dirichlet_bcs(function_space, value, ...)

Create several Dirichlet boundary conditions at once.

interpolate_levelset_function_to_cells(...)

Interpolates jumping values to the mesh cells based on the levelset function.

compute_mesh_quality(mesh[, quality_type, ...])

This computes the mesh quality of a given mesh.

interval_mesh([n, start, end, partitions, comm])

Creates an 1D interval mesh starting at x=0 to x=length.

regular_box_mesh([n, start_x, start_y, ...])

Creates a mesh corresponding to a rectangle or cube.

regular_mesh([n, length_x, length_y, ...])

Creates a mesh corresponding to a rectangle or cube.

convert(input_file[, output_file, mode, quiet])

Converts the input mesh file to a xdmf mesh file for cashocs to work with.

import_mesh(mesh_file[, comm])

Imports a mesh file for use with cashocs / FEniCS.

load_config(path)

Loads a config object from a config file.

set_log_level(level)

This method sets the log level of the default handler, i.e., the console.

linear_solve(linear_form, u, bcs[, ...])

Solves a linear problem.

newton_solve(nonlinear_form, u, bcs[, ...])

Solves a nonlinear problem with Newton's method.

picard_iteration(form_list, u_list, bcs_list)

Solves a system of coupled PDEs via a Picard iteration.

snes_solve(nonlinear_form, u, bcs[, ...])

Solve a nonlinear PDE problem with PETSc SNES.

ts_pseudo_solve(nonlinear_form, u, bcs[, ...])

Solve a nonlinear PDE problem with PETSc TS and pseudo time stepping.

Classes

ConstrainedOptimalControlProblem(...[, ...])

An optimal control problem with additional (in-)equality constraints.

ConstrainedShapeOptimizationProblem(...[, ...])

A shape optimization problem with additional (in-)equality constraints.

EqualityConstraint(variable_function, target)

Models an (additional) equality constraint.

InequalityConstraint(variable_function[, ...])

Models an (additional) inequality constraint.

Functional()

Base class for all cost functionals.

IntegralFunctional(form)

A functional which is given by the integral of form.

MinMaxFunctional(integrand[, lower_bound, ...])

Cost functional involving a maximum of 0 and a integral term squared.

ScalarTrackingFunctional(integrand, ...[, ...])

Tracking cost functional for scalar quantities arising due to integration.

OptimalControlProblem(state_forms, bcs_list, ...)

Implements an optimal control problem.

ShapeOptimizationProblem(state_forms, ...[, ...])

A shape optimization problem.

TopologyOptimizationProblem(state_forms, ...)

A topology optimization problem.

Interpolator(origin_space, target_space)

Efficient interpolation between two function spaces.

LogLevel()

Stores the various log levels of cashocs.

Modules

geometry

Mesh generation, quality, and management tools.

io

Inputs and outputs.

log

Logging for cashocs.

nonlinear_solvers

Custom solvers for nonlinear equations.

space_mapping

Space mapping algorithms.

verification

Taylor tests for verifying gradient correctness.