Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix boolean argument in Nair Lauritzen divergent #28

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions case_studies/transport/nair_lauritzen_divergent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
nair_lauritzen_divergent_defaults = {
'initial_conditions': 'slotted_cylinder', # one of 'slotted_cylinder',
# 'cosine_bells' or 'gaussian'
'background_flow': True, # whether background flow is applied
'ncells_per_edge': 16, # num points per icosahedron edge (ref level 4)
'dt': 900.0, # 15 minutes
'tmax': 12.*24.*60.*60., # 12 days
'dumpfreq': 288, # once every 3 days with default values
'no_background_flow': False, # option to remove the background flow
'ncells_per_edge': 16, # num points per icosahedron edge (ref level 4)
'dt': 900.0, # 15 minutes
'tmax': 12.*24.*60.*60., # 12 days
'dumpfreq': 288, # once every 3 days with default values
'dirname': 'nair_lauritzen_divergent'
}


def nair_lauritzen_divergent(
initial_conditions=nair_lauritzen_divergent_defaults['initial_conditions'],
background_flow=nair_lauritzen_divergent_defaults['background_flow'],
no_background_flow=nair_lauritzen_divergent_defaults['no_background_flow'],
ncells_per_edge=nair_lauritzen_divergent_defaults['ncells_per_edge'],
dt=nair_lauritzen_divergent_defaults['dt'],
tmax=nair_lauritzen_divergent_defaults['tmax'],
Expand All @@ -61,6 +61,8 @@ def nair_lauritzen_divergent(
# Our settings for this set up
# ------------------------------------------------------------------------ #

print(no_background_flow)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, I have a habit of doing this!


degree = 1

# ------------------------------------------------------------------------ #
Expand Down Expand Up @@ -101,7 +103,7 @@ def nair_lauritzen_divergent(
lamda, theta, _ = lonlatr_from_xyz(xyz[0], xyz[1], xyz[2])

# Set up the divergent, time-varying, velocity field
if background_flow:
if not no_background_flow:
def u_t(t):
k = 5.*radius/tau
u_background = 2*pi*radius/tau
Expand Down Expand Up @@ -208,10 +210,11 @@ def u_t(t):
default=nair_lauritzen_divergent_defaults['initial_conditions']
)
parser.add_argument(
'--background_flow',
help="Whether the transporting velocity includes a background flow",
'--no_background_flow',
help="Whether to remove the background flow of the transporting velocity. "
+ "This defaults to False, which means there is a background flow.",
type=bool,
default=nair_lauritzen_divergent_defaults['background_flow']
default=nair_lauritzen_divergent_defaults['no_background_flow']
)
parser.add_argument(
'--ncells_per_edge',
Expand Down
Loading