# HMIN_opticontrol_write()

Writes optimization control parameters to HyperMesh.

## Syntax

`void HMIN_opticontrol_write(HM_entityidtype id,char *name, int desmax, char desmaxtoggle,double mindim,char mindimtoggle,int minmeth, char minmethtoggle, double matinit,char matinittoggle,double mindens, char mindenstoggle,double discrete,char discretetoggle,int checker, char checkertoggle,int mmcheck,char mmchecktoggle,double objtol, char objtoltoggle,double delsiz,char delsiztoggle,double delshp, char delshptoggle,double deltop,char deltoptoggle, int * nastran_toggles, int * nastran_int_controls, double * nastran_real_controls )`

## Type

HyperMesh hminlib Function

## Description

Writes optimization control parameters to HyperMesh.

## Inputs

`id`- The ID of the OptiStruct.
`name`- The name of the OptiStruct.
`desmax`- Maximum number of design iterations ( default = 30, if MINDIM is defined, default = 80).
`desmaxtoggle`- Flag to indicate that desmax is used (0: not used, 1: used).
`mindim`- Specifies the minimum diameter of members formed in a topology optimization. This command is used to eliminate small members. It also eliminates checkerboard results. The method is defined by MINMETH (real > 0.0, default = no minimum member size control).
`mindimtoggl`- Flag to indicate that
`mindim`is used (0: not used, 1: used). `minmeth`- Specifies the method of minimum member size control. Method 2 is set as default since it achieves more discrete solutions for most examples (1 or 2).
`minmethoggle`- Flag to indicate that
`minmeth`is used (0: not used, 1: used). `matinit`- This parameter declares the initial material fraction. For topology optimization runs with mass as the objective, default is 0.9. For runs with constrained mass, the default is reset to the constraint value. If mass is not the objective function and is not constrained, the default is 0.6. (between 0.0 and 1.0).
`matinittoggle`- Flag to indicate that
`matinit`is used (0: not used, 1: used). `mindens`- Minimum element material density. Sets a lower limit on the amount of material that can be assigned to any design element. Extremely low values for this parameter can result in an ill-conditioned stiffness matrix.
`mindenstoggle`- Flag to indicate that
`mindens`is used (0: not used, 1: used). `discrete`- Discreteness parameter. Influences the tendency for elements to converge to a material density of 0 or 1. Higher values decrease the number of elements that remain between 0 and 1. Recommended bounds are 0.0 and 2.0 for shells, or 3.0 for solids.
`discretetoggle`- Flag to indicate that discrete is used (0: not used, 1: used).
`checker`- Controls checkerboarding. ( 0,1 or 2, default = 0) Use 0 for no checkerboard control. Use 1 for global averaging over the entire design domain. This option generally yields a large number of semi-dense elements around fully dense elements. To reduce the number of semi-dense elements in the solution, restart the final iteration with checkerboard control off and run for 10-20 iterations. This may reintroduce some local checkerboarding. This method is used with plate/shell and solid design elements and is highly recommended for Tetra elements. Nodal densities are output to the .res file if this option is used. Use 2 for averaging at local areas identified as checkerboarded. Since averaging is only applied locally, a much smaller number of semi-dense elements are found in the final iteration compared to the global averaging method. This method applies only to shell design elements. If used in models with solid design elements, checkerboard control is not applied to solid elements.
`checkertoggle`- Flag to indicate that checker is used (0: not used, 1: used).
`mmcheck`- The use of this parameter will ensure a checkerboard free solution, although with the undesired side effect of achieving a solution that involves a large number of semi-dense elements, similar to the result of using checker=1. Therefore, use this parameter only when it is necessary. (0 or 1).
`mmchecktoggle`- Flag to indicate that mmchechk is used (0: not used, 1: used).
`objtol`- Relative convergence criterion. If relative change in the objective function between two design iterations is less than OBJTOL then optimization stops.
`objtoltoggle`- Flag to indicate that objtol is used (0: not used, 1: used).
`delsiz`- Fractional move limit for size design variables.
`delsiztoggle`- Flag to indicate that delsiz is used (0: not used, 1: used).
`delsshp`- Fractional move limit for topography/shape design variables. Defined as the fractional difference between the upper and lower bounds.
`delshptoggle`- Flag to indicate that delshp is used (0: not used, 1: used).
`deltop`- Fractional move limit for topology design variables.
`deltoptoggle`- Flag to indicate that delshp is used (0: not used, 1: used).
`nastran_toggles`- Toggle variables for Nastran optimization control parameters. If an element of the array above is set to zero, the optimization program does not take into account the settings for that variable. If the value for an element is 1, the optimization program uses the values in the arrays bellow instead of the default values.
`nastran_int_controls`- Integer type optimization control parameters for Nastran.
`nastran_real_controls`- Real type optimization control parameters for Nastran.

## Example

The optimization control parameters for Nastran are grouped into an integer array and a real array in the following way:

Integer parameters

nastran_int_controls[0 ] : APPRCOD

nastran_int_controls[1 ] : DESMAX

nastran_int_controls[2 ] : IGMAX

nastran_int_controls[3 ] : IPRINT

nastran_int_controls[4 ] : IPRNT1

nastran_int_controls[5 ] : IPRNT2

nastran_int_controls[6 ] : ISCAL

nastran_int_controls[7 ] : ITMAX

nastran_int_controls[8 ] : ITRMOP

nastran_int_controls[9 ] : ITRMAST

nastran_int_controls[10] : JTMAX

nastran_int_controls[11] : JPRINT

nastran_int_controls[12] : JWRITE

nastran_int_controls[13] : METHOD

nastran_int_controls[14] : P1

nastran_int_controls[15] : P2

Real parameters

nastran_real_controls[0 ] : CONV1

nastran_real_controls[1 ] : CONV2

nastran_real_controls[2 ] : CONVDV

nastran_real_controls[3 ] : CONVPR

nastran_real_controls[4 ] : CT

nastran_real_controls[5 ] : CTMIN

nastran_real_controls[6 ] : dabobj

nastran_real_controls[7 ] : delb

nastran_real_controls[8 ] : delobj

nastran_real_controls[9 ] : delp

nastran_real_controls[10] : delx

nastran_real_controls[11] : dobj1

nastran_real_controls[12] : dobj2

nastran_real_controls[13] : dpmin

nastran_real_controls[14] : dx1

nastran_real_controls[15] : dx2

nastran_real_controls[16] : dxmin

nastran_real_controls[17] : gmax

nastran_real_controls[18] : gscal

nastran_real_controls[19] : ptol

nastran_real_controls[20] : Stpscl

For further details please see DOPTRM in the Nastran manual.

## Errors

None.