*SetSpline3D()
Sets the input data for a three dimensional (3D) spline entity that is defined using *Spline3D().
Syntax
*SetSpline3D(varname, {
FILE,”csv_file”
|VALUE, nz,nx,
z1,z2,.., znz,
x1,y1_z1,y1_z2,y1_z_nz,
x2,y2_z1,y2_z2,..y2_nz,
….
xnx,ynx_z1,ynx_z2,.. ynx_nz
|USER, user_sub
}
, extrap)
Arguments
- varname
- The variable name of the spline entity.
- FILE|VALUE|USER
- A keyword to suggest the method by which the input data is provided.
- csv_file
- The file name with the path of the .csv file (if the preceding attribute is FILE).
- nz
- The number of Z planes in the data.
- nx
- The number of X values.
- y 1_z1 , y 1_z2 , y nx_nz
- The Y value corresponding to a particular Z value and X value. For example, y1_z2 corresponds to y value at x=x1 and z=z2.
- x 1 , x 2 .., x nx
- The X values that make up the column vector for the first independent variable.
- z 1 , z 2 .., z nz
- The Z values that make up the plane for the second independent variable.
- user_sub
- The USER expression that calls the subroutine that has the function to read the spline data.
- extrap
- Valid values are: NORMAL|LIN_EXTRAP. When LIN_EXTRAP is used, the Y data is linearly extrapolated at the ends during the solution, if the X values go out of the supplied range.
Example
Example 1
In the example below, the spline data is supplied through a reference
.csv file and uses the LIN_EXTRAP
keyword:
*Spline3D( spl3d_theta, “Force Theta Spline" )
*ActionReactionForce( frc_combust, "Combustion Force", TRANS, b_piston, b_cyl, p_piston_ctr, m_Combustion_ref )
*SetForce( frc_combust,LIN, , LIN, , SPL3D, spl3d_theta, , `MOD({j_crank.AZ}*rtod, 720)`, `{j_crank.WZ}` )
*SetSpline3D( spl3d_theta, FILE, "3d_spline.csv", LIN_EXTRAP )
Example 2
In the example below, the spline data is supplied directly as values. The first argument after the VALUE keyword represents the number of Z planes, while the next argument represents the number of row data in the XY array. The first set of values that follow (equal to number of Z planes) represents the Z plane values, while the remaining data represents the XY data. Within this set, the first value is the X data and the next set represents Y data corresponding to each Z data, and so on.
The formatting of data as a table (shown below) is done for clarity
only.
*Spline3D( spl3d_1, "Spline Value" )
*SetSpline3D( spl3d_1,VALUE, 3, 11
, 10, 20, 30,
0.00E+00, 1.05E+02, 1.17E+02, 1.24E+02,
1.00E+00, 1.06E+02, 1.16E+02, 1.23E+02,
2.00E+00, 1.10E+02, 1.15E+02, 1.22E+02,
3.00E+00, 1.20E+02, 1.25E+02, 1.18E+02,
4.00E+00, 1.15E+02, 1.24E+02, 1.20E+02,
5.00E+00, 1.13E+02, 1.20E+02, 1.21E+02,
6.00E+00, 1.08E+02, 1.17E+02, 1.19E+02,
7.00E+00, 1.09E+02, 1.14E+02, 1.17E+02,
8.00E+00, 1.06E+02, 1.16E+02, 1.15E+02,
9.00E+00, 1.03E+02, 1.13E+02, 1.12E+02,
1.00E+01, 9.90E+01, 1.10E+02, 1.14E+02,
, NORMAL )
Example 3
In the above example, the Spline3D data is defined through a local Python subroutine
library with the name “local_spline3d” which contains a function “SPLINE_READ”. The
*SetSpline3D statement contains the user expression USER(1) that enables the solver to call
the subroutine. The values within the parenthesis act as input parameters to the
subroutine.
*Spline3D( spl3d_2, “Spline3D User Sub" )
*SetSpline3D( spl3d_2, USER, `USER(1)`, NORMAL )
*SetLocalUserDLLFlag( spl3d_2, true )
*SetLocalUserFunction( spl3d_2, "local_spline3d", PYTHON, “SPLINE_READ” )
Context
Comments
-
- FILE
- The spline data is provided via an external reference file in .csv format and the following attribute csv_file should refer to the .csv file with path. Refer to the Spline3D Panel topic in the MotionView. User's Guide to learn about the .csv file format.
- VALUE
- The spline data is provided directly as values. the following arguments provide the number of z planes and number of rows. Subsequently the Z plane values and XY values are provided.
- USER
- The spline data is supplied to the solver through the user defined subroutine.
- A scale or offset can be applied to the Spline3D using the *SetSpline3DAttributes() statement (applicable for the FILE and VALUE types only).