About Generic Design Variables

Generic design variables are design variables that are not connected to entities or properties known by Tosca.

This page discusses:

See Also
Script Entry Points
In Other Guides
GROUP_DEF
DV_GENERIC
DVCON_GENERIC
OPT_PARAM
USER_FILE

Introduction

Generic design variables enable Tosca to define generic optimization problems for which some design variables are not connected to nodes, elements, faces and other entities from mesh, geometry or the finite-element model. Use cases are e.g. the phase parameter β or the current in the context of an emag optimization.

All required information like design response values and sensitivity fields must come from Tosca-external sources and must be available before tosca_opt is started. This can be realized using a tosca_opt pre-hook. The generic design variable values can be read from the SAVE.txt/GENERIC_DV_<iter>.txt text file and a text-ONF file containing the design response value(s) and sensitivity information must be created by the hook.

Design Variable and Group Command

To use generic design variables, a couple of commands are required. The design variable command, DV_GENERIC, requires a group, which must be defined first:

GROUP_DEF
  ID_NAME = GROUP_FOR_GENERIC_DV
  TYPE    = GENERIC
  FORMAT  = LIST
  LIST_BEGIN
1-4
END_
To create a "generic group", the TYPE of the command must be set to GENERIC. The only allowed value for FORMAT is LIST in this case, which implies that group operations are not supported. Group items for generic groups can be arbitrarily chosen and are allowed to have gaps.

The generic design variable command requires a group and allows to provide initial values with an optional ONF text file:

DV_GENERIC
  ID_NAME          = MY_GENERIC_DV
  GENERIC_GROUP    = GROUP_FOR_GENERIC_DV
  INITIAL_DV_FIELD = initial_values.onf
END_
The initial values are provided in text-ONF format (ONF block number 751), as a scalar field:
# Initial values for generic design variables
   -1
   751
4
1, 0.1
2, 0.2
3, 0.3
4, 0.4
   -1
This initializes the generic design variables with the values 0.1 to 0.4 . It is important that the identifier in the first column match the group items defined in the GROUP_DEF command.

DV_xxx commands are referenced in the OPTIMIZE command. OPTIMIZE can reference as usual one of DV_SHAPE, DV_BEAD, DV_TOPO, DV_SIZING. Additionally one DV_GENERIC command can be referenced.

OPTIMIZE
  DV = MY_SHAPE_DV
  DV = MY_GENERIC_DV
  ! ...
END_

Provide Sensitivity Information

Tosca has no knowledge about the connection between a generic design variables and any entity known by Tosca. But to do optimization, derivatives with respect to the generic design variables are required and must be externally provided.

The DRESP command is required to read sensitivities with respect to the generic design variables.

DRESP
  ID_NAME           = MY_GENERIC_DRESP
  TYPE              = SENSITIVITY_GENERIC
  FIELD_INPUT_FILE  = MyResultsSens.onf
  FIELD_INPUT_TYPE  = <OBJECTIVE_ID identifier in field descriptor>
                      ! optional, default = <ID_NAME> value
END_
FIELD_INPUT_FILE specifies the text-ONF file from which the dresp value and sensitivity values are read. The item is optional. If it is not specified, it evaluates to FEM_INPUT->EMAG_FILE + "_DRESP.onf" or simply to "_DRESP.onf" if used outside an emag optimization. The file specified in FIELD_INPUT_FILE must contain the gradient field of the design response with respect to the generic design variables in a block with ONF number 644. The design response value is read from ONF block with number 640. Existing node, density and generic sensitivities are read from the ONF file if they share the same objective_id in the descriptor. The objective id is specified by FIELD_INPUT_TYPE.

An example is shown below:

FEM_INPUT
  ID_NAME   = MY_FEM_INP
  EMAG_FILE = emag.cst
END_

DRESP
  ID_NAME            = MY_ONF_DRESP
  TYPE               = SENSITIVITY_GENERIC
  ! FIELD_INPUT_FILE = emag_DRESP.onf
  FIELD_INPUT_TYPE   = MY_ONF_ID
END_

# File: emag_DRESP.onf
# Dresp value
   -1
   -2
   OBJECTIVE_ID = MY_ONF_ID
   -2
640
1
1, -4.2
   -1
# Gradient field w.r.t. nodal vector design variables
   -1
   -2
   OBJECTIVE_ID = MY_ONF_ID
   -2
643
2
1, -7.1e+01, 8.0, 0.0
2, 1.2e+02, -2.8e+01, 0.0
   -1
# Gradient field w.r.t. generic design variables
   -1
   -2
   OBJECTIVE_ID = MY_ONF_ID
   -2
644
1
1, 42.0
   -1

Define Upper and Lower Bounds

For generic design variables, it is important that the box constraints (absolute lower and upper bound) can be set individually for each design variable, because the different generic design variables can have very different meanings. Indeed, it is mandatory to define an upper and a lower bound for every item in the generic design variable group.

DVCON_GENERIC
  ID_NAME         = DVCGEN_BOUNDS
  TYPE            = BOUNDS
  GENERIC_GROUP   = GROUP_FOR_GENERIC_DV
  LOWER_BOUND     = 0.0
  UPPER_BOUND     = 1.0
  GENERIC_DV_MOVE = 0.25, REL ! or ABS
END_
Every generic design variable might vary between 0.0 and 1.0 in this example. The GENERIC_DV_MOVE item indicates that a design variables value might change by 25% of the total range in one design cycle.

The move parameter can also be provided globally for all generic design variables in a OPT_PARAM -> GENERIC_DV_MOVE command.

Output

Output for generic design variables is triggered by a USER_FILE command.

USER_FILE
  ID_NAME       = UF_GENERIC_DV_DATA
  FORMAT        = ASCII
  GENERIC_GROUP = MY_GEN_GROUP
  TYPE          = GENERIC_DV_DATA
  FILE_NAME     = filename.txt
  WRITE         = EVER
END_
If generic design variables are used and no command with TYPE = GENERIC_DV_DATA is present, then it is created by Tosca and GENERIC_DV_<iter>.txt is used as file name. Files of the form GENERIC_DV_<iter>.txt are moved into the SAVE.txt folder. Files generated by a GENERIC_DV_DATA user file command, but with a different file name are not moved and can be found in the working directory.

In combination with an emag simulation, Tosca always creates files with name GENERIC_DV_<iter>.txt. And thus this name is reserved and must not be used in own USER_FILE commands.

Limitations

  • It is not supported to use solely generic design variables. Generic design variables must be combined with another type of design variables.
  • Generic design variables can only be used in sensitivity based optimization setups.
  • The OPT_PARAM->DV_UPDATE_STRATEGY = MMA cannot be used together with generic design variables.
  • When used in combination with an emag simulation, the file name GENERIC_DV.txt is reserved and not allowed to be used in any USER_FILE command.