null

Message Boards

read and write *.flo file for PART

ZW
Zhanxian Wang, modified 2 Years ago.

read and write *.flo file for PART

Padawan Posts: 35 Join Date: 4/11/12 Recent Posts
I am a newbie to the delft3D open source community, and trying to use the particle tracking module (PART) to simulate larval transport behavior. Currently PART can only model "passive" particles. However, I am trying to model two extra larvae behaviors:

1. diurnal migration - larvae only move during daytime hours.
2. selective tidal stream transport - larvae only move during flood tide

I am thinking to modify the flow results in *.flo files created from the hydrodynamic runs to simulate these two larvae behaviors. However, I could not figure out how to read and write the *.flo file. Does anyone have experience with i/o of this file? I know "ddcouple.exe" is used for post-processing the hydro com files to create input files for PART. Where can I find the source codes for ddcouple from the repository?

Thanks,
Jonathan
Michel Jeuken, modified 2 Years ago.

RE: read and write *.flo file for PART (Answer)

Jedi Knight Posts: 156 Join Date: 1/21/13 Recent Posts
You can try to change the flows, but you could also try to have a look at part10.f where the actual movement of particles is calculated.

If you what to know how the files are build up, this is briefly described in:

http://content.oss.deltares.nl/delft3d/manuals/D-Water_Quality_Input_File_Description.pdf

11.4 Binary file that are directly read by D-Water Quality

The flo-file is a flows file:

flows • ’time’ integer*4, NOQT real*4 values
• same for next time step(s)
• · · ·

And to know how these flows are defined (from which segment to what segment), you can read the flow pointers from the poi-file:

exchange pointer • 4 integer*4 ifrom, ito, ifrom-1, ito+1
• the same for all other NOQT = NOQ1+NOQ2+NOQ3 exchanges
• · · ·

The code of ddcouple is not (yet) available to open source, but the flo-files per domain are written in D3D FLOW in this routine:

https://svn.oss.deltares.nl/repos/delft3d/trunk/src/engines_gpl/flow2d3d/packages/io/src/output/wrwaqflo.f90
ZW
Zhanxian Wang, modified 2 Years ago.

RE: read and write *.flo file for PART

Padawan Posts: 35 Join Date: 4/11/12 Recent Posts
Michel,

Thanks for your response!

If DDCOUPLE is not available as open source as you said, then how could I combine the com files from a MPI hydrodynamic run on a cluster in order to run a PART simulation? Do I have to copy them to a Windows machine and combine them there?

Jonathan
Michel Jeuken, modified 2 Years ago.

RE: read and write *.flo file for PART

Jedi Knight Posts: 156 Join Date: 1/21/13 Recent Posts
We have the ability to access files on our Linux cluster from windows machines to do the coupling, but I guess you don't have that possibility. I've attached a Linux version of ddcouple to this post
ZW
Zhanxian Wang, modified 2 Years ago.

RE: read and write *.flo file for PART

Padawan Posts: 35 Join Date: 4/11/12 Recent Posts
Michel,

To me, wrwaqflo subroutine is to write the com_*.are (area) file instead of flow file com_*.flo.

Do you think you can provide me the part of codes in DDCOUPLE to read and write flo files?

Thanks,
Jonathan
Michel Jeuken, modified 2 Years ago.

RE: read and write *.flo file for PART

Jedi Knight Posts: 156 Join Date: 1/21/13 Recent Posts
You are right, qag is used for both aggregted area and flow. The aggregated flows are only calcualted here in this routine, but are written in wrwaqfil

write ( lunflo ) itim , qag (1:noq)

currently at line 622. The statement of writing again to lunflo on line 631 is only executed at the last step to add a dummy record.

The statements from the code that you would need are:

open(flo_unit_nr,file=flo_name,form='UNFORMATTED', access='STREAM',iostat=io_error)
open(flo_new_unit_nr,file=flo_name,form='UNFORMATTED', access='STREAM',iostat=io_error)

do

read(flo_unit_nr,end=100) itime,(flow(i),i=1,noq)

new_flow(i) = something(flow(i))

write (flo_new_unit_nr) itime , (new_flow(i),i=1,noq)

end do

100 continue