cape.pycart.options.functionalopts: Objective Function Options

This module provides an interface for defining Cart3D’s output functional for output-based mesh adaptation. The options read from this file are written to the $__Design_Info section of input.cntl`1. Each output function is a linear combination of terms where each term can be a component of a force, a component of a moment, or a point/line sensor.

The following is a representative example of a complex output function.

"Functional": {
    // Term 1: normal force coefficient on "wings"
    "CN": {
        "type": "optForce",
        "force": 2,
        "frame": 0,
        "weight": 1.0,
        "compID": "wings",
        "J": 0,
        "N": 1,
        "target": 0.0
    },
    // Term 2: 0.5 times side force on "entire"
    "CY": {
        "type": "optForce",
        "force": 1,
        "frame": 0,
        "weight": 0.5,
        "compID": "entire"
    },
    // Term 3: 0.001 times point sensor called "p1"
    "p1": {
        "type": "optSensor",
        "weight": 0.001
    }
}

See the JSON “Functional” section for a description of all available options.

class cape.pycart.options.functionalopts.FunctionalOpts(*args, **kw)

Dictionary-based options for Functional section

filter_FunctionalCoeffsByType(typ: str)

Return a subset of function coefficients by type

Call:
>>> copts = opts.filter_FunctionalCoeffsByType(typ)
Inputs:
opts: Options

Options interface

typ: str

Requested functional type

Outputs:
copts: dict[FunctionalCoeffOpts]

Subset of functional options with correct type

Versions:
  • 2023-05-16 @ddalle: v1.0

get_FunctionalCoeffOpt(coeff: str, opt: str, j=None, **kw)

Get option for a specific functional coefficient

Call:
>>> v = opts.get_FunctionalCoeffOpt(coeff, opt, j=None, **kw)
Inputs:
opts: OptionsDict

Options interface

coeff: str

Name of coefficient

opt: str

Name of functional option

Outputs:
v: object

Value of opts[fn][opt] or as appropriate

Versions:
  • 2023-05-16 @ddalle: v1.0