Skip to content

Commit

Permalink
Changing 'mode' to 'use_3D' in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvansebille committed May 2, 2024
1 parent cffe3ac commit a338cf3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/examples/default_settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "3D",
"use_3D": true,
"allow_time_extrapolation": false,
"verbose_delete": false,
"mixing_f": false,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/example_PlasticParcels_Italy_Lorenz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
" }\n",
"\n",
"# Overwrite some settings\n",
"settings['mode'] = '2D'\n",
"settings['use_3D'] = False\n",
"settings['use_biofouling'] = False\n",
"settings['use_stokes'] = True\n",
"settings['use_wind'] = True\n"
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/local_settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"mode": "3D",
"use_3D": true,
"allow_time_extrapolation": false,
"verbose_delete": false,
"mixing_f": false,
"biofouling_f": false,
"stokes_f": false,
"wind_f": false,
"use_mixing": false,
"use_biofouling": false,
"use_stokes": false,
"use_wind": false,
"ocean": {
"modelname": "NEMO0083",
"directory": "data/input_data/MOi/",
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/lorenz_settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "3D",
"use_3D": true,
"allow_time_extrapolation": false,
"verbose_delete": false,
"use_mixing": false,
Expand Down
12 changes: 6 additions & 6 deletions plasticparcels/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_hydrodynamic_fieldset(settings):
dimensions = settings['ocean']['dimensions']
indices = settings['ocean']['indices']

if settings['mode'] == '2D':
if not settings['use_3D']:
indices['depth'] = range(0, 2)

# Load the fieldset
Expand All @@ -63,7 +63,7 @@ def create_hydrodynamic_fieldset(settings):
fieldset.add_constant('use_stokes', settings['use_stokes'])
fieldset.add_constant('use_wind', settings['use_wind'])
fieldset.add_constant('G', 9.81) # Gravitational constant [m s-1]
fieldset.add_constant('mode', settings['mode'])
fieldset.add_constant('use_3D', settings['use_3D'])

# Add in bathymetry
fieldset.add_constant('z_start', 0.5)
Expand Down Expand Up @@ -303,14 +303,14 @@ def create_kernel(fieldset):

kernels.append(PolyTEOS10_bsq) # To set the seawater_density variable # TODO do we need this always? Or only for some kernels?

if fieldset.mode: # 3D mode == on
if fieldset.use_3D:
kernels.append(AdvectionRK4_3D)
else:
kernels.append(AdvectionRK4)

if not fieldset.use_biofouling and fieldset.mode:
if not fieldset.use_biofouling and fieldset.use_3D:
kernels.append(SettlingVelocity)
elif fieldset.use_biofouling and fieldset.mode: # Must be in 3D to use biofouling mode
elif fieldset.use_biofouling and fieldset.use_3D: # Must be in 3D to use biofouling mode
kernels.append(Biofouling)

if fieldset.use_stokes:
Expand All @@ -325,7 +325,7 @@ def create_kernel(fieldset):
if fieldset.use_stokes or fieldset.use_wind:
kernels.append(unbeaching)

if fieldset.mode:
if fieldset.use_3D:
kernels.append(checkThroughBathymetry)
kernels.append(checkErrorThroughSurface)

Expand Down
4 changes: 2 additions & 2 deletions plasticparcels/create_settings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"source": [
"settings = {\n",
" # Model settings\n",
" 'mode': '3D', # Options [3D, 2D]\n",
" 'use_3D': True,\n",
" 'allow_time_extrapolation': False, # Allow extrapolation of time for fieldset\n",
" 'verbose_delete': False, # Print extra information when executing delete operations\n",
"\n",
Expand Down Expand Up @@ -173,7 +173,7 @@
"source": [
"settings = {\n",
" # Model settings\n",
" 'mode': '3D', # Options [3D, 2D]\n",
" 'use_3D': True,\n",
" 'allow_time_extrapolation': False, # Allow extrapolation of time for fieldset\n",
" 'verbose_delete': False, # Print extra information when executing delete operations\n",
"\n",
Expand Down

0 comments on commit a338cf3

Please sign in to comment.