Function pipeWithScalarField computes the X, Y, Z and C arrays in order to visualize a pipe and a scalar field along the pipe axis with model PipeWithScalarField. The latter is shown by mapping scalar field to color values with a color map and utilizing this color at the perimeter associated with the corresponding axis location. Typically the scalar field value is a temperature, but might be also another quantity. Predefined color maps are available from MultiBody.Visualizers.Colors.ColorMaps and can be selected via input argument "colorMap". A color map with the corresponding scalar field values can be exported as vector-graphics in svg-format with function MultiBody.Visualizers.Colors.colorMapToSvg. An example is shown in the next figure:
The color coding is shown in the next figure. It was generated with Mechanics.MultiBody.Visualizers.Colors.colorMapToSvg using the following call:
colorMapToSvg(Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.jet(), height=50, nScalars=6, T_max=100, heading="Temperature in C");
function pipeWithScalarField extends Modelica.Mechanics.MultiBody.Interfaces.partialSurfaceCharacteristic(final multiColoredSurface = true); input SI.Radius rOuter "Outer radius of cylinder" annotation( Dialog); input SI.Length length "Length of cylinder" annotation( Dialog); input SI.Position xsi[:] "Relative position along the pipe with x[1] = 0, x[end] = 1" annotation( Dialog); input Real T[size(xsi, 1)] "Scalar field value at position xsi*length" annotation( Dialog); input Real T_min "T <= T_min is mapped to colorMap[1,:]" annotation( Dialog); input Real T_max "T >= T_max is mapped to colorMap[end,:]" annotation( Dialog); input Real colorMap[:, 3] "Color map to map scalar T to a corresponding color" annotation( Dialog); end pipeWithScalarField;