Good afternoon people, I hope you had a great Juhannus. Don’t celebrate it? Start next year. It’s awesome.

But to the point: I’ve written on several occasions about time-harmonic analysis, mainly in the context of finite elements (FEM). See for example my post series about my ongoing work, a details-specific post about it, or the one about phasor analysis.

However, last week I received a very fundamental question:

**When to use time-harmonic and time-stepping analysis?**

That’s a good one, not least because I happen to know the answer. But, before we jump into that, some clarifications might be in order.

Something like

**What is time-harmonic analysis in the first place?**

And what is time-stepping?

### Time-stepping 101

Let’s start with the simpler one first, the one we call *time-stepping*. In time-stepping analysis, we want to analyse how a system – let’s say an electrical machine – behaves as time goes by. We have some kind of model, an equation or a system of equations, describing the system. This is often called the governing equation.

Additionally, we need to have some kind of initial conditions, i.e. the state from which on we want to analyse the problem. For instance, the machine might be stationary and not connected to any voltage source, or whatever.

Then, based on the governing equation and the initial conditions, we solve what the system will look like a short time later – its new state. The “short time” might be for instance 1 millisecond or so. Short, anyway.

This process is called a *time-step.* Next, based on this *new* state of the system (and the governing equation, of course), we yet again solve its state *another* 1 ms later. And then 1 ms after that, and then 1 ms after that.

On and on it goes.

Eventually, we are left lots of something like still-shots of the system – how it looks like at 0 seconds or 1 milliseconds or 500 milliseconds.

This process is called time-stepping.

### Time-harmonic analysis 101

By contrast, *time-harmonic* analysis approaches the problem from another angle. Instead of approximating the behaviour of our system at certain points in time, we approximate it with *functions of time.*

This means the following.

We *assume* that the behaviour of our system can be approximated with *harmonic *functions of time – sines and cosines of different amplitudes and frequencies. Hence the name *harmonic analysis*.

Typically, these frequencies we fix in advance; they are regarded as known and will not change in the process. They are simply parameters that we choose.

Next, we simply solve the amplitudes of the sine and cosine terms of different frequencies.

That’s it.

Most often, only one frequency term is included. In this case it is sufficient to solve for only one complex-valued amplitude, and the term *phasor analysis* is commonly used. But as you may have read, this simply a more specific case of the more general time-harmonic analysis.

**Terminology 101**

To make things more complicated, I have also in this blog used terms like *frequency-domain* and *time-domain* when talking about time-analysis of any kind.

These terms are a bit more mathematical in origin, and more than we need right now. Indeed, they do refer to mathematical *space* in which we perform the analysis.

For now, it is sufficient to know that we do time-stepping in the time-domain, and time-harmonic analysis in the frequency domain, respectively.

### Comparison

Now, back to the main topic.

Now you should be able to see the differences between the two approaches.

Time-stepping analysis tries to model the behaviour of our system in a very direct fashion – to generate samples of it as time goes by.

By contrast, time-harmonic analysis adobts a more indirect approach, first solving the amplitudes of *known* functions of time. The time-behaviour of original system can then be obtained by sampling those.

The same problem, the same goal – two different approaches.

Got it?

### When to use which

You may be able to see now that time-harmonic analysis can sometimes have a huge benefit over time-stepping.

Specifically, **if **the solution to our problem *can *be represented with only one frequency component, by time-harmonic analysis we can obtain it by solving *only one* problem, of equal size as our governing equation. And that’s all, no extra hassle needed.

By contrast, with time-stepping we are forced to solve several problems in a sequential fashion, to obtain the aforementioned samples.

And the number of samples required can be very large indeed, if we want to analyse the so-called steady-state of the system. In this case, we need to keep on time-stepping until the behaviour of our solution does not significantly change from one fundamental period to another. Often, this means something like 5 to 10 periods, with perhaps hundreds of time-steps *each*.

And *that* will take a long time.

Indeed, this is why linear electric circuits are practically always analysed with the phasor analysis.

Solve one problem and be done with it – sounds quite enticing, doesn’t it?

### Why time-step at all?

Except that things can often be more complicated than this.

There’s the big if – **if **the solution consists of a single frequency term or not.

For instance, if we have saturating components in our problem, this is usually not the case any more.

Likewise, if the system is time-variant, like a machine that is actually rotating.

In either case, the solution is no longer purely sinusoidal – it is more complicated than that.

Of course, even in these cases it *can* be approximated arbitrarily well by increasing the number of frequencies in our approximation.

However, with the system being nonlinear and/or time-variant, these frequency components will all be coupled to each other. Hence, we will have to solve all of them at the same time. The size of our problem will then be an integer multiple of the size of our governing equation – larger and more difficult to solve, that is. Perhaps more importantly, the mathematical treatment of the problem – what is needed to be able to form equations to solve in the first place – gets significantly more difficult.

In cases such as these, time-stepping analysis starts to look more and more suitable.

So, that was the topic of today’s lecture.

I hope you understood. If not, if you have any questions at all, hit me a comment!

-Antti

*Need help with electric motor design or design software? Let's get in touch - satisfaction guaranteed!*