Skip to content

Conversation

@mihai-pricope
Copy link
Contributor

@mihai-pricope mihai-pricope commented Jan 28, 2026

What was done

  • determine positions (flow cell + depth/z) for all the new bubble source/sinks
  • called addsourcesink for all new bubble screen source/sink
  • made some fake coupling to EC module (adduniformtimerelation_objects) in order to prevent crashes on writing

Evidence of the work done

  • [x ] Video/figures
image image (1)
  • [] Clear from the issue description
  • Not applicable

Tests

  • Tests updated
    <add testcase numbers if applicable, Issue number>
  • Not applicable

Documentation

  • Documentation updated
    <add description of changes if applicable, Issue number>
  • Not applicable

Issue link

https://issuetracker.deltares.nl/browse/UNST-9562

Copy link
Contributor

@FlorisBuwaldaDeltares FlorisBuwaldaDeltares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a great start and it's very nice it already produces output, but I think the new code could use a bit of polish

Comment on lines 1198 to 1199
tmsx = xk(tmcell%nod(1))
tmsy = yk(tmcell%nod(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tmcell%nod(1) is the x coordinate of the first vertex of the cell polygon, basically you're placing your source-sink on the cell corner instead of its center. I would suggest xzw and yzw instead:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i was searching for these, thanks.

do i = kstart, kstart + kmx - 1
if (zws(i) >= tmsz) then
write(srcid, '(A,I0)') trim(id), bubble_source_count + 1
call addsorsin(srcid, [tmsx], [tmsy], [zws(i)], [zws(i)], 0.0_dp, ierr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is super ugly, as you're trying to get the tmsk and tmsy of the netcell just so that addsorsin can call pinpok to re-find the cell number you already know. I'd suggest a new routine called addsorsin_by_cell_number maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While computationally I agree this is "ugly" (aka inefficient), doing what you suggest will create far more code. I would do this later I guess when we do a bigger test if the impact of this part of code is noticeable. The impact of this is probably LogN or so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not worried about the impact, it will be small. I just think it is very ugly so i'd like it improved. I discussed a bit and for me it is also ok to fix it later after the POC is "complete", but at some point i'd want it to be fixed. The addsorsin could use some refactoring in any case

character(len=255), dimension(:), allocatable :: fnamwbnd !< polyline filenames associated with wave-energy boundary

integer :: numsrc !< nr of point sources/sinks
type BubblescreenData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the BubblescreenData object to contain all relevant information, like a list of source sink objects, maybe the original bubblescreen polyline that was read? the bubblescreen name/id? are you planning to extend this type later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added total number of source/sinks and the id. The rest let's see after we do the algo and eventually after figuring out how to integrate the ecModule

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also change the type name to t_BubblescreenData? It is convention to use the 't_' prefix for derived types (similar to using the 'm_' prefix for modules)

Copy link
Contributor

@thomas-pijls thomas-pijls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I saw quite some style errors, could you fix them?

character(len=:), allocatable :: location_file !< Bubblescreen location file
character(len=:), allocatable :: discharge_input !< Bubblescreen discharge input file

integer, allocatable :: crossed_cells(:) !> Indices of crossed cells in network_data::netcells
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For variable docstrings we use !< instead of !>

character(len=255), dimension(:), allocatable :: fnamwbnd !< polyline filenames associated with wave-energy boundary

integer :: numsrc !< nr of point sources/sinks
type BubblescreenData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also change the type name to t_BubblescreenData? It is convention to use the 't_' prefix for derived types (similar to using the 'm_' prefix for modules)

integer :: num_source_sinks !< nr of point sources/sinks in bubble screen
end type BubblescreenData
! TODO: add support for multiple bubble screens
type (BubblescreenData), allocatable :: bubblescreens(:) !< bubble screen data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put the dimension specification before the ::? i.e. ..., dimension(:) :: bubblesceens

This is specified in the coding guidelines (sec 4.12)


call find_cells_crossed_by_polyline(xpl_tmp, ypl_tmp, crossed_cells, error)

if (.NOT. ALLOCATED(error)) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this lowercase?

bubblescreen%id = id
bubblescreen%start_index = numsrc + 1

do cidx = 1, SIZE(crossed_cells)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowercase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants