Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ta440 committed Jan 22, 2024
1 parent d166a22 commit aa3d7c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 33 deletions.
2 changes: 1 addition & 1 deletion integration-tests/transport/test_limiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ def test_limiters(tmpdir, space):

# Check for no new undershoots
assert np.min(final_field.dat.data) >= np.min(true_field.dat.data) - tol, \
'Application of limiter has not prevented undershoots'
'Application of limiter has not prevented undershoots'
53 changes: 21 additions & 32 deletions integration-tests/transport/test_mixed_fs_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def setup_limiters(dirname, space_A, space_B):
degree = 0 if space_A in ['DG0', 'Vtheta_degree_0', 'Hdiv'] else 1

domain = Domain(mesh, dt, family="CG", degree=degree)

# Transporting velocity space
V = domain.spaces('HDiv')

# Tracer A spaces
if space_A == 'DG0':
VA = domain.spaces('DG')
Expand All @@ -61,7 +61,7 @@ def setup_limiters(dirname, space_A, space_B):
space_A_string = 'theta'
else:
raise NotImplementedError

# Tracer B spaces
if space_B == 'DG':
space_B_string = 'DG'
Expand All @@ -75,7 +75,7 @@ def setup_limiters(dirname, space_A, space_B):
raise NotImplementedError
elif space_B == 'Vtheta':
space_B_string = 'theta'
if degree == 0:
if degree == 0:
VB = domain.spaces('theta')
VCG1_B = FunctionSpace(mesh, 'CG', 1)
VDG1_B = domain.spaces('DG1_equispaced')
Expand All @@ -85,23 +85,22 @@ def setup_limiters(dirname, space_A, space_B):
raise NotImplementedError
else:
raise NotImplementedError
Vpsi = domain.spaces('H1')

Vpsi = domain.spaces('H1')

tracerA = ActiveTracer(name='tracerA', space=space_A_string,
variable_type=TracerVariableType.mixing_ratio,
transport_eqn=TransportEquationType.advective)
variable_type=TracerVariableType.mixing_ratio,
transport_eqn=TransportEquationType.advective)

tracerB = ActiveTracer(name='tracerB', space=space_B_string,
variable_type=TracerVariableType.mixing_ratio,
transport_eqn=TransportEquationType.advective)


variable_type=TracerVariableType.mixing_ratio,
transport_eqn=TransportEquationType.advective)

tracers = [tracerA, tracerB]

eqn = CoupledTransportEquation(domain, active_tracers=tracers, Vu=V)
output = OutputParameters(dirname=dirname+'/limiters', dumpfreq=1,
dumplist=['u', 'tracerA', 'tracerB', 'true_tracerA', 'true_tracerB'])
dumplist=['u', 'tracerA', 'tracerB', 'true_tracerA', 'true_tracerB'])

Check failure on line 104 in integration-tests/transport/test_mixed_fs_options.py

View workflow job for this annotation

GitHub Actions / Run linter

W293

integration-tests/transport/test_mixed_fs_options.py:104:1: W293 blank line contains whitespace
io = IO(domain, output)

Expand All @@ -113,36 +112,30 @@ def setup_limiters(dirname, space_A, space_B):
sublimiters = {}

# Options and limiters for tracer_A

if space_A in ['DG0', 'Vtheta_degree_0']:
suboptions.update({'tracerA': RecoveryOptions(embedding_space=VDG1_A,
recovered_space=VCG1_A,
project_low_method='recover',
boundary_method=BoundaryMethod.taylor)})
recovered_space=VCG1_A,
project_low_method='recover',
boundary_method=BoundaryMethod.taylor)})

sublimiters.update({'tracerA': VertexBasedLimiter(VDG1_A)})

elif space_A == 'DG1':
sublimiters.update({'tracerA': DG1Limiter(VA)})

elif space_A == 'DG1_equispaced':
sublimiters.update({'tracerA': VertexBasedLimiter(VA)})

elif space_A == 'Vtheta_degree_1':
suboptions.update({'tracerA': EmbeddedDGOptions()})
sublimiters.update({'tracerA': ThetaLimiter(VA)})
else:
raise NotImplementedError

Check failure on line 131 in integration-tests/transport/test_mixed_fs_options.py

View workflow job for this annotation

GitHub Actions / Run linter

W293

integration-tests/transport/test_mixed_fs_options.py:131:1: W293 blank line contains whitespace
# Options and limiters for tracer_B

if space_B == 'DG':
if degree == 0:
suboptions.update({'tracerB': RecoveryOptions(embedding_space=VDG1_B,
recovered_space=VCG1_B,
project_low_method='recover',
boundary_method=BoundaryMethod.taylor)})

recovered_space=VCG1_B,
project_low_method='recover',
boundary_method=BoundaryMethod.taylor)})
sublimiters.update({'tracerB': VertexBasedLimiter(VDG1_B)})
elif degree == 1:
sublimiters.update({'tracerB': DG1Limiter(VB)})
Expand Down Expand Up @@ -273,13 +266,9 @@ def setup_limiters(dirname, space_A, space_B):
return stepper, tmax, true_fieldA, true_fieldB



@pytest.mark.parametrize('space_A', ['Vtheta_degree_0', 'Vtheta_degree_1', 'DG0',
'DG1', 'DG1_equispaced'])
# It only makes sense to use the same degree for tracer B
@pytest.mark.parametrize('space_B', ['Vtheta', 'DG'])


def test_mixed_fs_options(tmpdir, space_A, space_B):

# Setup and run
Expand Down

0 comments on commit aa3d7c0

Please sign in to comment.