Using a Piecewise Constant (pwc) Function

For Transient Thermal solutions, you can use a piecewise constant (pwc) function along with a dataset expression to vary the Time Step parameter or the interval for saving fields data in the Thermal Solve Setup dialog box. You can also use a pwc function to specify time-dependent parameters in certain boundaries and excitations. Where supported, the capability is mentioned in the individual boundary or excitation help topics.

Tip:

While the pwc function may technically be supported for non-transient parameters (such as temperature-dependent material properties or temperature-dependent convection film coefficients), its usage in these contexts is not recommended. Step changes in a parameter can lead to solution instability and difficulty in convergence.

For example: If a temperature result is very close to where a step change occurs, the solution iterations can oscillate between the values on each side of the step and fail to converge.

This phenomenon is not a problem for transient parameters because the time always progresses in the forward direction. Once a step change occurs, the time-dependent parameter remains stable at the post-step value.

The process of defining a dataset for use in a piecewise constant function is the same as defining a dataset for use in a piecewise linear (pwl) function. This process is covered in the topic Using Datasets to Define Transient Parameters.

Interpretation of Datasets within pwc Functions: A dataset referenced in a piecewise constant function is interpreted differently from when it is referenced in a piecewise linear function. The characteristics of pwc expressions are:

Interval Number Datapoint Numbers Specified
Y Values (s)
Interpreted Constant
Time Step for Interval (s)
1 1 0 0.1
2 0.1
2 2 0.1 0.5
3 0.5
3 3 0.5 0.2
4 0.2
Important:

The Add Dataset, Edit Dataset, and Design Settings dialog boxes are not aware of whether a dataset will be referenced within a piecewise linear (pwl) or piecewise constant (pwc) function. These dialog boxes will always interpret and display the data points as a piecewise linear curve. In fact, the same dataset could be referenced in either function type for different parameters: pwl(ds1,Time) for one parameter; pwc(ds1,Time) for another.

Consider the following example to understand the distinction between the raw dataset and the interpreted pwc curve.

Example – Comparison of Dataset Definition and PWC Interpretation:

Definition of a dataset for specifying a variable time step size

Figure 1: Dataset (Tstep) Definition

Piecewise Constant interpretation of the preceding dataset

Figure 2: Dataset Interpretation as a PWC Time Step control – pwc(Tstep, Time)