You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
82 overcome dependency snapwave ig source term on previous timestep (#83)
* - First version without previous timestep dependency
- Note ; had to change definition of gamma, so not anymore mean gamma over current and upwind point > changes gamma and thus source term and IG growth, have to check still whether that is a problem or not
- todo: clean up
* - Solved so we can use the mean gamma again, issue was het H(k) is set to 0 everytime snapwave_solver is called, so now determined again
- Code can be cleaned up by doing a H inout definition probably
* - Bit cleanup, and move back 'Make sure DoverE is filled based on previous ee' part
- and result now only little bit different anymore, because of removal of previous loop now?
* - Hprev should be based on full E, not ee(itheta), now result is same as in paper
- Thereby not using H_inc_old and H_ig_old anymore from wave heights of last time step (but implicitly we still do)
* - Clean up by changing H to inout, so that we don't have to determine it again at the start of solve_energy_balance2Dstat
- Remove Sxx outside of subroutine 'solve_energy_balance2Dstat', since that is not needed anymore
* - Change water depth for warning limited depth in Herbers calculation to determine Hig,0 from 10 m to 5 m
* - Put the whole determination of the IG source term in a new subroutine 'determine_infragravity_source_sink_term' for clarity
- Also makes it easier to experiment puting the source term determination in the ' do iter=1,niter
'-loop
* - Some style cleanup
* - New implementation where IG source/sink term is first determined prior to iteration loop, to fill 'srcsh', based on effectively incident energy from previous SnapWave timestep
- Then depending on new option, 'snapwave_iterative_srcsh=1, is new default', the subroutine is called again to determine srcsh now based on just updated incident wave energy.
- If nr_sweeps = 4, this is slower because subroutine 'determine_infragravity_source_sink_term' is called multiple times
- But, Hm0 IG converges now immediately, instead of after a few timesteps!
- However, to speed up you can with snapwave_iterative_srcsh = 0 still keep old behaviour of only using the initial filling of 'srcsh'. Depends on application whether slower convergence IG wave height is problem
- TODO: check whether slower performance can still be counteracted some way
* - First significant speedup by putting ' do itheta = 1, ntheta' loop inside the subroutine
* save intermediate attempts:
- ! Update H(k), used in subroutine to calculate relative waterdepth 'gam' > TL: this creates a variability over sweeps/iterations/timesteps since 'gam' changes every time > seems more stable not to do this
- OMP loop in solver did not seem to provide speedup
- OMP loop in subroutine 'determine_infragravity_source_sink_term' made things slower
- Even without these 3 attempts, performance loss of more times calling subroutine 'determine_infragravity_source_sink_term' in iteration loop seems negligible for small model
* - In iteration loop, save a little bit of computation time by updating srcsh only for the first sweep (but still every iteration)
* - Rename all references to 'srcsh' to more descriptive 'srcig'
* - Do actually limit the depth to 5m, not only warning
* Added text
* Combine loops
* - depth needed to be inout to be able to change it
* Revert "Combine loops"
This reverts commit 04a8e61.
* - Determinen above, so that we can correctly allocatie nmindbnd
* - Update H(k) in first sweep of first iteration, so that in first timestep we get already a good estimate of srcig and thereby Hig, and not just only conservative shoaling from the boundary
- Only done once to prevent changing H(k) > and thereby gam and alphaig > every time, to prevent oscillations
* - Fix quadtree hmax output
* - set/check random seed for random_number
- Todo: check whether this is best implementation and results in actual random seed if wmrandom = 1
* - SnapWave doesn't output directional spreading, and in sfincs_snapwave the mean wave direction is actually added, which gives wrong values in hisfile. Turn off for now
* - After Maarten's suggestion take out determinatioon of depthprev and beta_local from every time determine_infragravity_source_sink_term is called
- Did not take out beta_local completely, because it depends on the grid direction, that is updated in boundary_points for every timestep.
- So now depthprev and beta_local only determined once, and not every iteration
- Note - could be done still using w360 etc, but more work
! Wave periods from SnapWave, used in e.g. wavemakers - TL: moved behind call update_boundary_conditions & compute_wave_field so values at first timestep are not 0
call read_int_input(500,'snapwave_iterative_srcig',iterative_srcig,1) ! Option whether to calculate IG source/sink term in iterative lower (better, but potentially slower, 1=default), or effectively based on previous timestep (faster, potential mismatch, =0)
402
403
!
403
404
! IG boundary conditions options:
404
405
call read_int_input(500,'snapwave_use_herbers',herbers_opt,1) ! Choice whether you want IG Hm0&Tp be calculated by herbers (=1, default), or want to specify user defined values (0> then snapwave_eeinc2ig & snapwave_Tinc2ig are used)
real*4:: baldock_ratio_ig ! option controlling from what depth wave breaking should take place for IG waves: (Hk>baldock_ratio*Hmx(k)), default baldock_ratio_ig=0.2
163
160
integer:: igwaves_opt ! option of IG waves on (1) or off (0)
164
161
integer:: ig_opt ! option of IG wave settings (1 = default = conservative shoaling based dSxx and Baldock breaking)
162
+
integer:: iterative_srcig ! option whether IG source/sink term should be calculated in the iterative loop again (iterative_srcig = 1, is a bit slower),
163
+
! ... or just a priori based on effectively incident wave energy from previous timestep only
165
164
real*4:: snapwave_alpha_ig,gamma_ig ! coefficients in Baldock wave breaking dissipation model for IG waves
166
165
real*4:: shinc2ig ! Ratio of how much of the calculated IG wave source term, is subtracted from the incident wave energy (0-1, 0=default)
0 commit comments