Skip to content

Commit

Permalink
Merge branch 'develop' of https://gitlab.orr.noaa.gov/gnome/pygnome i…
Browse files Browse the repository at this point in the history
…nto develop
  • Loading branch information
ChrisBarker-NOAA committed Aug 2, 2024
2 parents 0c58693 + ff8aa55 commit 678d7fe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion py_gnome/gnome/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ def release_elements(self, start_time, end_time):
env = self.compile_env()
for sc in self.spills.items():
# release particles
num_released = sc.release_elements(start_time, end_time, environment=env, weathering_active = self.has_weathering)
num_released = sc.release_elements(start_time, end_time, environment=env)
# initialize data - currently only weatherers do this so cycle
# over weatherers collection - in future, maybe movers can also do
# this
Expand Down
2 changes: 1 addition & 1 deletion py_gnome/gnome/ops/default_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

default_salinity=1.1
default_water_density=1025
default_water_temperature=283.15
default_water_temperature=288.15 # 15C
minimum_wind=0.01
visc_curvfit_param = 1.5e3 # units are sec^0.5 / m
visc_f_ref = 0.84
4 changes: 2 additions & 2 deletions py_gnome/gnome/spill_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ def _get_fate_mask(self, fate):
w_mask = np.logical_and(w_mask, self['mass'] > 0.0)
return w_mask

def release_elements(self, start_time, end_time, environment=None, weathering_active=True):
def release_elements(self, start_time, end_time, environment=None):
"""
:param start_time: -- beginning of the release
:param end_time: -- end of the release.
Expand All @@ -892,7 +892,7 @@ def release_elements(self, start_time, end_time, environment=None, weathering_ac
if not spill.on:
continue

num_rel = spill.release_elements(self, start_time, end_time, environment=environment, weathering_active=weathering_active)
num_rel = spill.release_elements(self, start_time, end_time, environment=environment)
if num_rel > 0:
# update 'spill_num' ArrayType's initial_value so it
# corresponds with spill number for this set of released
Expand Down
13 changes: 9 additions & 4 deletions py_gnome/gnome/spills/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from gnome.array_types import gat
from gnome.utilities.plume import Plume, PlumeGenerator


from gnome.outputters import NetCDFOutput
from gnome.gnomeobject import GnomeId
from gnome.environment.timeseries_objects_base import (TimeseriesData,
Expand All @@ -45,7 +46,8 @@
from gnome.weatherers.spreading import FayGravityViscous
from gnome.environment import Water
from gnome.constants import gravity
from gnome.exceptions import ReferencedObjectNotSet
from gnome.ops import default_constants
#from gnome.exceptions import ReferencedObjectNotSet
from .initializers import (InitRiseVelFromDropletSizeFromDist,
InitRiseVelFromDist)

Expand Down Expand Up @@ -407,10 +409,12 @@ def initialize_LEs_post_substance(self, to_rel, sc, start_time, end_time, enviro
if sc.substance.is_weatherable:
if environment['water'] is not None:
water = environment['water']
temp_k=water.get('temperature')
else:
raise ReferencedObjectNotSet("water object not found in environment collection")
temp_k = default_constants.default_water_temperature
#raise ReferencedObjectNotSet("water object not found in environment collection")

visc = sc.substance.kvis_at_temp(temp_k=water.get('temperature'))
visc = sc.substance.kvis_at_temp(temp_k)
thickness_limit = FayGravityViscous.get_thickness_limit(visc)

sc['fay_area'][sl] = (sc['init_mass'][sl] / sc['density'][sl]) / thickness_limit
Expand Down Expand Up @@ -622,7 +626,8 @@ def initialize_LEs_post_substance(self, to_rel, sc, start_time, end_time, enviro
if environment['water'] is not None:
water = environment['water']
else:
raise ReferencedObjectNotSet("water object not found in environment collection")
water = Water(default_constants.default_water_temperature)
#raise ReferencedObjectNotSet("water object not found in environment collection")

spread = FayGravityViscous(water=water)
spread.prepare_for_model_run(sc)
Expand Down
9 changes: 4 additions & 5 deletions py_gnome/gnome/spills/spill.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def prepare_for_model_run(self, timestep):
'''
self.release.prepare_for_model_run(timestep)

def release_elements(self, sc, start_time, end_time, environment=None, weathering_active=True):
def release_elements(self, sc, start_time, end_time, environment=None):
"""
Releases and partially initializes new LEs
Note: this will have to be updated if we allow backwards runs for continuous spills
Expand All @@ -457,10 +457,9 @@ def release_elements(self, sc, start_time, end_time, environment=None, weatherin

self.substance.initialize_LEs(to_rel, sc, environment=environment)

if weathering_active:
self.release.initialize_LEs_post_substance(to_rel, sc,
start_time, end_time,
environment=environment)
self.release.initialize_LEs_post_substance(to_rel, sc,
start_time, end_time,
environment=environment)

return to_rel

Expand Down

0 comments on commit 678d7fe

Please sign in to comment.