Plane & Spherical Wave Model (2D)

Plane & Spherical Wave Model (2D) preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 269 times • Downloaded 39 times • Run 0 times
Download the 'Plane & Spherical Wave Model (2D)' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

The phenomenon modelled is the generation of spherical and plane waves and their interaction. We use the simple expressions in SI units given in most Electromagnetism textbooks.

The models contains 9 spherical waves that are displaceable in real time and 4 plane waves, every wave is create to have a full set of directions and combinations available.

Since Netlogo is not a language which is not specialized for this kind of phenomena, a first idea to generate a clear image was to use tiny-sized patches and asociate a color to it to give an idea of the passing wave.

►Agents:

Patches: These are the key element on the model, every patch owns a value "esferax" or "planox" (esfera:sphere, plano:plane) where x stands for each wave (1,2,3,...). The sum of this ones will determine the pcolor of each patch. Using scale-color is possible to have a uniform colorized wave. In this case we use as base color blue.

Observador: Configura los valores inicial y enciende con un switch las ondas que quiera observar, a su vez es capaz de cambiar la posición de estas y los valores ingresados inicialmente.

►Properties:

Patches: esfera1 to esfera9 or esferax: Each one stores the value of tthe correspondent spherical wave influence in the patch which is calculated by the formula _ (1 / r ) * cos(wavenum(r - ct))

plano1 to plano4 or planox: Each one stores the value of the correspondent plane wave influence in the patch, which is calculated by the formula cos(wavenum((x-y) - ct)

Globals:

Wave_len: Wavelenght of light (visible range only, nanometers)

switches: plano-x and esfera-x.

x,y : Coordinate displacement of esfera-x from the center (except from esfera-5) in micrometers.

Display-velocity : Determines the number of ticks that would be repeated every time GO executes.

HOW IT WORKS

SETUP (Initialize): Clears the interface and reset ticks

GO (Iterative / Tick):

Each patch checks which switch is on, depending on it it would calculate the influence of each wave set as on in the pcolor value using their corresponding equation.

If the switch is set off, the influence of planox or esferax is set 0.

Finally, every patch sum their corresponding planox and esferax values and set it as their pcolor with color-scale blue.

HOW TO USE IT

►The SETUP and GO button were explained in order above

►The inputs:

Set Wave_len as the light desire to model.

Switches: Set switches on for each wave you desire to activate.

X, Y : You can move the position of the origin of the waves (except from the one in the center) even during the process.

Display-velocity : Waves will reproduce faster but in cost of image quality.

NOTE: You can change any value during the process

THINGS TO NOTICE

Depending on each wave, you will notice constructive and destructive interference.

THINGS TO TRY

Get 2 sphere waves closely (0.5 or 1.5 distance).

CREDITS AND REFERENCES

Sebastián Rodríguez

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [wave_num c]
patches-own [esfera1 esfera2 esfera3 esfera4 esfera5 esfera6 esfera7 esfera8 esfera9 plano1 plano2 plano3 plano4]

to setup
  clear-all
  reset-ticks
  calculate-init-values
end 

to calculate-init-values
  set c 3
  ask patches[set esfera1 0 set esfera2 0]
end 

to go
wave-generator
  repeat display-velocity [tick]
end 

to wave-generator
  set wave_num (2 * pi / wave_len)
  ask patches[
;===========================================================PLANOS=============================================
ifelse(plano-1)[
      let r wave_num * (- pxcor + pycor)
      set plano1 20 * cos(r * (10 ^ 3) - ticks * wave_num * c * (10 ^ 2) )
    ]
    [set plano1 0]

ifelse(plano-2)[
      let r wave_num * (pxcor + pycor)
      set plano2 20 * cos(r * (10 ^ 3) - ticks * wave_num * c * (10 ^ 2) )
    ]
    [set plano2 0]

ifelse(plano-3)[
      let r wave_num * (- pxcor - pycor)
      set plano2 20 * cos(r * (10 ^ 3) - ticks * wave_num * c * (10 ^ 2) )
    ]
    [set plano3 0]

ifelse(plano-4)[
      let r wave_num * (pxcor - pycor)
      set plano4 20 * cos(r * (10 ^ 3) - ticks * wave_num * c * (10 ^ 2) )
    ]
    [set plano4 0]
;===========================================================ESFERAS=============================================
             ifelse(esfera-1)  [
      let r (sqrt((pxcor + x) ^ 2 + (pycor - y) ^ 2))
      set esfera1   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
      [  set esfera1 0      ]

       ifelse(esfera-2)[
    let r (sqrt((pxcor) ^ 2 + (pycor - y) ^ 2))
    set esfera2   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
  [  set esfera2 0]

  ifelse(esfera-3) [
    let r (sqrt((pxcor - x) ^ 2 + (pycor - y) ^ 2))
    set esfera3   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
  [ set esfera3 0 ]


  ifelse(esfera-4)[
   let r (sqrt((pxcor + x) ^ 2 + (pycor) ^ 2))
   set esfera4   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2)) ]
  [ set esfera4 0 ]

      ifelse(esfera-5)[
      let r ( sqrt((pxcor ^ 2) + (pycor ^ 2) ))
      set esfera5   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
      [ set esfera5 0]


    ifelse(esfera-6)  [
     let r (sqrt((pxcor - x) ^ 2 + (pycor) ^ 2))
     set esfera6   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
  [  set esfera6 0 ]




  ifelse(esfera-7)[
   let r (sqrt((pxcor + x) ^ 2 + (pycor + y) ^ 2))
   set esfera7   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
  [  set esfera7 0  ]


  ifelse(esfera-8)[
   let r (sqrt((pxcor) ^ 2 + (pycor + y) ^ 2))
   set esfera8   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
  [  set esfera8 0]


ifelse(esfera-9) [
      let r (sqrt((pxcor - x) ^ 2 + (pycor + y) ^ 2))
      set esfera9   500 * (1 / ( r + 0.000001) ) * cos(wave_num * r * (10 ^ 3) -  ticks * wave_num * c * (10 ^ 2))    ]
    [  set esfera9 0]




;===========================================================COLOREAR=============================================

set pcolor  scale-color blue (100 + esfera1 + esfera2 + esfera3 + esfera4 + esfera5 + esfera6 + esfera7 + esfera8 + esfera9 + plano1 + plano2 + plano3 + plano4) 0 244
  ]
end 

There is only one version of this model, created over 4 years ago by Sebastián Omar Rodríguez Falcón.

Attached files

File Type Description Last updated
Plane & Spherical Wave Model (2D).png preview Preview for 'Plane & Spherical Wave Model (2D)' over 4 years ago, by Sebastián Omar Rodríguez Falcón Download

This model does not have any ancestors.

This model does not have any descendants.