From eb00b0e62560146978b51462aebef1b67947cb42 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Thu, 5 Sep 2024 15:13:55 +0100 Subject: [PATCH 1/3] set boolean flag default to False --- case_studies/transport/nair_lauritzen_divergent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/case_studies/transport/nair_lauritzen_divergent.py b/case_studies/transport/nair_lauritzen_divergent.py index 30a1296..a1a38ea 100644 --- a/case_studies/transport/nair_lauritzen_divergent.py +++ b/case_studies/transport/nair_lauritzen_divergent.py @@ -27,7 +27,7 @@ nair_lauritzen_divergent_defaults = { 'initial_conditions': 'slotted_cylinder', # one of 'slotted_cylinder', # 'cosine_bells' or 'gaussian' - 'background_flow': True, # whether background flow is applied + 'background_flow': False, # 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 From 4d0e41aaea5fe27ac55633119d31e72f497c6398 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Thu, 5 Sep 2024 16:19:57 +0100 Subject: [PATCH 2/3] changed background_flow option to no_background_flow --- .../transport/nair_lauritzen_divergent.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/case_studies/transport/nair_lauritzen_divergent.py b/case_studies/transport/nair_lauritzen_divergent.py index a1a38ea..a4fbb84 100644 --- a/case_studies/transport/nair_lauritzen_divergent.py +++ b/case_studies/transport/nair_lauritzen_divergent.py @@ -27,18 +27,18 @@ nair_lauritzen_divergent_defaults = { 'initial_conditions': 'slotted_cylinder', # one of 'slotted_cylinder', # 'cosine_bells' or 'gaussian' - 'background_flow': False, # 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'], @@ -61,6 +61,8 @@ def nair_lauritzen_divergent( # Our settings for this set up # ------------------------------------------------------------------------ # + print(no_background_flow) + degree = 1 # ------------------------------------------------------------------------ # @@ -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 @@ -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', From 86c9427436d61142c44baeac91e14843f098af2e Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Fri, 6 Sep 2024 12:09:27 +0100 Subject: [PATCH 3/3] change background_flow to no_background_flow in test_transport --- case_studies/transport/nair_lauritzen_divergent.py | 2 -- case_studies/transport/test_transport.py | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/case_studies/transport/nair_lauritzen_divergent.py b/case_studies/transport/nair_lauritzen_divergent.py index a4fbb84..603034d 100644 --- a/case_studies/transport/nair_lauritzen_divergent.py +++ b/case_studies/transport/nair_lauritzen_divergent.py @@ -61,8 +61,6 @@ def nair_lauritzen_divergent( # Our settings for this set up # ------------------------------------------------------------------------ # - print(no_background_flow) - degree = 1 # ------------------------------------------------------------------------ # diff --git a/case_studies/transport/test_transport.py b/case_studies/transport/test_transport.py index c2ab069..231f8e3 100644 --- a/case_studies/transport/test_transport.py +++ b/case_studies/transport/test_transport.py @@ -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, @@ -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, @@ -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,