Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with flux model #156

Closed
arouinfar opened this issue Apr 3, 2024 · 19 comments
Closed

Problems with flux model #156

arouinfar opened this issue Apr 3, 2024 · 19 comments
Assignees
Labels

Comments

@arouinfar
Copy link
Contributor

The induced emf in the pickup coil should be proportional to the loop area, as the flux in this case is |B|*A.

Steps to reproduce on the Transformer Screen:

  1. Select voltmeter and set loop area to 20%.
  2. Use alt input to drag the magnet/electromagnet through the pickup coil at a constant speed.
  3. Note the maximum displacement of the voltmeter needle.
  4. Set loop area to 100% and repeat (2)-(3). The voltmeter reading appears to be the same, even though there is 5x difference in loop area.

Here's a video.

loop-area.mp4

I realize there's still calibration to do in #66, but it looks like the emf isn't at all affected by the loop area, so over to @pixelzoom to investigate.

@arouinfar arouinfar added the type:bug Something isn't working label Apr 3, 2024
@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 3, 2024

The EMF is definitely affected by the loop area, and it's definitely increasing in the scenario that you've described -- you can verify by watching pickupCoil.coil.emfProperty in Studio. But EMF is not increasing a much as it should, because we're fudging the loop area to work around another problem -- see getEffectiveLoopArea in PickupCoil.ts, shown below. loopRadiusRange is ~[67,150].

For the scenario that you described above with 2 loops, A is ~9000 at 20%, but only ~20,000 at 100%. That's significantly less than 5x the area, only 2.2x the area.

This is a serious problem, and I don't immediately have thoughts on how we're going to address it.

  /**
   * Ported directly from the Java versions, this is a workaround for Unfuddle ticket
   * https://phet.unfuddle.com/a#/projects/9404/tickets/by_number/721.
   * 
   * When the magnet is in the center of the coil, increasing the loop size should decrease the EMF.  But since we are
   * averaging sample points on a vertical line, multiplying by the actual area would (incorrectly) result in an EMF
   * increase. The best solution would be to take sample points across the entire coil, but that requires many changes,
   * so Mike Dubson came up with this workaround. By fudging the area using a thin vertical rectangle, the results are
   * qualitatively (but not quantitatively) correct.
   *
   * NOTE from the Java version:
   * This fix required recalibration of all the scaling factors accessible via developer controls.
   */
  private getEffectiveLoopArea(): number {
    const width = this.coil.loopRadiusRange.min;
    const height = 2 * this.coil.loopRadiusProperty.value;
    return width * height;
  }

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 4, 2024

To understand the origins of the getEffectiveLoopArea workaround and the problem that it addressed ...

Below is the transcript of https://phet.unfuddle.com/a#/projects/9404/tickets/by_number/721, which was opened 9/23/2008.

To see how the Java implementation was changed, the related SVN commits were:


User report:

I ran the Faraday’s Electromagnetic Lab. It’s a wonderful pedagogic tool in order to understand the different aspects of Faraday’s Law. Nevertheless, I think there is a bug in the transformer part. The induced tension is maximum when the area of the inductive coil is also maximum. At this point, the coupling between the two coils is minimum and the induced tension should be minimum (a part of the magnetic flux in the induced coil is in the opposite direction).


Comment by CM

Went over this with Kathy today.

To reproduce:

  • go to Transformer tab
  • set electromagnet current source to AC
  • set pickup coil indicator to Voltmeter
  • put electromagnet in center of pickup coil
  • turn on dev control "Show pickup flux"
  • increase the loop area

As you increase the loop area, the flux should decrease, but it increases.

This is a fundamental problem in the model. We compute flux like this:

sum_Bx = sum the B-field x components for all sample points on the coil
average_Bx = sumBx / #points
flux = #loops * loop_area * average_Bx

So the flux increases because we're multiplying by the loop area.

I can't solve this, need a new model.


Comment by CM

Kathy wrote:

Mike,

To describe the bug and hypothesis of problem with model ....

It is most apparent if you put the pickup coil exactly centered vertically and horizontally with the electromagnet in AC mode.
The EMF induced SHOULD be largest with the pickup coil the same size as the electromagnet, and decrease as you increase the coil diameter such that now the total flux should be reduced.
HOWEVER, the total flux through the coil increase as you increase the coil diameter.

My hypothesis: Right now the model adds up all of the test points in the line along the vertical center of the coil, takes their average, and then multiplies by the area. This is the wrong weighting - it is overweighting the center flux - because the center flux is ONLY applying to the center area - the area futher in or out of the page, but at the vertical height of the center, is not experiencing the same flux as the rest of the center coil.
With the coils aligned as such, as you increase the loop past the diameter of the electromagnet, the total flux should go down, because all of the area you are adding should be subtracting flux but the current algorithm doesn't do that.
I can see how you could program something to do the correct weighting if you knew that the pick-up coil and the electromagnetic coil were aligned with the same center axis - but I am having trouble with the model you'd need to account for the any off axis alignment. Or maybe it would fix it enough to account for just the center coil flux (and its area) separately and then do all the other flux as we have been or something.

This may or may not be clear. I am out tomorrow, but we can talk next week about it.

Kathy


Comment by CM

One more note... We have 2 types of magnets in this sim: dipole and electromagnet. The pickup coil currently does not need to know what type of magnet is involved, its model is generally applicable to both magnet types. There are many advantages to preserving this generality. So whatever the solution is for this problem, it should ideally address both types of magnets, not just electromagnets.


Comment by CM

Kathy and Mike came up with 2 solutions.

(1) Sample the B-field using a grid that covers the entire area of the coil. Only half of the grid would need to be computed, since the grid is symmetrical. This solution requires a 3D version of magnet.getStrength(x,y,z), and would involve many many more computations to sample the B-field.

(2) Instead of using the loop area to compute flux, use an "effective area". The effective area is a thin rectangle that surrounds our existing column of sample points.

(1) is expensive, so we investigated (2), and it looks qualitatively reasonable. The sim will require re-calibration. I will publish a version with solution (2), and Kathy will re-calibrate.


Comment by CM

Kathy,

A new version of Faraday is here:
http://www.colorado.edu/physics/phet/dev/faraday/2.01.03/

Our fix for this issue changed the range of the emf, so this version needs to be calibrated.

Since you volunteered to do this, here are the approaches to calibrating this sim:

(1) calibrate the model
I've added a new developer control called "EMF scale". Assuming that previous versions behaved as desired, you should be able to get the same behavior by scaling the emf. And the same scale value should be usable in all tabs.

The scale value I came up with is 3.51, and here's how I arrived at that value (you should verify):

  • go to "Transformer" tab
  • select AC current source with 4 loops
  • set amplitude to 100% on electromagnet
  • select Voltmeter indicator
  • set pickup loops=3, area =100%
  • turn on "Display pickup flux" developer control
  • move electromagnet to center of pickup coil
  • pause the clock
  • step the clock and record the largest emf
  • do all of the above in version 2.01.02 and 2.02.03
  • max emf in 2.01.02 = 1771585
  • max emf in 2.01.03 = 504180
  • emf scale = 1771585 / 504180 = 3.51

I did NOT do a detailed comparison of 2.01.02 and 2.01.03 with emf scale=3.51.

(2) calibrate the view
This is more time consuming, more error prone, and must be done separately for each tab. If you were happy with how the sim behaved previously, I don't recommend this approach. But the relevant calibration controls are:

  • Lightbulb glow scale
  • Light rays scale
  • Voltmeter scale
  • Pickup electrons scale
  • Electromagnet electrons scale

(3) combine methods (1) and (2)
Scale the model (emf) to get in the ballpark, then tweak the sensitivity of specific parts of the view.

Let me know which method you use, and what the new default values should be. Then I'll publish another version that we can run by the person who reported this issue.

Thanks!

Chris

PS: As the warning in the developer control panel indicates, the developer controls are not reset by "Reset All". Keep that in mind while calibrating.


Comment by KP

Used method 1.

Pick-up coil tab. EMF scale = 3.0
Transformer tab. EMF scale = 3.0
Generator tab. EMF scale = 2.5

Kathy


@arouinfar
Copy link
Contributor Author

arouinfar commented Apr 4, 2024

Sounds like we've got a lot to discuss!

The EMF is definitely affected by the loop area, and it's definitely increasing in the scenario that you've described -- you can verify by watching pickupCoil.coil.emfProperty in Studio.

I originally tried to do that, but the values change so fast in Studio that I couldn't determine anything meaningful.

But EMF is not increasing a much as it should, because we're fudging the loop area to work around another problem -- see getEffectiveLoopArea in PickupCoil.ts, shown below. loopRadiusRange is ~[67,150].

Thanks for digging up the history behind this feature. I haven't had the time to fully digest it, but I think it's extremely problematic to do this for the Bar Magnet. Repeating the steps I outlined in #156 (comment) on the Pickup Coil screen yields similarly terrible results. I literally cannot tell the difference in induced emf for a loop area of 20% and 100%, all else being equal. This defies Faraday's Law, a fundamental learning goal of the sim.

EDIT: When the pickup coil is large, the magnetic field through the top/bottom of the coils is not orthogonal to the loop area, so the change in flux should not scale linearly.
image

@pixelzoom pixelzoom changed the title Loop area of pickup coil appears to have no effect on induced emf "Effective loop area" model is problematic. Apr 5, 2024
@kathy-phet
Copy link

@arouinfar - I'll see if Mike D is available to join Thursday meeting to discuss this model aspect.

pixelzoom added a commit that referenced this issue Apr 11, 2024
@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 13, 2024

4/11/24 design meeting with @arouinfar @kathy-phet @ariel-phet @KatieWoe @Nancy-Salpepi @pixelzoom, Mike Dubson.

@ariel-phet suggested dividing a loop's area into a set of thin rectangles, one for each Bx sample point, as shown in the sketch below. Compute width * height * Bx for each rectangle.

Consensus was that this will be a better approximation than the "effective area" approach. I'll implement.

loop

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 13, 2024

Here's the first step, visualizing the chords that will be used to set the width of the rectangle for each sample point. The visualization is as if you are looking down the x-axis, into the coil. There's no model behind this yet.

screenshot_3222

pixelzoom added a commit that referenced this issue Apr 13, 2024
pixelzoom added a commit that referenced this issue Apr 13, 2024
pixelzoom added a commit that referenced this issue Apr 13, 2024
@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 16, 2024

Something I'll have to investigate is why the Generator screen uses a difference sample-point strategy for the pickup coil. It uses a fixed number of points, while the other screens use a variable number of points with fixed spacing. So there are fewer chords (see screenshot below), and a fixed number of chords. The area approximation is going to therefore be much less accurate, becoming less accurate as the loop area increases.

Why did we do this for the Generator screen? Can we switch to the strategy used in the other screens? Looking at Unfuddle SVN history, I beleive that this strategy was introduced for Unfuddle#248. This comment that I made on 3/28/2008 suggests that it would OK to use the "fixed spacing" approach in the Generator screen:

For pickup sample point spacing, I applied a strategy pattern (see PickupCoil.SamplePointStrategy), so that different magnets could have different number of sample points, and so that we could still use a fixed number of sample points in the Generator panel (where the magnet is not draggable and this problem doesn't exist).

screenshot_3225

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 18, 2024

4/18/24 design meeting with @arouinfar @kathy-phet @Nancy-Salpepi @KatieWoe

@kathy-phet has brought up a potential problem with the new model. When the magnet is inside the coil, we'll be sampling points inside the magnet. If we do use the entire cross-section rectangles at those points, we will be using too large an area, and exaggerting the EMF. So for sample points inside the magnet, we'll assume that the magnet has some thickness, and use that thickness as the area. The field outside the magnet will be relatively weak, so we will ignore that part of the coil's cross section.

We also discuss the fact that the Generator screen is using a different sample-point strategy, as shown in #156 (comment). Consensus was that this is unnecessary, and having so few sample points will result in a much less accurate approximation of the coil's area. So I'm going to consolidate to one strategy to be used for all screens.

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 19, 2024

So for sample points inside the magnet, we'll assume that the magnet has some thickness, and use that thickness as the area.

Thinking about this more... This is a performance concern. Currently, sample points only need to be updated when the loop area changes, which is infrequently. Adding dependencies on the magnet position and coil position would result in the sample points updating constantly. So I'll need to carefully consider an efficient way to do this.

@pixelzoom
Copy link
Contributor

Here's the improved visualization. For a sample point inside the magnet, chord length is the magnet's thickness. For the bar magnet, thickness is 20. For the electromagnet, thickness is the loop diameter.

screenshot_3238 screenshot_3239

@pixelzoom pixelzoom mentioned this issue May 1, 2024
4 tasks
@pixelzoom
Copy link
Contributor

Notes from meeting with @arouinfar and @ariel-phet:

@pixelzoom
Copy link
Contributor

pixelzoom commented May 7, 2024

@kathy-phet reported #166 on 5/7/24. It was a bit lost inside this long issue, so I moved it to its own issue.

@pixelzoom pixelzoom changed the title "Effective loop area" model is problematic (new flux model) New flux model May 8, 2024
@pixelzoom pixelzoom changed the title New flux model Problems with flux model May 8, 2024
@pixelzoom
Copy link
Contributor

Status of this issue:

@pixelzoom
Copy link
Contributor

pixelzoom commented May 20, 2024

Design meeting 5/20/24 @arouinfar @kathy-phet @pixelzoom

We'll leave this open and "on hold" until #166 and #164 are fixed. Then play with the sim again to verify that there are no other problems.

@pixelzoom
Copy link
Contributor

@arouinfar will take one last past through this.

@arouinfar
Copy link
Contributor Author

I reviewed on main, and the flux model looks good. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants