Allow variable sea level #305
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP - don't merge yet. I still plan to write a test that illustrates this, and we should discuss some design choices. Also I just realized there are several other routines that use
sea_levelwhere something different should be done when this is variable.This adds a new subroutine
src/2d/shallow/set_set_level.f90that takes a grid patch and returns an array of the same shape that has the value of sea level to use in each cell, which is only used when filling a cell with fluid up to this level. This is done in setting the initial conditions (which I just realized needs to be modified) and also when a new level of AMR is introduced to initialize cells that cover a dry grid cell on the coarser level if the shoreline cuts through that dry cell. After refinement, some of the finer cells may be wet and are filled to the level determined bysea_level. With this modification, this value can vary spatially (and with time).The use case this was developed for was to handle a coastal region where
dtopofile,When the ground subsides, the water in the bay subsides too, so if refinement happens later the value of
hshould be chosen to bring the water up to a sea level that is lower than the original sea level by an amount given by interpolating thedtopofile to this location. This is what theset_sea_levelfunction provided here computes. (Note this assumes no water has flowed in the intervening time near the coast, which is not generally true, but is a better assumption than filling these cells to the original sea level, which might immediately flood all subsided regions with water that had no opportunity to get there.)For other applications, the user could provide their own version of
set_sea_level. One possible use case is initializing a river, where the initial water level varies with the elevation of the river, or to fill onshore lakes near shore that have different water levels than the ocean's sea level.Question:
Is
sea_levelthe right term for these parameters, especially given the other possible use cases?Would
initial_surface_levelor something be clearer?Still needs fixing:
qinit.f90to set properly at initial timeqinit_module.f90also usessea_levelin initializing from a qinit filefriction_module.f90usesea_levelbut only in a test case, so it's ok?