Skip to content

Commit

Permalink
Catch wrong user input
Browse files Browse the repository at this point in the history
* python3 heat.py (without argument)
* python3 heat.py -d -n (with both arguments, while only one is allowed)
  • Loading branch information
BenjaminRodenberg committed Mar 26, 2021
1 parent 697fe65 commit 9ccd365
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions partitioned-heat-conduction/fenics/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ def determine_gradient(V_g, u, flux):


parser = argparse.ArgumentParser(
description='Solving heat equation for simple or complex interface case')
parser.add_argument("-d", "--dirichlet", help="create a dirichlet problem",
dest='dirichlet', action='store_true')
parser.add_argument("-n", "--neumann", help="create a neumann problem",
dest='neumann', action='store_true')
description="Solving heat equation for simple or complex interface case")
command_group = parser.add_mutually_exclusive_group(required=True)
command_group.add_argument("-d", "--dirichlet",
help="create a dirichlet problem", dest="dirichlet",
action="store_true")
command_group.add_argument("-n", "--neumann", help="create a neumann problem",
dest="neumann", action="store_true")

args = parser.parse_args()

Expand Down

0 comments on commit 9ccd365

Please sign in to comment.