C. Marx
C. Marx

Reputation: 1

Netlogo: Is it possible to have different patch sizes for saving calculation time for modeling?

I'm new to Netlogo, and the idea is to simulate a water- and concentration flow. The scale of my model is about 1/10 mm; by a cell of 7.7 cm to 2.6 cm. That makes about 200200 patches, which consumes quite a calculation power. My question is, if it is possible to create rougher grid at specific points in Netlogo? I know that this is possible for example in CFD Modeling, Groundwater Modelling, ...

Thank you for your help! I'm locking for a nice discussion.

Best regards,

Christian

Upvotes: 0

Views: 57

Answers (1)

JenB
JenB

Reputation: 17678

It's not possible to have patches of different sizes. However, you can create patch-sets that group together patches into a named entity. That would allow you to get round some of your computational power issues but could also lead to fairly awkward coding. Here is an example that changes patch colours randomly but treats some areas as single units.

globals [ list-of-regions region1 region2 ]

patches-own
[ regionID
]

to setup
  clear-all
  ask patches
  [ set regionID 0
    set pcolor one-of [ green brown yellow ]
  ]
  set region1 patches with [ pxcor > -10 and pxcor < 0 and pycor > -10 and pycor < -6 ]
  ask region1
  [ set regionID 1
    set pcolor red
  ]
  set region2 patches with [ pxcor > 5 and pxcor < 10 and pycor > 0 and pycor < 3 ]
  ask region2
  [ set regionID 2
    set pcolor blue
  ]
  set list-of-regions (list region1 region2)
  reset-ticks
end

to go
  ask patches with [regionID = 0 ] [ set pcolor one-of [ green brown yellow ] ]
  foreach list-of-regions
  [ #region ->
    let this-colour one-of [ red blue ]
    ask #region
    [ set pcolor this-colour
    ]
  ]
  tick
end

NetLogo deals very naturally with patch-sets at the individual level but you need to switch to lists if you don't want to code the actions of each patch-set individually.

Upvotes: 1

Related Questions