JuliaDynamics / Agents.jl

Agent-based modeling framework in Julia
https://juliadynamics.github.io/Agents.jl/stable/
MIT License
729 stars 117 forks source link

Mixed boundary conditions #828

Closed mastrof closed 1 year ago

mastrof commented 1 year ago

I'm working on a model with mixed boundary conditions, e.g. a 2D model which is periodic along the x direction, but has closed walls along the y direction.

What I'm doing right now is to use a periodic space and then re-define the behavior at the y boundary in the agent stepping function. A bit clunky but it's ok.

I was wondering if there's any interest in properly implementing such behavior directly in the library? "In principle" it doesn't seem too complicated, the main change would be to have normalize_position operate differently on each axis in a loop according to some dims argument. I'm not yet sure, however, how one could deal with the Space for the dispatch. Options I thought of:

The second option would be more elegant, but the first one would be immediate to add and doesn't require any change to the existing code.

Let me know if you think this could be useful