5. Programming rules#
While the developer has free choice in the use and naming of his work parameters in the dedicated data structure (sd_nl), it is however still mandatory to respect the following rules in order to allow the archiving and calculation recovery processes to work correctly with the new non-linearity.
The sd_nl parameter MX_LEVEL must be incremented in the routine preparing dtmprep_noli*_newf data. This makes it possible to avoid data overwriting when combining multiple nonlinearities.
The sd_dtm parameter NB_NONL should also be incremented in dtmprep_noli*_newf. This makes it possible to globally activate the calculation of nonlinear forces and the archiving of associated internal variables.
The parameter NL_TYPE of the sd_nl must be saved with the integer value describing the nonlinearity processed in dtmprep_noli*_newf. This value is set in the nldef.h file (e.g. NL_CHOC = 1, NL_BUCKLING = 2, etc.). Parameter NL_TYPE is required in dtmforc in order to properly dispatch to the dtmforc*_newf* routine. The use of an integer makes it possible to optimize this very repetitive step in the integration loop.
The internal variables (real) are concatenated for all nonlinearities and stored under the global parameter INTERNAL_VARS of the sd_nl. In order not to overwrite the variables of the other nonlinearities, it is necessary to retrieve the backup index generated and stored automatically under the parameter INTERNAL_VARS_INDEX. In practice:
call nlget (sd_nl, _ INTERNAL_VARS, vr= twent)
call nlget (sd_nl, _ INTERNAL_VARS_INDEX, vi= vindx)
start = vindx (nl_ind)
vint (start+0) = value1
vint (start+1) = value2
vint (start+2) = value3