Tidal bulges model - WORK IN PROGRESS

No preview image

1 collaborator

Default-person Arthur Hjorth (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0RC7 • Viewed 342 times • Downloaded 16 times • Run 0 times
Download the 'Tidal bulges model - WORK IN PROGRESS' modelDownload this modelEmbed this model

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


Comments and Questions

what is a tidal bulge? (Question)

dear mr hjorth, how is this rather complicated model progressing? i am looking at reflexivity. would like to get moving again on the comses too! regards, howard

Posted almost 13 years ago

Click to Run Model

globals [ state px py vix viy earth themoon grav embarycenter]

breed [ earths anearth ]
breed [ moons moon ]
breed [ vectors vector ]
breed [ waters water ]
breed [ barycenters barycenter]
breed [ gravitations gravitation ]

turtles-own [ 
  mass    ; mass
  vx      ; velocity x
  vy      ; velocity y
  ax      ; tick acceleration x
  ay      ; tick accelration y 
  ]

to setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks
  set-default-shape turtles "circle"


  create-gravitations 1
  [
    set hidden? true
  ]

  create-moons 1
  [
    set size 5
    set mass moon-mass
    ;; sets initial position
    setxy 15 100
    ;; sets initial velocity x y
    set vy -2
    set vx 3.5
    ;; moon's white, but this looks better
    set color gray
  ]

  create-earths 1 
  [
    ; inits earth
    set size 20
    set mass earth-mass
    setxy 0 0 
    set color green
    set vx .1

  ]
;  create-waters 1440
  create-waters 180
  [

  ]
  create-barycenters 1 [
    set hidden? true
  ]
  
;  ask one-of barycenters [
;    move-barycenter
;  ]  
  
  
      
    set themoon one-of moons
    set earth one-of earths
    set grav one-of gravitations
    set embarycenter one-of barycenters
  
  
  layout-circle waters 10

ask waters 
    [
      set color blue
      set size 1
      set vx [vx] of earth
      set vy [vy] of earth
      set mass .5
    ]
    
    
  
  ;; follow earth at first
  ;;follow one-of earths  
end 

to go

  
  ;; first clear old acceleration variables
  ask turtles [set ax 0 set ay 0]
  ;; then calculate new acceleration to all turtls
  ask earths [ calc-earth-acceleration ]
  ask waters [ calc-waters-acceleration ]
  ;ask waters [ earth-push-water ]
  ask moons [ calc-moon-acceleration ]
  ;; then change their velocities according to acceleration
  ask turtles [ add-acceleration ]
  ;; then move them
  ask turtles [ move ]
  ;; set the gravitational center between moon and earth
  ask earths [find-center]
  
  ask waters [add-friction]
  
  tick
end 

to find-center
  let d distance themoon
  let h towards themoon
  let reldistance d * [mass] of themoon / (mass + [mass] of themoon)
;  let reldistance [mass] of amoon / (mass + [mass] of amoon)
  ask barycenters [setxy ([xcor] of myself + sin(h) * reldistance) ([ycor] of myself + cos(h) * reldistance)]
end 

to calc-earth-acceleration

  let d distance themoon
  let h towards themoon
  let relativegravity [mass] of themoon / ([mass] of themoon + [mass] of self)
  let force ([mass] of self + [mass] of themoon) / d ^ 2 
;  show force
  set ax force * sin h * relativegravity
  set ay force * cos h * relativegravity

;; adding this accelration to waters too

  ask waters [
    set ax ax + force * sin h * relativegravity
    set ay ay + force * cos h * relativegravity
  ]
end 

to calc-moon-acceleration
  let d distance earth
  let h towards earth
  let relativegravity [mass] of earth / ([mass] of earth + [mass] of self)
  let force ([mass] of self * [mass] of earth) / d ^ 2   
;  show force
  
  set ax force * sin h * relativegravity
  set ay force * cos h * relativegravity
end 

to calc-waters-acceleration
  ; find heading towards earth
  let h towards earth
  ; reverse it
  set h h - 180
  ; place gravation at radius of earth away from earth
  ask grav [setxy ([xcor] of earth + sin h * 10) ([ycor] of earth + cos h * 10)]
  
  ;; if water is already exactly on surface of earth, no acceleration
   ifelse (xcor = [xcor] of grav and ycor = [ycor] of grav)
    [
      set ax ay
      set ay ax
    ]
    ;; if water is "below earth's surface", pull it towards grav
   [
   ifelse (towards earth != towards grav)
    [
      ; now pull water towards grav
      set h towards grav
      ; find distance to grav
      let d distance grav
      ; the closer it is, the less it pulls or pushes
      
      let force d / 8
      set ax force * sin h
      set ay force * cos h

    ]
    ;; if water is above earth's surface, pull it towards grav by a bit less
    [
      ; now pull water towards grav
      set h towards grav
      ; find distance to grav
      let d distance grav
      ; the closer it is, the less it pulls or pushes
      
      let force d / 10
      set ax force * sin h
      set ay force * cos h
;      
    ]
    
   ]
   
  ; now for gravity between water and moon
  ; first moon pulls water
  let d distance themoon
  set h towards themoon
;  let relativegravity [mass] of themoon / ([mass] of themoon + [mass] of self)
  let relativegravity 1
  let force .03
;  let force ([mass] of self * [mass] of themoon) / d ^ 2   
  set ax ax + force * sin h * relativegravity
  set ay ay + force * cos h * relativegravity
  ; then water pulls moon 
  ask themoon [
    set ax ax + force * sin (h - 180) * relativegravity
    set ay ay + force * cos (h - 180) * relativegravity
  ]
  

  
  ; add push between waters
    ask waters with [who != [who] of myself and xcor != [xcor] of myself and ycor != [ycor] of myself]
    [
      if distance myself < 3
      [
        set h towards myself
        set force wpush / distance myself
        set ax ax + force * sin (h - 180)
        set ay ay + force * cos (h - 180)
        ]

    ]
end 

to add-friction
  
  set vx vx * friction
  set vy vy * friction
end 

to add-acceleration
  set vx vx + ax
  set vy vy + ay
end 

to move
  setxy xcor + vx ycor + vy
end 

to earth-push-water
  let d distance earth
  let h towards earth + 180
  let force ([mass] of self * [mass] of earth) / d ^ 2
 ; show force
;  show force
  set ax ax + force * sin h / [mass] of self
  set ay ay + force * cos h / [mass] of self
end 

There is only one version of this model, created almost 13 years ago by Arthur Hjorth.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.