Hi all,
I got some unexpected results using the FourierLossSolver and I think there might be two problems.I have tried to reproduce the problems with a simple example consisting of a magnetic-ring circuit around a wire with an AC current with frequency f_source. The current is such that the average amplitude of the flux density in the ring is 1 T.
The example (with mesh) is in FourierLossTest1.zip
An experiment takes 2 s. After 1 s, the fourier analysis starts (Fourier Start Time = 1.0)
The "Frequency" of FourierLossSolver is called f_fourier here. Only the first harmonic of the fourier series is considered (Fourier Series Components = Integer 1).
With f_source=1.0 and f_fourier=1.0 (T_phase_1=0.0; Harmonic Loss Field Exponent 1 = Real 2.0), the result in results/fourier_loss.dat is 9.845809E-01, where 1.0 was expected.
Looking at the number of time steps (40) and the mesh size, this is a reasonable results.
Next, we use f_source=0.99999999999 and f_fourier=0.99999999999. In this case, the result is 7.488119E+00, which is completely wrong.
I have no idea about the cause of this problem.
The second problem has to do with the computation of the result.
Again, we may use f_source=1.0 and f_fourier=1.0, but for the example "Harmonic Loss Field Exponent 1 = Real 2.0" is changed into Harmonic Loss Field Exponent 1 = Real 1.0, and "Fourier Start Time = Real 1.0" is changed into "Fourier Start Time = Real 0.05".
In fact we use the amplitude (instead of ampitude**2) for the computation of the loss.
The result is 9.902315E-01, which is close to 1.0, as expected.
Next, T_phase_1 is changed from 0.0 into 0.125 (a phase shift of 45 deg); the amplitude was not changed.
Now, we get 1.400399E+00, which is close to sqrt(2).
Looking at the source code, I found the following possible explanation.
Consider B_x, B_y at one point with B_x and B_y having the same phase:
B_x = B_hat_x * cos(omega*t-phi)
B_y = B_hat_x * cos(omega*t-phi)
So, the magnitude is
B_mag = sqrt(B_x**2+B_y**) = sqrt(B_hat_x**2+B_hat_y**) * cos(omega*t-phi)
and the amplitude is
B_hat = sqrt(B_hat_x**2+B_hat_y**)
So, the amplitude doesn't depend on the angle phi (of course).
If we write "Harmonic Loss Field Exponent" = alpha, I would expect the result B_hat**alpha.
I think, I read in the source of FourierLoss that the cos and sin terms of the fourier series are dealt with separately.
So, B_x, BY are written as (only first term of the fourier series):
B_x = B_hat_x * cos(omega*t-phi) = B_hat_x * [cos(phi)*cos(omega*t) + sin(phi)*sin(omega*t)]
B_y = B_hat_x * cos(omega*t-phi) = B_hat_y * [cos(phi)*cos(omega*t) + sin(phi)*sin(omega*t)]
For j==2 in the source code, the cos terms are dealt with
ValAtIp = sqrt[B_hat_x**2 * cos(phi)**2 + B_hat_y**2 * cos(phi)**2]
= cos(phi) * sqrt[B_hat_x**2 + B_hat_y**2]
= cos(phi) * B_hat
result_cos = ValAtIp**alpha = cos(phi)**alpha * B_hat**alpha
In a similar way (j==3 in the source code), we get for the sin terms:
result_sin = sin(phi)**alpha * B_hat**alpha
The total result is:
result = result_cos + result_sin = [cos(phi)**alpha + sin(phi)**alpha] * B_hat**alpha
For alpha==2, we get the result I would expect:
result = [cos(phi)**2 + sin(phi)**s] * B_hat**2 = B_hat**2
This result doesn't depend on phi.
For alpha==1, we get:
result = [cos(phi) + sin(phi)] * B_hat
For phi==0 or phi==pi/2, we get the result I would expect (result=1), but for phi==pi/4, we get result=sqrt(2)*B_hat,
This was also calculated in the example.
Other values of alpha also give results I wouldn't expect.
If the above behavior was intended, this message may be seen as a waning for other users.
With kind regards,
Martin Hoeijmakers
Unexpected results with FourierLossSolver
-
- Posts: 37
- Joined: 22 Oct 2017, 21:03
- Antispam: Yes
-
- Site Admin
- Posts: 4803
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Unexpected results with FourierLossSolver
Hi Martin,
It is possible that there is an issue. The routine was carefully verified against some analytical solutions and we were happy with the results but it seems indeed there robustness is not too great as you demonstrate with your example.
Would you have the suggested corrections to the code available in source code. It would be easier to check the changes, and perhaps we could also use your corrections as such. I didn't yet study the code in more detail.
The nice thing of the module is that it can integrate exactly over (linear functions * trigonometric functions).
-Peter
It is possible that there is an issue. The routine was carefully verified against some analytical solutions and we were happy with the results but it seems indeed there robustness is not too great as you demonstrate with your example.
Would you have the suggested corrections to the code available in source code. It would be easier to check the changes, and perhaps we could also use your corrections as such. I didn't yet study the code in more detail.
The nice thing of the module is that it can integrate exactly over (linear functions * trigonometric functions).
-Peter
-
- Posts: 37
- Joined: 22 Oct 2017, 21:03
- Antispam: Yes
Re: Unexpected results with FourierLossSolver
Hello Peter,
Thank you for your answer!
I have been thinking a bit. Looking at an existing source code is different from writing code, although I did a practicum with Fortran IV as a student .
I already have some experience with reading the vtu files in Python. So, I could do the postprocessing in that way. As the amount of data is quite large (about 100 GB), this is not a preferable way. In a later stage, I might try to learn more on Fortran 90 and the FEM methods used in Elmer (I am specialized in electrical machine and drives).
Kind regards,
Martin
Thank you for your answer!
I have been thinking a bit. Looking at an existing source code is different from writing code, although I did a practicum with Fortran IV as a student .
I already have some experience with reading the vtu files in Python. So, I could do the postprocessing in that way. As the amount of data is quite large (about 100 GB), this is not a preferable way. In a later stage, I might try to learn more on Fortran 90 and the FEM methods used in Elmer (I am specialized in electrical machine and drives).
Kind regards,
Martin
-
- Site Admin
- Posts: 4803
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Unexpected results with FourierLossSolver
Hi Martin,
No need to dwell into the code. If you could provide a simplistic example of the problem that would save a lot of time. As you demonstrate it may be an epsilon issue that only appears for some unfortunate choice of timesteps which you happened to hit.
-Peter
No need to dwell into the code. If you could provide a simplistic example of the problem that would save a lot of time. As you demonstrate it may be an epsilon issue that only appears for some unfortunate choice of timesteps which you happened to hit.
-Peter
-
- Posts: 37
- Joined: 22 Oct 2017, 21:03
- Antispam: Yes
Re: Unexpected results with FourierLossSolver
Hello Peter,
I have tried to give a very simple system as an example with the needed settings (prepared in the sif file) to see the phenomena. In what way could I be more helpful?
Kind regards,
Martin
I have tried to give a very simple system as an example with the needed settings (prepared in the sif file) to see the phenomena. In what way could I be more helpful?
Kind regards,
Martin
-
- Site Admin
- Posts: 4803
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Unexpected results with FourierLossSolver
Hi Martin,
Sorry, I omitted the file. It is great. Just doing too many things at the same time...
-Peter
Sorry, I omitted the file. It is great. Just doing too many things at the same time...
-Peter
-
- Site Admin
- Posts: 4803
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Unexpected results with FourierLossSolver
Hi Martin,
There is now a fix in "devel" branch.
The bug was not a big one - as is usually the case. It was related to end of a time cycle where the code decides to finish the cycle even though it is some small tolerance off from the official end-time.
Here is the fix:
https://github.com/ElmerCSC/elmerfem/co ... 180ec936e8
Your test case was in fact exemplary! Thank you for reporting!
-Peter
There is now a fix in "devel" branch.
The bug was not a big one - as is usually the case. It was related to end of a time cycle where the code decides to finish the cycle even though it is some small tolerance off from the official end-time.
Here is the fix:
https://github.com/ElmerCSC/elmerfem/co ... 180ec936e8
Your test case was in fact exemplary! Thank you for reporting!
-Peter
-
- Posts: 37
- Joined: 22 Oct 2017, 21:03
- Antispam: Yes
Re: Unexpected results with FourierLossSolver
Hello Peter,
Thank you for your extremely fast response!
I downloaded the new version and I have seen in my computation results that the cycle problem has been solved.
However, as I mentioned earlier, I noticed a second problem related to the use of cos and sin terms in the fourier series. Would you mind taking a look at that?
Kind regards
Martin
Thank you for your extremely fast response!
I downloaded the new version and I have seen in my computation results that the cycle problem has been solved.
However, as I mentioned earlier, I noticed a second problem related to the use of cos and sin terms in the fourier series. Would you mind taking a look at that?
Kind regards
Martin
-
- Posts: 37
- Joined: 22 Oct 2017, 21:03
- Antispam: Yes
Re: Unexpected results with FourierLossSolver
Hello Peter,
I didn't see any reaction on my question of the 10th of July.
Did you perhaps not notice the question?
Kind regards,
Martin
I didn't see any reaction on my question of the 10th of July.
Did you perhaps not notice the question?
Kind regards,
Martin