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
Show file tree
Hide file tree
Changes from all 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
21 changes: 11 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 Down Expand Up @@ -101,7 +101,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 +208,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
4 changes: 1 addition & 3 deletions case_studies/transport/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def test_four_part_sbr():
def test_nair_lauritzen_divergent_cylinder():
nair_lauritzen_divergent(
initial_conditions='slotted_cylinder',
background_flow=True,
ncells_per_edge=3,
dt=900.0,
tmax=1800.0,
Expand All @@ -31,7 +30,7 @@ def test_nair_lauritzen_divergent_cylinder():
def test_nair_lauritzen_divergent_cosine():
nair_lauritzen_divergent(
initial_conditions='cosine_bells',
background_flow=False,
no_background_flow=True,
ncells_per_edge=3,
dt=900.0,
tmax=1800.0,
Expand All @@ -43,7 +42,6 @@ def test_nair_lauritzen_divergent_cosine():
def test_nair_lauritzen_divergent_gaussian():
nair_lauritzen_divergent(
initial_conditions='gaussian',
background_flow=True,
ncells_per_edge=3,
dt=900.0,
tmax=1800.0,
Expand Down
Loading