ansys.mapdl.core.Mapdl.init#
- Mapdl.init(name='', method='', val1='', val2='', val3='', **kwargs)#
Initializes a vector or matrix.
Mechanical APDL Command: *INIT
- Parameters:
- name
str
Vector or matrix which will be initialized. This can be a vector (created by the vec command), a dense matrix (created by the dmat command), or a sparse matrix (created by the smat command).
- method
str
Initialization method to use:
ZERO
- Fill the vector/matrix with zeros (default).CONST
- Fill the vector/matrix with a constant value.RAND
- Fill the vector/matrix with random values.DIAG
- Fill then
th diagonal of the matrix with a constant value. Other values are not overwritten. For this option,Name
must be a dense matrix.ADIAG
- Fill then
th anti-diagonal of the matrix with a constant value. Other values are not overwritten. For this option,Name
must be a dense matrix.CONJ
- Take the complex conjugate of the values in the vector/matrix (no change for non- complex values).FILTER
- Initialize a subset of values of a vector using a filtering vector. For this option,Name
must be a vector.
- val1
str
The name of an existing integer vector (created by vec ) to be used as the filter vector. The values in this vector indicate the locations in the
Name
vector that are to be initialized toVal2
(real value) andVal3
(imaginary value, if applicable). Location values higher than the dimension of the original vector are ignored.- val2
str
The real part of the value used for initialization (default = 0).
- val3
str
The imaginary part of the value used for initialization (default = 0); applicable only if the
Name
vector contains complex values.
- name
Notes
Warning
This function contains specificities regarding the argument definitions. Please refer to the command documentation for further explanations.
Argument Descriptions
name : str
- Vector or matrix which will be initialized. This can be a vector (created by the vec command), a dense matrix (created by the dmat command), or a sparse matrix (created by the smat command).method : str
- Initialization method to use:ZERO
- Fill the vector/matrix with zeros (default).CONST
- Fill the vector/matrix with a constant value.RAND
- Fill the vector/matrix with random values.DIAG
- Fill then
th diagonal of the matrix with a constant value. Other values are not overwritten. For this option,Name
must be a dense matrix.ADIAG
- Fill then
th anti-diagonal of the matrix with a constant value. Other values are not overwritten. For this option,Name
must be a dense matrix.CONJ
- Take the complex conjugate of the values in the vector/matrix (no change for non- complex values).FILTER
- Initialize a subset of values of a vector using a filtering vector. For this option,Name
must be a vector.
val1, val2, val3 : str
- Additional input. The meaning ofVal1
throughVal3
will vary depending on the specifiedMethod
. See details below.
The following
Valx
fields are used withMethod
= CONST:val1 : str
- The real part of the constant value to use (default = 0).val2 : str
- The imaginary part of the constant value to use (default = 0). Required only for a complex vector/matrix.
The following
Valx
fields are used withMethod
= DIAG orMethod
= ADIAG:val1 : str
- The number of the diagonal to fill. A zero value (which is the default) indicates the main diagonal (or main anti-diagonal). A positive value indicates an upper diagonal; a negative value indicates a lower diagonal.val2 : str
- The real part of the constant value to use (default = 1).val3 : str
- The imaginary part of the constant value to use (default = 0). Required only for a complex matrix.
The following example demonstrates
Method
= DIAG:The following
Valx
fields are used withMethod
= FILTER:val1 : str
- The name of an existing integer vector (created by vec ) to be used as the filter vector. The values in this vector indicate the locations in theName
vector that are to be initialized toVal2
(real value) andVal3
(imaginary value, if applicable). Location values higher than the dimension of the original vector are ignored.val2 : str
- The real part of the value used for initialization (default = 0).val3 : str
- The imaginary part of the value used for initialization (default = 0); applicable only if theName
vector contains complex values.
This command initializes a previously defined vector ( vec ), dense matrix ( dmat ), or sparse matrix ( smat ).