Depa men o Fish Biology, Fishe ies
and Aquacul u e
Flow-O ganisms Simula ion Sys em
FO gSimS
Ve sion 0.2
D . Oleksand a Shumilo a
Be lin, Sep embe 2025
Copy igh 2025 by IGB. All igh s ese ed. This documen may no , in whole o in pa , be copied, pho ocopied, ep oduced,
ansla ed, o educed o any elec onic medium o machine eadable o ma o m wi hou p io consen in w i en om IGB.
E e y e o has been made o ensu e he accu acy o his manual. Howe e , IGB makes no wa an ies wi h espec o his
documen and disclaims any implied wa an ies o me chan abili y and i ness o a pa icula pu pose. IGB shall no be liable
o any e o s o inciden al o consequen ial damages in connec ion wi h he pe o mance o use o his documen o he
examples he ein. The in o ma ion in his documen is subjec o change wi hou no ice.
2
Con en s
In oduc ion
1. O e iew
1.1. Ri e hyd odynamics a con luences
1.2. Ri e hyd odynamics wi h g oynes
1.3. Fish mo ion and beha io a con luences
2. Design concep s
2.1. Analy ical modeling o low in s aigh i e eaches
2.2. Analy ical modeling o low a i e con luences
2.3. Analy ical modeling o low a a i e each wi h g oynes
2.4. Pa icle acking
2.5. O ganisms mo ion
2.6. O ganisms beha io
3. Examples o es s
3.1. T acing o passi e pa icles in a g oyne ield
4. Acknowledgemen s
5. Re e ences
6. Lis ing o he code
3
In oduc ion
Unde s anding mo eable o ganism mo emen s and esponses o in e ac ions o hei en i onmen and
habi a ea u es is c ucial o de eloping eliable p edic i e ecological models. Las h ee decades ha e
seen ex ensi e ad ances in agen -based modeling in e ac ions o o ganisms wi h hei en i onmen
(G imm e al. 2024). These models employ a bo om-up app oach in which ele an in o ma ion abou
en i ies o a sys em a he lowe le el a e compiled oge he wi h he heo ies abou hei beha io and
hen simula ion wi h compu e codes. Implemen ing hose heo ies show eme gence o p ope ies a he
sys em-le el. Howe e , he gene aliza ions o modeling esul s ha e been o en hampe ed by he lack
o an explici s a egy o dealing wi h inhe i complexi ies o modeled sys ems and unce ain ies in
modeling. A p omising s a egy called pa e n-o ien ed modeling (POM) was in oduced o make
bo om-up modeling mo e igo ous (G imm e al. 2005). This s a egy p o ides a uni ying amewo k
o decoding he in e nal o ganiza ion o agen -based complex sys ems and leads owa d uni ied
algo i hmic heo ies o he ela ion be ween adap i e beha io and sys em complexi y.
De elopmen o his Flow-O ganisms Simula ion (FO gSimS) is p ima ily mo i a ed by a necessi y
o be e unde s and su i al o ish a he meso-scale habi a s o i e eaches wi h enginee ing
s uc u es (e.g. g oynes) and na u al ea u es (e.g. con luence) du ing a passage o oxic con aminan s.
Regula ion o i e s has been con en ionally accomplished wi h he cons uc ion o g oynes – la e al
dikes placed in sequences o ming g oyne ields along i e banks and o en close o con luences
(Sukhodolo 2014). G oyne ields, a ypical meso-habi a s uc u e, p o ide spawning and nu sing a ea
o gene alis ish species, whe eas ypically i e ine g a el-spawning species a e es ic ed o he heads
o g oynes as eplacemen spawning si es (Bischo & Wol e 2001). Con luences and hei mixing
p ocesses a e impo an o se e al easons. T ibu a ies, by deli e ing coa se allu ium, o m subs a e
in ish habi a s ha a e mo phologically linked o shallow and deep a eas wi h hyd odynamic s uc u es
con aining coun e cu en s, helical low, s eamwise-o ien ed o ical cells, and shea laye s
(Sukhodolo e al. 2023). Incomple e mixing close o ibu a ies and g oyne ields can be an impo an
ac o ha can educe he a es o mo ali y in ish du ing haza dous si ua ions as demons a ed by he
ecen ish kill in he Ode Ri e (Köhle e al. 2024).
The FO gSimS is based on he key idea o POM, which uses mul iple pa e ns obse ed in eal
sys ems o guide design o model s uc u e (G imm e al. 2005). Pa e ns used o design a model occu
a di e en spa ial and empo al scales and di e en hie a chical le els and he complex dynamic
sys ems a e unde s ood h ough e ealing how p ocesses on di e en scales a e in e ela ed. Mode n
agen -based modeling is guided by he s anda dized ules o mula ed in so called ODD (O e iew,
Design concep s, and De ails) p o ocol (G imm e al. 2006). This p o ocol includes de ailed desc ip ions
o : pu pose, a iables and scale, p ocesses o e iew and scheduling, design concep s, ini ializa ion,
inpu and desc ip ion o sub-models. Such p o ocols help eusing he model code o expansion o mo e
gene al modeling asks. Al hough he i s e sion o FO gSimS is ocused on he ish- low in e ac ions
modeling in i e s, i is planned ha he sys em will be expanded o model mo e gene al en i onmen s
including ai scapes, loodplains wi h ipa ian ege a ion, insec s and animals ela ed by hos -seeking
beha io . The e o e, he ODD p o ocol p o ides he basis o he FO gSimS. P esen documen p o ides
de ailed desc ip ion o he modeling sys em including heo e ical backg ounds, es da a, alida ion and
examples o modeling.
The de elopmen and applica ion o he sys em is a pa o he esea ch p ojec i led “Con luence
mixing: nea - ield hyd odynamic con ols o he in e modal beha io and hei implica ions o ish
ecology (Co eMix+)” unded by he Deu sche Fo schungsgemeinscha (DFG).
4
1. O e iew
1.1. Ri e hyd odynamics a con luences
Ri e con luences a e i al nodal poin s o lu ial ne wo ks and a e ho spo s o biodi e si y in lo ic
eshwa e s ecosys ems. The low s uc u e a con luences is highly non-uni o m and p oduces complex
pa e ns wi hin mixing in e aces ha a e isually appa en when incoming lows di e in colou o
u bidi y (Fig. 1). In some ins ances, mixing in e aces a e na ow nea he junc ion apex and g adually
inc ease in wid h o e dis ance (Fig. 1a,c). In o he cases, he mixing in e ace o igina es downs eam
o a b oad zone o s agnan wa e nea he con luence apex and expands downs eam apidly (Fig. 1b,d).
Such changes in he pa e ns indica e he in e modal beha io o mixing p ocesses.
The o e all mixing a e, designa ing he in e ace pa e n, has a conside able impac on he sp ead o
po en ially ha m ul pollu an s. In 2022, du ing a d ough along he Ode Ri e , a lack o dilu ion
compounded by inc eased wa e esidence ime enabled blooming o a b ackish wa e algae p oducing
a ha m ul oxin. E en hough emo e-sensing has demons a ed he po en ial dange o he algae bloom
in he ups eam eaches o he Ode , ea ly measu es ailed o p e en he mass kill o ish. This ailu e
can be pa ly explained by insu icien knowledge abou he ela ions among emo ely sensed pa e ns
o mixing, ac ual mixing a es and hei implica ions o ish ecology causing d ama ic impai men s.
Theo e ical gene aliza ions and nume ical modeling o con luence dynamics and mixing ha e been
ex ensi ely de eloped du ing he las wo decades. Ad anced compu a ional luid dynamics (CFD)
me hods ha di ec ly esol e la ge-scale low s uc u es ha e been applied o i e con luences
(Cons an inescu e al. 2011, Ho na-Munoz e al. 2020). Fundamen ally impo an was he de elopmen
o a mode-swi ching hypo hesis (Cons an inescu e al. 2011). In his hypo hesis, he mixing in e ace is
in a shea -laye mode when he eloci y di e ence be ween ibu a ies is la ge and can change o a wake
mode when eloci y di e ence is small when he me ging lows ha e a simila eloci y. Coupling o
shallow low heo ies o mixing laye s and wakes wi h Rozowskii’s heo y led o a new heo e ical
model o in e modal beha io o mixing in e aces (Sukhodolo e al. 2023). This analy ical model
explains bo h p olonged and as mixing in conco dan con luences, in eg a es he e ec s o la e al
ad ec i e luxes o momen um due o cen i ugal o ces and shows ha hei con ibu ion o momen um
exchange and mixing can be la ge han he e ec s o bed ic ion alone (Sukhodolo e al. 2023).
Ri e con luences and hei mixing p ocesses a e impo an o se e al easons. T ibu a ies, by
deli e ing coa se allu ium, o m subs a e in ish habi a s ha a e mo phologically linked o shallow
and deep a eas wi h hyd odynamic s uc u es con aining coun e cu en s, helical low and shea laye s
(Fig. 1). Flow discon inui ies be ween hese s uc u es p e en mixing locally and cause subs an ial
Fig. 1. Mixing pa e ns a he con luence o he i e s Ode and Wa a nea Küs in. (a) A high low
06/01/2000. (b) A low low 09/03/2004. (c) Field-scale model o he i e con luence a high low
condi ions. (d) Field-scale model o he i e con luence a high low condi ions.
5
di e ences in chemical composi ion, empe a u e and u bidi y. A sho dis ances (e.g. wi hin
con luence apex) ish bene i om he inc ease in downs eam anspo o p ey in dend ic ne wo ks
(G an e al. 2007). A long dis ances, he annual mig a ion o salmonid ish o spawning g ounds, he
salmon un, is guided by incomple e mixing p ese ing he smell o unique dissol ed mine als p esen
a he spawning si e (Scholz e al. 1976).
Empi ical esea ch on ish ecology a i e con luences has been mos ly ca ied ou wi h
elec o ishing and eleme y echniques and ha e epea edly epo ed ha i e ibu a ies a ec o e all
composi ion and spa ial pa e ns o ish assemblages in he main i e (Fe nandes e al. 2004, Boddy e
al. 2019). Al hough his esea ch p o ides in o ma ion on la ge spa ial scales, knowledge abou ish
beha io a small scales ele an o he la e al scales o mixing in e aces mainly comes om labo a o y
s udies. This esea ch examines he e ec s o u bidi y on he eac i e dis ance in ishes – isual dis ance
necessa y o de ec p ey, which also depends on isual acui y ela ed o a size o ish (Ba e e al. 1992,
Zamo & G ossman 2007, Slige & G ossman 2022). Ano he impo an a iable con olling abundance
pa e ns in mic o-habi a s is holding eloci y (e.g. ocal poin ) ha ensu es minimiza ion o me abolic
cos s equi ed o hold a posi ion in a s eam (Fausch 1984, Hill & G ossman 1993). These a iables a e
igh ly linked o he mechanisms o ish locomo ion and in e ac ion wi h u bulen s uc u es (e.g.
ka man o ex gai ing) allowing ish o bene i ene ge ically om wake s uc u es (Liao e al. 2003;
Liao 2022). E en hough he labo a o y esea ch is schema ized and in ol es se ious me hodological
cons ains such as ish days in cap i i y, hey explain a common obse a ion ha , a i e con luences,
u bid wa e nex o anspa en wa e can ac as an ideal e uge o escape p eda ion while sa ely d i -
eeding in he anspa en wa e (Biswas & Bo uah 2000).
1.2. Ri e hyd odynamics wi h g oynes
Regula ion o i e s has been con en ionally accomplished wi h he cons uc ion o g oynes – la e al
dikes placed in sequences o ming g oyne ields along i e banks and o en close o con luences
(Sukhodolo 2014). Flow sepa a es on a g oyne head and o ms a seconda y low ep esen ed by a la ge-
scale o ex wi h a e ical axis o o a ion called p ima y gy e. De lec ion o he low inside he g oyne
ield by banks and ups eam g oyne leads o he de elopmen o a seconda y gy e wi h an opposi e
di ec ion o o a ion o a p ima y gy e (Fig. 2). Loca ion, mu ual in e ac ions, and ene gy exchange
be ween gy es a e he ac o s ha c ea e speci ic eci cula ing pa e ns. G oyne ields, a ypical meso-
habi a s uc u e, p o ide spawning and nu sing a ea o gene alis ish species, whe eas ypically
i e ine g a el-spawning species a e es ic ed o he heads o g oynes as eplacemen spawning si es
(Bischo & Wol e 2001). Beside he limi ed size o he g oyne heads, he main disad an age o ish
is he shea laye induced by he g oyne head, which p opaga es owa ds he mid-channel and can
anspo eme ging y owa ds he main i e low whe e hey migh no su i e.
Fig. 2. E ec s o g oyne ields geome y on he pa e ns o mean low eloci y and mixing in g oyne
ields ( om Sukhodolo 2014). (a) Dis ance be ween g oynes is abou he same as hei leng h. (b)
Dis ance is mo e han wo imes la ge han he leng h o he g oynes and wo gy e sys ems is
de eloping. (c) Visualiza ion o he exchange be ween main i e and he g oyne ield.
6
1.3. Fish mo ion and beha io a con luences
Expe imen al obse a ions and documen a ion o ish wi hin con luences is e y sca ce and ha e been
ecen ly accomplished only in a labo a o y condi ions (Yuan e al. 2022). The s udy was pe o med in a
7 m long, 0.4 wide and 0.2 m deep lume. Tes ish – ca ps wi h o al numbe o 60 indi iduals o abou
6 cm long we e eleased a e 1 min o accommoda ion in a cage. Then hei ajec o ies and he low
hyd odynamics we e measu ed using ideo came as. The s udy epo s ha ish was mo ing a ound a
bounda y o sepa a ion zone and mo ing in o ei he a ibu a y o in o he main channel. Al hough he
au ho s explain his obse a ion as a choice o a ish dic a ed by he o ici y lines ha guided hei
na iga ion, i seems like ha ish was no adop ed o hei new en i onmen and explo ed he way o
escape by emaining in he co ne o he lume whe e hey a e p o ec ed om wo sides.
The absence o eliable da a o concluding on he beha io o ish a i e con luences p omp ed ou
s udy using he RIVER-LAB esea ch pla o m. In his s udy a 76 m long, 7 m wide and 40 cm deep
model o a i e con luence was c ea ed on he g a el-bed side a m o he Tagliamen o Ri e , I aly (Fig.
1c,d). These expe imen s allowed o documen he mo ion o ish wi hin he con luence mixing in e ace
using ideo came a and scaling ma king on he i e bed (Fig. 3). The esul s show ha ish is
p e e en ially using a ocal poin a he in e ace be ween wake-like s uc u e de eloping a ound he
con luence apex and he je -like low app oaching om he ibu a y. Fish was holding posi ion in such
ocal poin s o p olonged pe iods o ime anging be ween 5 o 10 minu es and hen mo ing o he
slowe wa e . A e some pe iod o es ish we e e u ning o he ocal poin s. Such beha io is explained
by ad an ages o eeding and minimizing ene gy o swimming. We sugges a hypo hesis ha his
beha io can be also c ucial o ish su i al du ing he passage o oxins. The deg ee o in oxica ion
mos p obably di ec ly ela ed o he ime ish spends in non- oxic and oxic wa e s and he modeling
wi h agen -based models can help o es his hypo hesis.
Fig. 3. Fish holding posi ion a he ocal poin s wi hin he mixing in e ace in he RIVER-LAB
expe imen s (Augus 2025). (a) The iew o he mixing in e ace wi hin he apex o a con luence
model ( he scaling mash is 10x10 cm). (b) Enla ged iew ( ish was abou 3 cm long). (c) An example
o ish ajec o y obse ed in a wake low.
The pu pose o he modeling wi h FO gSimS in his s udy will be o apply agen -base pa e n-o ien ed
modeling o examine ac o s de ining su i al o ish in i e s pollu ed by oxic con aminan s sp eading
h ough he i e ne wo ks. Ou model will simula e in oxica ion and mo ali y which is ela ed o he
ime o ish esidence and oxin concen a ion in low a eas h ough which he digi al ish mo es. I he
accumula ed oxins exceed ce ain h esholds, he ish will be designa ed as dead. In simula ions we will
explo e he e ec s o di e en mixing scena ios a he con luence and we will look a which ish,
depending on i s ini ial posi ion in he sys em and use o di e en habi a s, ha e a be e chance o
su i e. We will ocus on ela i ely sho ime pe iods o ew days ha allows simpli ica ions o ish
ene ge ics. The ou pu o he simula ions will allow quali a i e compa ison wi h he esul s o ish
sampling ha we e comple ed immedia ely a e he ca as ophic mass kill on he Ode Ri e in 2022.
To alida e he modeling o ish ajec o ies wi hin con luence we will use he esul s o ish ideo
eco ding coupled wi h da a abou low s uc u e. The esul s o simula ions will be used as a p ima y
ool o in e p e he esul s o ish sampling su eys.
7
2. Design Concep s
Nume ical Hyd odynamic Models. Modeling o ish beha io using indi idual-based app oach is a
classical ocus o many p e ious s udies (G imm & Railsback). An ex ensi e e iew o he li e a u e on
his subjec and speci ically wi h espec o hyd odynamics modeling is ecen ly p esen ed by Goodwin
e al. (2023). Ad anced modeling o con luence ha e been ca ied ou wi h eddy- esol ing nume ical
models (Cons an inescu e al. 2011), so called de ached eddy simula ions (DES), which p o ide insigh
in o de ails o u bulen s uc u e and o ealis ically ep oduce such complex lows a he scales ele an
(Fig. 4). Howe e , he limi a ion o using such complex models o agen -based modeling is ha hey
a e ex emally compu a ional expensi e and using hei ou pu wi hin ABMs is p oblema ic. Ano he
class o nume ical models, he so-called Reynolds A e age Na ie S okes equa ions (RANS), is less
compu a ionally expensi e han DES, bu s ill equi ing la ge numbe o e ices o cons uc
compu a ional domain and p o ides mainly in o ma ion on mean low eloci ies (Goodwin e al. 2023).
Fig. 4. Examples o LES modeling o he u bulen low s uc u e a a i e con luence. (a)
Visualiza ion o u bulen s uc u es wi h pa icles (Kaskaskia-Coppe Slough con luence om
Rhoads & Sukhodolo 2004). (b) Spa ial pa e ns o e ical o ici y in he ins an aneous low
modeled wi h LES ( om Cons an inescu e al 2012). (c) Obse ed u bulen s uc u es.
Analy ical Hyd odynamic Models. G imm & Railsback (2005) highligh ed he bene i s o using
analy ical models oge he wi h ABMs: ”…The s eng h and weakness o agen -based models and
analy ical models a e o a la ge deg ee in e sely ela ed. ABMs a e designed o analyzing complex
sys ems, bu he mo e complex ABMs a e, he ha de hey a e o o mula e, implemen , analyze,
unde s and, and communica e. Analy ical models, on he o he hand, ha e e y limi ed abili y o deal
wi h complex sys ems o au onomous indi iduals. Howe e , hey a e s ong exac ly in he ways ha
ABMs a e inhe en ly cumbe some”. The FO gSimS is p ima ily based on analy ical modeling o
complex u bulen lows in i e s, which we e ad anced du ing he las h ee decades (Niko a 1992,
Sukhodolo e al. 1998, Sukhodolo & Uij ewaal 2010, Sukhodolo e al. 2023).
2.1 Analy ical modeling o low in s aigh i e eaches.
Analy ical modeling o i e lows equi es a gene alized model o i e channel geome y. Niko a
(1992) sugges ed a pa abolic c oss-sec ion p o ile (Fig. 5a)
k
hB
=
, (1)
whe e
and
k
a e empi ical pa ame e s, B is he wid h o a channel, and h is he local dep h. Eq. (1)
can be ew i en as
by =
, whe e y is he i e bed ele a ion and b is he la e al coo dina e wi h he
o igin a he poin o symme y o a channel c oss-sec ion (Fig. 5a). Pa ame e s
and
e alua ed
om a i e c oss-sec ional using he leas squa es me hod, and
and
k
a e hen
1
=k
, and (2)
1
1
2
+
=
. (3)
8
Fig. 5. (a) A scheme o a i e c oss-sec ion Eq. (1). (b) Fi ing measu ed i e c oss-sec ion by he
model (1)-(3). (c) P edic ing spa ially a e aged shea s ess pa e ns and dep h on a i e each.
The analy ical model (1)-(3) p o ides he way o econs uc ing 2-D and 3-D pa e ns o low om he
1-D model o low hyd aulics
gS
h
c
u
x
u
u
u =+
+
2
2
, (4)
0=
+
+
x
Q
h
B
B
h
, (5)
whe e
c
is hyd aulic ic ion coe icien , g is g a i y accele a ion, h is mean i e dep h, u is mean
low eloci y, Q is wa e discha ge, S is wa e su ace slope, is ime, u is mean eloci y, and x is
longi udinal coo dina e. Eq. (4) - (5) desc ibe dynamics and conse a ion o mass o he i e low.
Quasi-uni o m low wi h ze o subs an ial accele a ion
=
+
0
x
u
u
u
app oxima es equa ions (4)-
(5) as (Sukhodolo e al. 2011)
ghS
u
c 2
2
=
, (6)
( )
2
1
4
1
Q
gBh
M=
, (7)
uhBQ=
, (8)
whe e M is simila i y pa ame e o quasi-uni o m low in an allu ial channel. Sel -o ganiza ion
p ocesses in lu ial sys em esul in ce ain ela ionship be ween dimensions o he i e channel and
wa e discha ge, which a e desc ibed by Eq. (7). I was demons a ed ha quasi-uni o m low depends
on he cha ac e is ics o he i e bed ma e ial, and Niko a (1992) sugges ed a model o he simila i y
pa ame e M
50
1000
lg15.0 d
h
M=
in g a el-bed i e s, (9)
12.09.0 =M
in sand-bed i e s, (10)
0.2=M
in i e s wi h cohesi e i e bed, (11)
whe e
50
d
is median diame e o i e bed ma e ial. Eq. (1) oge he wi h (7) and (8) again gi es a closed
sys em o he a iables
( )
Qu
,
( )
QB
, and
( )
Qh
. Wa e discha ge, i e bed ma e ial cha ac e is ic M
and channel geome y desc ibed by
and
k
ep esen a minimal se o pa ame e s necessa y o
desc ibe anspo o momen um in a i e channel. Analy ical solu ion o his sys em p o ided by he
ollowing equa ions (Niko a 1992)
9
k
k
k
k
kQ
M
g
u+
−
+
+
+
=4
2
4
1
3)1(4
1
, (12)
k
kQ
g
M
h+
+
=4
2
4
1
4
, (13)
k
k
k
k
kQ
g
M
B+
+
=4
2
4
1
44
. (14)
Hyd aulic ic ion coe icien c and bed shea s ess ela ed o ic ion eloci y u* (c =2(u*/u)2) can be
de ined as
( ) ( )
k
k
k
k
k
Q
g
M
Sc +
−
+
−
+
=4
12
4
1
1
234
0
2
, (15)
whe e S0 is he slope o he i e bed. Fig. 6 illus a es pe o mance o he model (12)-(14).
Fig. 6. Compa ison be ween measu ed da a ( he Sp ee Ri e a F ienb inck, om Sukhodolo &
Uij ewaal 2010) and model Eqs. (12)-(14) (solid lines a e modeled and dashed lines a e bes i s). (a)
Bulk low eloci y. (b) Bulk low dep h. (c) Wid h o he channel.
Assuming ha he i e bed slope and hyd aulic esis ance a e cons an , one ob ains he la e al p o ile o
dep h a e aged eloci y (Niko a 1992)
u(y)
umax =[1-(2y
B)k]2/3
, (16)
whe e umax is he dep h-a e aged eloci y a he cen e line o he channel.
The applica ion o he model wi hin he amewo k o he FO gSimS is illus a ed in Fig. 7. The inpu
is ep esen ed by a hyd og aph Q = ( ). Fo each alue o discha ge he bulk cha ac e is ic o low a e
calcula ed using Eq. (12)-(15). Then 2-D pa e ns o low eloci y, dep h, shea eloci y and la e al
luxes o momen um a e p edic ed using Eq. (16), Fig. 7. The bo om shea s esses a e calcula ed as
( ) ( )
Sbyhgbyu //
*=
, (17)
whe e S = S0 is he slope o he ee su ace o he low.
16
Modeling hyd odynamics in a i e each wi h con luence. In ibu a ies and he main i e , he i e
low is modeled using app oach desc ibed in he sec ion 2.1. The a ea o junc ion, whe e he lows me ge
a ci cula ajec o ies (Fig. 9a), is modeled using Rozo skii (1957) heo y in which he dep h a e aged
mean ec o o eloci y is di ec ed no mal o he adii o he cu ilinea junc ion pa . The eloci y
p o iles wi hin he mixing in e ace hen adjus ed o i Eq. (36) and (39) wi hin he mixing in e ace,
which is de ined by condi ions a he ups eam bounda y, by momen um a ion a he junc ion, and by a
ze o eloci y a ound junc ion apex. An example o a model o a i e each wi h con luence in he
mixing laye mode and weak wake e ec is shown in Fig. 14.
Fig. 14. Example o u bulen low ield ep esen a ion in a model o i e each wi h con luence
( om Sukhodolo e al. 2023). (a) Magni ude and di ec ion o mean low eloci y. (b) Pa e ns o
u bulen shea s ess.
2.3 Analy ical modeling o low a a i e each wi h g oynes.
Pionee ing labo a o y s udies by Rehbock (1929) e ealed de elopmen o ci cula ion low inside he
g oyne ields – he a eas be ween wo successi e g oynes. La e s udies by Wes ich (1978) in oduced
an aspec a io ϰ, he a io be ween leng h o g oyne and he dis ance be ween successi e g oynes, as a
quan i a i e c i e ia o ci cula ion pa e ns in he g oyne ields unde eme ged condi ions. The c i ical
alue o ϰ = 0.5 delimi s condi ions o o ma ion o ei he mul iple (ϰ < 0.5) o single (ϰ > 0.5)
ci cula ion sys ems (Fig. 15).
Fig. 15. Concep ual scheme o eci cula ion low pa e n in a g oyne ield as unc ion o he aspec
a io be ween he leng h o he ha bo side and he leng h o he sho e side ( om Sukhodolo e al.
2002).
In g oyne ield wi h aspec a io ϰ = 0.75 a la ge ci cula ion sys em occupies almos en i e g oyne
ield a ea, Fig. 2a. Concomi an ly wi h he inc ease o spacing be ween g oynes and dec ease o aspec
a io o ϰ = 0.35, he pa e n o eloci y ec o in he g oyne ield exhibi s wo coun e - o a ing
ci cula ions, Fig. 2b. The la ge ci cula ion occupies mo e han 2/3 o en i e g oyne ield a ea and is
loca ed in he downs eam pa o he g oyne. Sukhodolo (2014) demons a ed ha la e al p o iles o
mean low eloci y can be also i ed wi h he hype bolic angen unc ion Eq. (34), Fig. 16. Assuming
cons an u bulen iscosi y ac oss he laye he la e al u bulen luxes o momen um
'' u−
a e
desc ibed by a ecip ocal squa ed hype bolic cosine unc ion
17
Fig. 16. Compa ison o
p edic ions and measu emen s
o he mean low eloci y in a
g oyne ield ( om Sukhodolo
2014). (a) Aspec a io ϰ = 0.75
(symbols a e measu ed da a,
solid lines Eq. (34)). (b) In he
in e ace wi h in e media e
beha io (solid line is Eq. (39)).
22 cosh
1''
uu
u
=
−
,
( )
00 2
, anh
2
1yy
u
uu −
==
−
. (40)
Compa ison o measu ed and p edic ed using Eq. (40) p o iles o u bulen shea s ess a e shown in
Fig. 17.
Fig. 17. Compa ison o
p edic ions and measu emen s
o he mean low eloci y in a
g oyne ield ( om Sukhodolo
2014). (a) Aspec a io ϰ = 0.75
(symbols a e measu ed da a,
solid lines Eq. (40)). (b) In he
in e ace wi h in e media e
beha io (solid line is Eq.
(40)).
Compa ison o dimensionless local shea eloci y alues no malised wi h in eg al alues o open-
channel low is shown in Fig. 18a. Wi h eme ged g oynes, he bed shea s ess ( e ical u bulen lux
o momen um) is g ea ly educed inside he g oyne ield a ea, bu inhomogeneous and sligh ly la ge
han in ee channel when he g oynes a e subme ged. The la e al shea s ess (la e al u bulen lux o
momen um) is g ea ly inc eased inside he mixing in e ace, Fig. 18b. I is clea in Fig. 18 ha he
inc ease in la e al u bulen luxes o momen um can compensa e o he lack o shea s ess imposed
by he g oynes in he nea bank a ea, bu i is insu icien o conside able inc ease o low esis ance on
he each. The e o e, g oynes a ec low esis ance by cons ic ing he ac i e c oss-sec ional a ea o he
i e , which subsequen ly inc eases eloci y and shea s ess in he main low.
Fig. 18. No malized la e al p o iles o u bulence and hei modeling and compa ison wi h measu ed
da a ( om Sukhodolo 2014). (a) Ve ical luxes o momen um. (b) La e al luxes o momen um.
18
2.4 Pa icle acking.
In he p esen e sion o he FO gSimS a simple model o neu ally buoyan pa icle is implemen ed o
model he ad ec i e and di usi e p ocesses imposed on o ganisms by mo ing wa e . A his s age i
does no accoun o indi idual o ices, which would be in oduced in he nex e sion o he so wa e.
The andom walk model is a s anda d ool o mimic he beha iou o a ace pa icle wi hin a luid,
and can be desc ibed in i s gene al o m by a s ochas ic di e en ial equa ion
( )
d
d,xu
x=
,
( ) ( ) ( )
,',, xuxuxu +=
, (41)
whe e
x
is ec o o coo dina es,
u
is eloci y ec o ,
u
is mean eloci y ec o ,
'u
is eloci y
luc ua ion ec o , and
is ime. Equa ion (1) sol ed on a ce ain compu a ion domain wi h ini ial
condi ions
( )
0
0= x
, and he case-speci ic bounda y condi ions, p o ides a Lag angian se o pa icles
ajec o ies. These ajec o ies could be u he p ocessed o ob ain cha ac e is ics o mixing ha would
o he wise be impossible o measu e in ield. Tu bulence e m is p esen ed in he model by a no mally
dis ibu ed luc ua ing inc emen de ined on he g id by i s alues o s anda d de ia ion
( ) ( ) ( )
R ,,3,' xxσxu =
, (42)
whe e
σ
is he ec o o s anda d de ia ions o eloci y componen s, and
( )
R ,x
is no mally
dis ibu ed wi h ze o mean andom alue. Fou -poin in e se dis ance in e pola ion scheme a e used o
compu e eloci y ec o s in he compu a ional domain o bo h mean and u bulen eloci ies
( ) ( )
( )
=
=
=4
1
4
1
/1
/,
,
mm
mmm
xu
xu
, (43)
whe e
is dis ance be ween cu en posi ion o a pa icle and he nea es nodes o he compu a ional
g id. In wo-dimensional e sion o he model (41) cu en ly used in he code, he ho izon al componen s
o he eloci ies a e calcula ed using a simple nume ical scheme
( ) ( ) ( ) ( )
u u x x ++=+ '
, (44)
( ) ( ) ( ) ( )
y y ++=+ '
, (45)
whe e
x
is s eamwise coo dina e,
y
is ans e se coo dina e,
is ime pe iod,
u
and
a e mean
eloci ies in s eamwise and ans e se di ec ions espec i ely, and
'u
and
'
a e he s anda d de ia ions
o eloci ies along and no mal o a local s eamline o he low. The ime s ep was chosen as
( )
( )
2
** 32/01.0 uhu +=
= 0.05 s, whe e
is kinema ic iscosi y,
*
u
is shea eloci y, and
h
low dep h. The choice o he ime s ep was es ed by compa ing measu ed ajec o ies o d i e s and
simula ed ajec o ies, and was shown o ensu e s abili y o nume ical compu a ions.
The pe ec e lec ion condi ion was se on he wa e ’s edge o he g oyne ield. Tha means ha i a
pa icle eached ha bounda y i was e lec ed inside he g oyne ield a ea. The line connec ing g oyne
ips o he g oyne ield was speci ied as he ou e bounda y o he g oyne ield. Ini ial condi ions we e
speci ied by selec ing he pa icles loca ions inside he g oyne ield a ea.
2.5 O ganisms mo ion.
In he p esen e sion o he FO gSimS a simple model o passi ely mo ing neu ally buoyan pa icle
is implemen ed o model simple o ganisms such as algae. A his s age i does no accoun o indi idual
mo ions, which would be in oduced in he nex e sion o he so wa e.
19
2.6 O ganisms beha io .
In he p esen e sion o he FO gSimS a simple model o passi ely mo ing neu ally buoyan pa icle
is implemen ed o model simple o ganisms such as algae. A his s age i does no accoun o indi idual
mo ions and has no speci ied beha io , which would be in oduced in he nex e sion o he so wa e.
3. Examples o es s
3.1 T acing o passi e pa icles in a g oyne ield
He e, is he epo on he i s es o he code implemen ing he basic modules o he FO gSimS (see
lis ing o he code in he sec ion 6): he g id p ocessing module and neu al buoyance pa icle acking
module. The es case is a geome y and low hyd odynamics measu ed in a g oyne ield on he Elbe
Ri e (Sukhodolo 2002).
In he measu emen s udy on he g oyne ield a se o ace acking was implemen ed using su ace
d i e s, which posi ion in he ield es s was accu a ely mapped wi h a o al s a ion (Fig. 19). Topo-
Fig. 19. Geome y o he
es g oyne ield on he
Elbe Ri e and measu ed
loca ions o he su ace
d i e s (symbols wi h
di e en colo s ep esen
indi idual d i e s). The
solid lines show
ajec o ies o nume ical
pa icles in he
e i ica ion es s.
g aphical and hyd odynamic measu emen s wi h acous ic Dopple Velocime e s allowed o c ea e he
compu a ional mesh composed o 540 ec angula cells con aining in o ma ion abou loca ion, dep h,
magni ude and di ec ion o ime-a e aged low eloci y and s eamwise and la e al u bulence
in ensi ies. An example o he spa ial pa e n o s eamwise u bulence in ensi y is shown in Fig. 20.
Fig. 20. Spa ial pa e n
o s eamwise u bulen
in ensi y o he low in
he es g oyne ield o
he Elbe Ri e . The
da ke con ou s
ep esen s onge
u bulence. The pa e n
also e lec s he spa ial
a angemen o he low
in o one-gy e
eci cula ion sys em.
In he nume ical es s, he nume ical ace s we e eleased a he poin s co esponding o he loca ions
o he physical su ace d i e s’ eleases in he ield es s (Fig. 19). An example o a sc een- sho o he
FO gSimS illus a es a ypical ajec o y o a nume ical pa icle. I indica es ha he pa icle expe iences
he e ec s o u bulence which mo e he pa icle ou o s a iona y o bi ing and he de ia ions om he
smoo h ajec o y is sensi i e o he in ensi y o u bulence. These es s a e indica ing ha he code is
ealis ically ep oducing mo emen and u bulen di usion.
20
Fig. 21. A sc eensho o he
FO gSimS wi h an example
o simula ed ajec o y o a
pa icle eleased in he cen e
o he eci cula ion gy e. The
a ows show he magni ude
and di ec ion o he ime-
mean low eloci y. Black
solid line shows he wa e
edge line. G een line is he
ajec o y o he pa icle. The
ajec o y indica es ha in he
a ea wi h s onge u bulence
(see Fig. 20), he pa icle
exhibi ed s onge de ia ion
om he smoo h line.
4. Acknowledgemen s
I would like o hank D . Alexande Sukhodolo o he discussions and he help wi h de eloping he
concep and s uc u e o he simula ing sys em, and o p o ision o he es ing ma e ial. The sys em is
de eloped wi h he suppo o he Deu sche Fo schungsgemeinscha (g an SU 405/11).
5. Re e ences
G imm V, Be ge U, Meye M, Lo scheid I. Theo y o and om agen -based modeling: Insigh s om a i ual
special issues and a ision. 2024. En i on. Mod. So . 178, 106088.
G imm V, Re illa E, Be ge U, Jel sch F, e al. Pa e n-o ien ed modeling o agen -based complex sys ems:
Lessons om ecology. 2005. Science 310, 987-991.
G imm V, Be ge U, Bas iansen F, e al. A s anda d p o ocol o desc ibing indi idual-based and agen -based
models. 2006. Ecol. Model. 198, 115-126.
G imm V, Railsback SF. Indi idual-based Modeling and Ecology. 2005. P ince on Uni . P ess.
Goodwin RA, Lai YG, Ta lin DE, Smi h DL, McQui k J, T ang R, Ree es R. P edic ed nea - e m, ou -o -sample
ish passage, guidance, and mo emen ac oss di e se i e en i onmen s by cogni i ely ela ing momen a y
beha io al decisions o mul iscale memo ies o pas hyd odynamic expe iences. 2023. F on . Ecol. E ol. 11,
703946.
Sukhodolo A. Hyd odynamics o g oyne ields in a s aigh i e each. 2014. J. Hyd aul. Res. 52, 105-120.
Bischo A, Wol e C. The lood o he cen u y on he i e Ode : e ec s on he 0+ ish communi y and implica ions
o loodplain es o a ion. 2001. Regul. Ri e s: Res. Mgm . 17, 171-190.
Sukhodolo AN, Shumilo a OO, Cons an inescu GS, e al. Mixing dynamics a i e con luences go e ned by
in e modal beha io . 2023. Na u e Geosci. 16, 89-93.
Köhle J, Va ga E, Spah S, e al. Unp edic ed ecosys em esponse o compound human impac s in a Eu opean
i e . 2024. Sci. Rep. 7, 16.
Cons an inescu GS, Miyawaki S, Rhoads BL, Sukhodolo AN, Ki kil G. S uc u e o u bulen flow a a i e
confluence wi h momen um and eloci y a ios close o 1: Insigh p o ided by eddy‐ esol ing nume ical
simula ion. 2011. Wa e Resou . Res. 47, W05507.
21
Ho na‐Munoz D, Cons an inescu G, Rhoads, B, Lewis Q, Sukhodolo A. Densi y e ec s a a conco dan bed
na u al i e con luence. 2020. Wa e Resou . Res. 56, e2019WR026217.
Sukhodolo AN, Shumilo a OO, Cons an inescu GS, Lewis QW, Rhoads BL. Mixing dynamics a i e
con luences go e ned by in e modal beha io . 2023. Na u e Geosci. 16, 89-93.
G an EHC, Lowe WH, Fagan WF. Li ing in he b anches: popula ion dynamics and ecological p ocesses in
dend i ic ne wo ks. 2007. Ecology Le e s 10, 165-175.
Scholz AT, Ho all RM, Coope JC, Hasle AD. Imp in ing o chemical cues: he basis o home s eam selec ion
in salmon. 1976. Science 192, 1247-1249.
Fe nandes C, Podos J, Lindbe g JG. Amazonian ecology: T ibu a ies enhance he di e si y o elec ic ishes. 2004.
Science 305, 1960-1962.
Boddy NC, Booke DJ, McIn osh AR. Con luence con igu a ion o i e ne wo ks con ols spa ial pa e ns in ish
communi ies. 2019. Land. Ecol. 34, 187-201.
Ba e JC, G ossman GD, Rosen eld J. Tu bidi y-induced changes in eac i e dis ance o ainbow ou . 1992.
T ans. Am. Fish. Soc. 121, 437-443.
Zamo RM & GD G ossman. Tu bidi y a ec s o aging success o d i - eeding osyside dace. 2007. T ans. Am.
Fish. Soc. 136, 167-176.
Slige R, G ossman GD. Fo aging dynamics o a domes ica ed b ook ou . 2022. N. Am. J. Fish. Man. 42, 1340-
1348.
Fausch, K.D. P o i able s eam posi ions o salmonids: ela ing speci ic g ow h a e o ne ene gy gain. 1984. Can.
J. Zool. 62:441-451.
Hill J, G ossman GD. An ene ge ic model o mic ohabi a use o ainbow ou . 1993. Ecology 74, 685-698.
Liao JC, Beal DN, Laude GV, T ian a yllou MS. Fish exploi ing o ices dec ease muscle ac i i y. 2003. Science
302, 1566-1569.
Liao JC. Fish swimming e iciency. 2022. Cu en Biology 32, R589-R683.
Biswas SP, Bo uah S. Ecology o i e dolphin in he Uppe B ahmapu a. 2000. Hyd obiol. 430, 97-111.
Sukhodolo A. Hyd odynamics o g oyne ields in a s aigh i e each. 2014. Hyd aul. Res. 52, 105-120.
Yuan S, Xu L, Tang H, Xiao Y, Whi ake C. Swimming beha io o ju enile sil e ca p nea he sepa a ion zone
o a channel con luence. 2022. In . J. Sedimen Res. 37, 122-127.
Rhoads BL, Sukhodolo AN. Spa ial and empo al s uc u e o shea laye u bulence a a i e con luence. 2004.
Wa e Resou . Res. 40, W06304.
Cons an inescu G, Miyawaki S, Rhoads BL, Sukhodolo A, Ki kil G. S uc u e o u bulen low a a i e
con luence wi h momen um and eloci y a ios close o 1: Insigh p o ided by eddy- esol ing nume ical
simula ion. 2011. Wa e Resou . Res. 47, W05507.
Niko a V. Channel P ocesses and Hyd aulics o Small Ri e s. 1992. Sh iinca: Kishine .
Sukhodolo A, Thiele M, Bunga z H. Tu bulence s uc u e in a i e each wi h sand bed. 1998. Wa e Resou .
Res. 34, 1317-1334.
Sukhodolo A, Uij ewaal WSJ. Assessmen o a i e each o en i onmen al luid dynamic s udies. 2010. J.
Hyd aul. Eng. 136, 880-888.
Sukhodolo AN, Shumilo a OO, Cons an inescu GS, Lewis QW, Rhoads BL. Mixing dynamics a i e
con luences go e ned by in e modal beha io . 2023. Na . Geosci. 16, 89-93.
Cunge JA, Holly FM, Ve wey A. P ac ical Aspec s o Compu a ional Ri e Hyd aulics. 1980. Pi man Ad anced
Publishing P og am: London.
22
Sukhodolo AN, Niko a VI, Ka oliko VM. Flow dynamics in allu ial channels: he legacy o Ki il V. G ishanin.
2011. J. Hyd aul. Res. 49, 285-292.
Sukhodolo AN, Sukhodolo a TA. Case s udy: E ec o subme ged aqua ic plan s on u bulen s uc u e in a
lowland i e . 2010. J. Hyd aul. Eng. 136, 434-446.
Rozo skii IL. Flow o Wa e in Bends o Open Channels. 1957. Acad. Sci. Uk aine, Kie .
Sukhodolo AN, Uij ewaal WSJ, Engelha d C. On he co espondence be ween mo phological and
hyd odynamical pa e ns o g oyne ields. 2002. Ea h Su . P oces. Lan oms 27, 289-305.
Rehbock T. Das Flussbaulabo a o ium de Technischen Hochschule in Ka ls uhe. 1926. VDI-Ve lag, Be lin,
Ge many.
Wes ich B. Massenaus ausch in S ömungen mi To wasse zonen un e s a ionä en Fliessbedingungen. 1978.
Tech. Repo SFB 80/ET80, Ins i u ü Hyd omechanik, Uni e si ä Ka ls uhe.
23
6. Lis ing o he code.
///////////////////////////////////////////////////////////////////////////
//
// PROJECT: Pa icle T acking Model 0.1
// DESCRIPTION: Model Objec
// REFERENCE: PTModel.h
// NOTES: In e ace o he CNumG id objec
//
// Copy igh (c) 2025 IGB, All igh s ese ed
// Re . 1.0 27.02.2025
//
// D . O. Shumilo a
//
///////////////////////////////////////////////////////////////////////////
#i !de ined
(AFX_PTMODEL_H__C3A4EB57_0C06_11D5_96EE_046809C1FFFF__INCLUDED_)
#de ine AFX_PTMODEL_H__ C3A4EB57_0C06_11D5_96EE_04680SC1FFFF__INCLUDED_
#i _MSC_VER > 1000
#p agma once
#endi // _MSC_VER > 1000
#include "NG id.h"
class CPTModel : public CObjec
{
public:
CPTModel ();
i ual ~CPTModel ();
CNumG id m_g id;
BOOL m_bG idLoaded;
} ;
#endi // !'de ined
(AFX_PTMODEL_H__C3A4EB57_0C06_11D5_96EE_046809C1FFFF__INCLUDED_)
///////////////////////////////////////////////////////////////////////////
//
// PROJECT: Pa icle T acking Model 0.1
// DESCRIPTION: Model Objec
// REFERENCE: PTModel.cpp
// NOTES: Implemen a ion o he CNumG id objec
//
// Copy igh (c) 2025 IGB, All igh s ese ed
// Re . 1.0 27.02.2025
//
// D . O. Shumilo a
//
///////////////////////////////////////////////////////////////////////////
#include "s da x.h"
#include "FlowT ack.h"
#include "PTModel.h"
24
#i de _DEBUG
#unde THIS_FILE
s a ic cha THIS_FILE[]=__FILE__;
#de ine new DEBUG_NEW
#endi
///////////////////////////////////////////////////////////////////////////
//Cons uc ion/Des uc ion
///////////////////////////////////////////////////////////////////////////
CPTModel::CPTModel ()
{
m_bG idLoaded = FALSE;
}
CPTModel::~CPTModel ()
{
}
///////////////////////////////////////////////////////////////////////////
//
// PROJECT: Pa icle T acking Model 0.1
// DESCRIPTION: Pa icle Objec
// REFERENCE: Pa icle.cpp
// NOTES: Implemen a ion o he CPa icle objec
//
// Copy igh (c) 2025 IGB, All igh s ese ed
// Re . 1.0 16.03.2025
//
// D . O. Shumilo a
//
///////////////////////////////////////////////////////////////////////////
#include "s da x.h"
#include "FlowT ack.h"
#include "Pa icle.h"
#include "ma h.h"
#i de _DEBUG
#unde THIS_FILE
s a ic cha THIS_FILE(]=__ FILE_ ;
#de ine new DEBUG_NEW
#endi
///////////////////////////////////////////////////////////////////////////
//Cons uc ion/Des uc ion
///////////////////////////////////////////////////////////////////////////
CPa icle::CPa icle()
{
m_pG id = NULL;
m_pView = NULL;
m_d = 0.05;
m_logPen.lopnColo = RGB(255, 0, 0); // ed colo o pa icle
25
m_logPen.lopnS yle = PS_SOLID;
m_logPen.lopnWid h.x = m_logPen.lopnWid h.y = 1;
m_nea es Nodes.Se Size(4);
m_bFi s Time = TRUE;
}
CPa icle::~CPa icle()
{
}
oid CPa icle::Se Coo dina esXY(double dX, double dY)
{
m_dX = dx;
m_dy = dy;
}
oid CPa icle::D awPa icle(CDC* pDC)
{
ASSERT (m_pG id != NULL);
CPoin poin = m_pG id->Ge Poin (m_dX, m_dy);
pDC->Mo eTo (poin .x - 2, poin .y);
pDC->LineTo (poin .x + 3, poin .y);
pDC->Mo eTo (poin .x, poin .y-2);
pDC->LineTo (poin .x, poin .y+3);
// TRACING:
/* CNode node;
node = (CNode) m_nea es Nodes.Ge A (0);
poin = m_pG id->Ge Poin (node.m_dX, node.m_dY);
pDC->Mo eTo (poin );
o (in i=1; i < m_nea es Nodes.Ge Size(); i++)
{
node = (CNode) m_nea es Nodes.Ge A (i);
poin = m_pG id->Ge Poin (node.m_dX, node.m_dY);
pDC->LineTo (poin );
pDC->Mo eTo (poin );
}
node = (CNode) m_nea es Nodes.Ge A (0);
poin = m_pG id->Ge Poin (node.m_dX, node.m_dY);
pDC->LineTo (poin ); */
}
//
// Gene al scheme:
// ^ Ymax
// LTN #2 RTN #1 | +Vy
// + ----------- + | ^
// | | | |
// | | | |
// | | | +Vx <-------+-------> -Vx
// | *x,y | | |
// | | | |
// | | | |
// | | | -Vy
// + ----------- + |
// LBN #3 RBN #0 |
// |
32
}
e u n (dSumVR / dSumR)
}
double CPa icle::Ge _in e pola ed_Vy(double dXc, double dYc)
{
CNode node;
double dR, dV, dX, dY;
double dSumVR = 0.0;
double dSumR = 0.0;
double dN = 1.0;
o (in i=0; i < m_nea es Nodes.Ge Size(); i++)
{
node = (CNode) m_nea es Nodes.Ge A (i);
dX = dXc - node.m_dX;
dY = dYc - node.m_dY;
dR = sq (dX * dX + dY * dY);
dV = Ge _Vy(&node);
dR = pow(dR, -dN);
dSumVR += (dV * dR);
dsumR += dR;
}
e u n (dSumVR / dSumR);
}
double CPa icle::Ge _in e pola ed_V()
{
double dVx = Ge _in e pola ed_Vx(m_dX, m_dY);
double dVy = Ge _in e pola ed_Vy(m_dX, m_dY);
e u n (sq (dVx * dVx + dVy * dVy));
}
//
// Pa icle ad ec ion wi h mean eloci y ield is compu ed
// using a o h-o de Runge-Ku a scheme:
//
// k1 = d * Vi( , Xin)
// k2 = d * Vi( +d /2, Xin+k1/2)
// k3 = d * Vi( +d /2, Xin+k2/2)
// K4 = d * Vi( +d , Xin+k3)
// Xin+l = Xin + k1/6 + k2/3 + k3/3 + k4/6
//
// i = x, y Xi = X,Y
//
BOOL CPa icle::Ad ec _Pa icle()
{
// 1 - compu e inc emen s in x and y di ec ions:
double dK1X = m_d *Ge _in e pola ed_Vx(m_dX, m_dY);
double dK1Y = m_d *Ge _in e pola ed_Vy (m_dX, m_dY);
double dK2X = m_d *Ge _in e pola ed_Vx (m_dX+dK1X/2, m_dy+dK1Y/2);
double dK2Y = m_d *Ge _in e pola ed_Vy (m_dX+dK1X/2, m_dY+dK1Y/2);
double dK3X = m_d *Ge _in e pola ed_Vx(m_dX+dK2X/2, m_dY+dK2Y/2);
double dK3Y = m_d *Ge _in e pola ed_Vy (m_dX+dK2X/2, m_d +dK2Y/2);
33
double dK4X = m_d *Ge _in e pola ed_Vx (m_dx+dK3X, m_dY+dK3Y);
double dK4Y = m_d *Ge _in e pola ed_Vy (m_dX+dK3X, m_dYy+dK3Y);
double dX = dK1X/6.0 + dK2X/3.0 + dK3X/3.0 + dK4X/6.0;
double dY = dK1Y/6.0 + dK2Y/3.0 + dK3Y/3.0 + dK4Y/6.0;
// 2 - mo e pa icle:
m_dX += dX;
m_dY += dY;
// 3 - calcula e dispe sion:
m_dX += Ge _dX_ u bulen ();
m_dY += Ge _dX_ u bulen ();
// 4 - check i pa icle s ill in cu en cell:
i (IsPa icleInCell()) e u n TRUE;
//5 –
// De ineIn e sec (m_dX - dX, m_dY - dY, m_dX, m_dY);
e u n FALSE;
}
BOOL CPa icle::IsPa icleBenea h(double dY)
{
CNode* pLNode = (CNode*) &m_nea es Nodes.Ge A (3);
CNode* pRNode = (CNode*) &m_nea es Nodes.Ge A (0);
double dYl = pLNode->m_dY;
double dY2 = pRNode->m_dY;
i (dY < dYl && dY < dY2) e u n TRUE;
i (dY > dYl && dY < dY2) e u n TRUE;
i (dY < dYl && dY > dY2) e u n TRUE;
e u n FALSE;
}
BOOL CPa icle::IsPa icleOnTop(double dY)
{
CNode* pLNode = (CNode*) &m nea es Nodes.Ge A (2);
CNode* pRNode = (CNode*) &m_nea es Nodes.Ge A (1);
double dY1 = pLNode->m_dY;
double dY2 = pRNode->m_dY;
i (dY > dYl && dY > dY2) e u n TRUE;
i (dY < dYl && dY > dY2) e u n TRUE;
i (dY > dY1 && dY < dY2) e u n TRUE;
e u n FALSE;
}
BOOL CPa icle::IsPa ic1eOnLe (double dX)
{
CNode* pTNode = (CNode*) &m_nea es Nodes.Ge A (2);
CNode* pBNode = (CNode*) &m_nea es Nodes.Ge A (3);
double dX1 = pTNode->m_dX;
34
double dX2 = pBNode->m_dX;
i (dX > dX1 && dX > dX2) e u n TRUE;
i (dX < dX1 && dX > dX2) e u n TRUE;
i (dX > dX1 && dX < dX2) e u n TRUE;
e u n FALSE;
}
BOOL CPa icle::IsPa ic1eOnRigh (double dX)
{
CNode* pTNode = (CNode*) &m_nea es Nodes.Ge A (1);
CNode* pBNode = (CNode*) &m_nea es Nodes.Ge A (0);
double dX1 = pTNode->m_dX;
double dX2 = pBNode—>m_dx;
i (dX < dX1 && dX < dX2) e u n TRUE;
i (dX > dX1 && dX < dX2) e u n TRUE;
i (dX < dX1 && dX > dX2) e u n TRUE;
e u n FALSE;
}
oid CPa icle::De ineIn e sec (double dXo, double dYo,
double dX, double dY)
{
CNode* pNode
_
1;
CNode* pNode
_
2;
i (IsPa icleBenea h(dY))
{
pNode_1 = (CNode*) &m_nea es Nodes.Ge A (3);
pNode_2 = (CNode*) &m_nea es Nodes.Ge A (0);
TRACE("Pa icle a bo om n");
}
i (IsPa ic1eOnTop(dY))
{
pNode_1 = (CNode*) &m_nea es Nodes.Ge A (2);
pNode_2 = (CNode*) &m_nea es Nodes.Ge A (1);
}
i (IsPa ic1eOnLe (dX))
{
pNode_1 = (CNode*) &m_nea es Nodes.Ge A (2);
pNode_2 = (CNode*) &m_nea es Nodes.Ge A (3);
}
i (IsPa icleOnRigh (dX))
{
pNode_1 = (CNode*) &m nea es Nodes.Ge A (0);
pNode_2 = (CNode*) &m_nea es Nodes.Ge A (1);
}
double dX1 = pNode_1->m_dX; double dY1 = pNode_1->m_dY;
doub1e dX2 = pNode_2 —>m_dX; doubl dY2 = pNode_1—>m_dY;
double dA1 =(dY2 - dYl) / (dX2 - dXl);
double dBl dY1 – dA1 * dX1;
double dA2 = (dY - dYo) / (dX - dXo);
double dB2 = dY - dA2 * dX;
35
double _dX = (dB2 - dB1) / (dA2 - dA1);
double _dY = dA1 * m_dX + dB1;
}
oid CPa icle::WalkingPa icle(CDC *pDC)
{
in k = 0;
CWai Cu so wai ;
m_logPen.1opnColo = RGB(0, 255, 0);
CPen pen;
CPen* pOldPen;
CPoin poin ;
i (!pen.C ea ePenIndi ec (&m_1ogPen)) e u n;
pOldPen = pDC->Se1ec Objec (&pen);
s and((unsigned) ime( NULL ));
o (in i=0; i < 1000; i++)
{
D awPa icle(pDC);
i (!Ad ec _Pa icle())
{
Ge Nodes();
}
}
pDC->Selec Objec (pOldPen);
}
double CPa icle::Ge Random(double dMean, double dVa )
{
double dVal;
double dsum:
dSum = 0.0;
o (in i=0; i < 50; i++)
{
dVa1 = (double) ( and() / (double) RAND_MAX);
dSum += dVa1;
}
dVal =(dSum - 25.0) / sq (50.0/12.0);
dVal = dMean + dVal*dVa ;
e u n dVal;
}
double CPa ic1e::Ge _dX_ u bu1en ()
{
e u n (m_d * Ge Random(0.0, 0.3));
}
36
///////////////////////////////////////////////////////////////////////////
//
// PROJECT: Pa icle T acking Model 0.1
// DESCRIPTION: Pa icle Objec
// REFERENCE: Pa icle.h
// NOTES: In e ace o he GPa icle objec
//
// Copy igh (c) 2025 IGB, All igh s ese ed
// Re . 1.0 16.03.2025
//
// D . O. Shumilo a
//
///////////////////////////////////////////////////////////////////////////
#i de ined(AFX_PARTICLE_H_BDE556E0_1174_11D5_96EE_046809C10000_INCLUDED)
#de ine AFX_PARTICLE_H_BDE556E0_1174_11D5_96EE_046809Cl0000_INCLUDED_
#i _MSC_VER > 1000
#p agma once
#endi // _MSC_VER > 1000
#include "NG id.h"
ypede CTypedP A ay<CP A ay, CNode*> CNP A ay;
class CPa icle : public CObjec
{
public:
double Ge _dX_ u bulen ();
double Ge Random(double dMean, double dVa );
oid De ineIn e sec (double dXo, double dYo,
double dX, double dY);
BOOL IsPa icleOnRigh (double dX);
BOOL IsPa icleOnLe (double dX);
BOOL IsPa icleOnTop(double dY);
BOOL IsPa icleBenea h(double dY);
oid WalkingPa icle(CDC* pDC);
oid Ge Nodes();
CPa icle();
i ual ~CPa icle();
oid Se Coo dina esXY(double dX, double dY);
oid D awPa icle(CDC* pDC);
BOOL Ge Bo omRigh Node(); // LTN +------+
RTN
BOOL Ge TopRigh Node(); // | |
BOOL Ge Bo omLe Node(); // | * |
BOOL Ge TopLe Node(); // LBN +------+
RBN
/////////////////////////////////////////////////////////////////////
//
BOOL IsPa icleinCell(); //
BOOL IsLe Bounda y(); // loca ion
BOOL IsRigh Bounda y(); //
desc ip i e
BOOL IsTopBounda y(); //
unc ions
BOOL IsBo Bounda y(); //
37
/////////////////////////////////////////////////////////////////////
/
double Ge _in e pola ed_V();
double Ge _Vx(CNode* pNode);
double Ge _Vy(CNode* pNode);
double Ge _in e pola ed_Vy(double dXc, double dYc);
double Ge _in e pola ed_Vx(double dXc, double dYc);
/////////////////////////////////////////////////////////////////////
/
BOOL Ad ec _Pa icle();
double m_dX; // cu en coo dina e in X di ec ion
double m_dY; // cu en coo dina e in Y di ec ion
double m_dZ; // cu en coo dina e in Z di ec ion
// (Z o igin is se a he ee su ace)
double m_d ; // ime inc emen
CNumG id* m_pG id; // poin e o a g id
CView* m_pView; //
LOGPEN m_logPen;
nodesA ay m_nea es Nodes;
BOOL m_bFi s Ti ne;
} ;
#endi
//de ined(AFX_PARTICLE_H_BDE556E0_1174_11D5_96EE_046809Cl0000_INCLUDED_)
///////////////////////////////////////////////////////////////////////////
//
// PROJECT: Pa icle T acking Model 0.1
// DESCRIPTION: G id Objec
// REFERENCE: NG id.cpp
// NOTES: Implemen a ion o he CNumG id objec
//
// Copy igh (c) 2025 IGB, All igh s ese ed
// Re . 1.0 05.03.2025
//
// D . O. Shumilo a
//
///////////////////////////////////////////////////////////////////////////
#include “s da x.h”
#include “ma h.h”
#include “FlowT ack.h”
#include “NG id.h”
#i de DEBUG
#unde THIS_FILE
s a ic cha THIS_FILE[]= __FILE__;
#de ine new DEBUG_NEW
#endi
///////////////////////////////////////////////////////////////////////////
//Cons uc ion/Des uc ion
///////////////////////////////////////////////////////////////////////////
CNode::CNode()
38
{
m_dX = 0.0 ;
m_dY = 0.0 ;
m_dH = 0.0 ;
m_dV = 0.0 ;
m_dD = 0.0 ;
}
CNode::~CNode()
{
}
CWEPoin ::CWEPoin ()
{
m_dX = 0.0 ;
m_dY = 0.0 ;
m_dD = 0.0 ;
}
CWEPoin ::-CWEPoin ()
{
}
CNumG id::CNumG id()
: m_ ec View(0, 0, 0, 0)
{
m_dXmin = 0.0 ;
m_dYmin = 0.0 ;
m_dXmax = 17.0 ;
m_dYmax = 9.0 ;
m_dVmin = 0.0 ;
m_dVmax = 0.0 ;
m_dAspec X = 1.0 ;
m_dAspec Y = 1.0 ;
m_dAspec V = 40; // 0.5 m/s is 40 picsels
}
CNumG id::~CNumG id()
{
}
///////////////////////////////////////////////////////////////////////////
//
// Da a inpu om an ex e nal ASCII da a ile. File s uc u e:
// x, y, h, V, di (coo dina es, dep h, speed and di ec ion o
// he low). E e y s ing pe ains o a speci ic node o he
// g id.
// No es: no checking o co ec ile s uc u e
// 28.02.01
BOOL CNumG id::Load_ om_File(CS ing s Pa hName)
{
FILE* m_pFile;
CS ing s E o ;
i ((m_pFile = open(s Pa hName, " b")) == NULL)
39
{
s E o .Fo ma ("Canno ind da a ile: %s", s Pa hName);
A xMessageBox (s E o , MB_ICONEXCLAMATION);
e u n FALSE;
}
else
{
loa x, y, h, V, di ;
while (! eo (m_pFile))
{
scan (m_pFile, "% % % % % n", &x, &y, &h, &V,
&di );
CNode node;
node.Se Coo dina es ((double) x, (double) y);
node.Se Veloci y ((double) V, (double) di );
node.Se Dep h ((double) h);
m_nodes.Add (node);
}
close (m_pFile);
}
e u n TRUE;
}
///////////////////////////////////////////////////////////////////////////
//
// Measu eG id unc ion p o ides he es ima es o main sizes
// o g id (max and min coo dina es, eloci y scale...)
//
oid CNumG id::Measu eG id()
{
o (in i = 0; i < m_nodes.Ge Size(); i++)
{
CNode node;
node = m_nodes.Ge A (i);
i (node.m_dX < m_dXmin) m_dXmin = node.m_dX;
i (node.m_dX > m_dXmax) m_dXmax = node.m_dX;
i (node.m_dY < m_dYmin) m_dYmin = node.m_dY;
i (node.m_dY > m_dYmax) m_dYmax = node.m_dY;
i (node.m_dV < m_dVmin) m_dVmin = node.m_d ;
i (node.m_dV > m_dVmax) m_dVmax = node.m_dV;
}
}
oid CNumG id::Compu eAspec s ()
{
i (m_ ec View.Wid h()> 0)
m_dAspec X = abs(m_dXmax - m_dXmin) / m_ ec View.Wid h();
i (m_ ec View.Heigh ()> 0)
m_dAspec Y = abs(m_dYmax - m_dYmin) / m_ ec View.Heigh ();
}
CPoin CNumG id::Ge Poin (double dX, double dY)
{
CPoin pn Re u n;
in nX = m_ ec View. igh - (in ) ((dX - m_dXmin) / m_dAspec X);
in nY = m_ ec View.bo om - (in ) ((dY - m_dYmin) / m_dAspec Y);
pn Re u n.x = nX;
pn Re u n.y = nY;
40
e u n pn Re u n;
}
double CNumG id::Ge _X_ omPoin (CPoin poin )
{
double dRe = m_dXmin+(m_ ec View. igh - poin .x)*m_dAspec X;
e u n dRe ;
}
double CNumG id::Ge _Y_ omPoin (CPoin poin )
{
double dRe = m_dYmin+ (m_ ec View.bo om-poin .y) *m_dAspec Y;
e u n dRe ;
}
oid CNumG id::D awNodes (CDC* pDC)
{
o (in i=0; i < m_nodes.Ge Size(); i++)
{
CNode node;
node = m_nodes.Ge A (i);
CPoin poin ;
poin = Ge Poin (node.m_dX, node.m_dY);
pDC->Ellipse(poin .x-2, poin .y-2, poin .x+2, poin .y+2);
}
}
oid CNumG id::D awWa e Edge (CDC*pDC)
{
CPoin pn F om;
CPoin pn To;
CNode node;
o (in i=0; i < m_nodes.Ge Size(); i++)
{
node = m_nodes.Ge A (i);
i (node.m_dH == 0.0)
{
pn F om = Ge Poin (node.m_dX, node.m_dY);
b eak;
}
}
o (i=0; i < m_nodes.Ge Size(); i++)
{
node = m_nodes.Ge A (i);
i (node.m_dH == 0.0)
{
pn To = Ge Poin (node.m_dX, node.m_dY);
pDC->Mo eTo (pn F om);
pDC->LineTo (pn To);
pn F om = pn To;
}
}
}
41
CPoin CNumG id::Ge Veco HeadPoin (CNodenode)
{
CPoin pn Re u n;
CPoin pn Node;
double dal a;
double dBe a = node.m_dD;
double dU;
double dV;
double dPi = 3.1415926535;
i (dBe a >= 0.0 || dBe a < 90.0)
{
dal a = dPi * (90.0 - dBe a) / 180.0;
dU = node.m_dV * cos(dAl a);
dV = node.m_d * sin(dAl a);
}
i (dBe a >= 90.0 || dBe a < 180.0)
{
dAl a = dPi * (dBe a - 90.0) / 180.0;
dU = node.m_d * cos(dAl a);
dV = node.m_d * sin(dAl a);
}
i (dBe a >= 180.0 || dBe a < 270.0)
{
dAl a = dPi * (270.0 - dBe a) / 180.0;
dU = -node.m_dV * cos(dAl a);
dV = -node.m_dV * sin(dAl a);
}
i (dBe a >= 270.0 || dBe a < 360.0)
{
dAl a = dPi * (dBe a - 270.0) / 180.0;
dU = -node.m_dV * cos(dAl a);
dV = node.m_dV * sin(dAl a);
}
pn Node = Ge Poin (node.m_dX, node.m_dY);
pn Re u n.x = pn Node.x + (in ) (dU * m_dAspec V);
pn Re u n.y = pn Node.y - (in ) (dV * m_dAspec V);
e u n pn Re u n;
}
oid CNumG id::D awA ows (CDC* pDC, CPoin pn Cen e, CPoin pn Head)
{
in nU = pn Head.x - pn Cen e.x; // s eamwise componen
in nV = pn Head.y - pn Cen e.y; // ans e se componen
i (nU == 0.0 & nV == 0.0) e u n;
double dL = 0.3 * sq (nU*nU + nV*nV);
in nX = (in ) (dL*cos(a an2( abs(nV), abs(nU) ) +
20.0*3.1415/180.0));
in ny = (in ) (dL*sin(a an2( abs(nV), abs(nU) ) +
20.0*3.1415/180.0));
in iX = (in ) (dL*cos(a an2( abs(nV), abs(nU) ) -
20.0*3.1415/180.0));