Handling Complex-Valued Numbers and Problems in the Frequency Domain
Here, we address how the COMSOL Multiphysics® software handles complex-valued numbers and problems in the frequency domain. We discuss when you should use the root-mean-square (RMS), peak, or instantaneous value to specify sources in models being solved in the frequency domain, such as for electromagnetics or acoustics models. Also, we discuss how to specify the phase angle.
About the COMSOL Multiphysics® Formulation
COMSOL Multiphysics® uses complex-valued fields when solving time-harmonic problems in acoustics, electromagnetics, and structural mechanics, or any other physics where the Frequency Domain, Eigenvalue, or Eigenfrequency study type is being used. A general time-harmonic scalar field is expressed as
where called the phasor is the complex-valued field field being computed,
is the angular frequency,
is time, and
is
. Similarly, for a time-harmonic vector field we write
When you specify a scalar source field in a frequency-domain simulation, you can input a complex number or vector (a phasor). Its norm will correspond to the peak value of the field and the real part to the instantaneous value at . This applies for any time-harmonic input. For instance, to define an acoustic pressure or electric potential with an RMS value of 1 and a phase angle of 30 degrees, enter the expression:
sqrt(2)exp(i30[deg])
Or, alternatively:
sqrt(2)(cos(30[deg])+isin(30[deg]))
.
For the origin of square root term, see the derivation below. The following functions are useful when dealing with complex-valued numbers:
real(a)
returns the real component of the argument.imag(a)
returns the imaginary component of the argument.abs(a)
returns the magnitude of the complex-valued argument.arg(a)
returns the phase.conj(a)
returns the complex conjugate.realdot(a,b)
returns the dot product of the two input arguments. The result is identical toreal(a*conj(b))
but also will define the correct partial derivatives.
Let's consider quantities that are not time-harmonic, such as norms. From the above expression for the time - domain solution in terms of the frequency-domain phasor, we can anticipate a simple relationship between frequency-domain norms and time-domain cycle averages. By splitting the phasor into real and imaginary parts,
we see that for the cycle-average of the dot product of two time-harmonic vector fields and
:
because the cross-terms proportional to integrate to zero over a full period
.
Let's look at some examples from frequency domain acoustics and electromagnetics. For pressure acoustics, the dependent variable is the scalar pressure field , and we can express the RMS pressure in decibel, or the sound pressure level, as
In electromagnetics, we are often interested in the heat source due to resistive heating, whose instantaneous value is defined in terms of the current density and electric field as
Taking the time average, we obtain
As noted above, in COMSOL®, the operation for two complex numbers is implemented as
realdot(a,b)
. Note that for quantities that are not time-harmonic, such as the above heat source, recovering the time-domain quantity from a frequency-domain computation is not entirely trivial, as none of the four terms in the dot product cancel out, so the expression for the heating over time is:
Modeling and Solving Time-Harmonic Problems
You can learn more about modeling and solving time-harmonic problems in acoustics, electromagnetics, and solid mechanics in a two-part blog post series on modeling the harmonic excitations of linear systems. The first part on modeling the harmonic excitations of linear systems provides an overview of concepts and conditions for which the assumption is used and outlines some options for solution approaches. The second part on modeling the harmonic excitations of nonlinear systems extends this discussion, addressing working with nonlinear systems. Both parts also connect you with models and applications where you can practice modeling several cases firsthand.
Submit feedback about this page or contact support here.