solve.py 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from .preprocess import setDefaultCoefficients
  2. from .adaptation import hdpg1d
  3. from .postprocess import utils
  4. def menu():
  5. menu = {}
  6. menu['1.'] = "Solve with HDG."
  7. menu['2.'] = "Solve with HDPG."
  8. menu['3.'] = "Exit."
  9. for key, value in sorted(menu.items()):
  10. print(key, value)
  11. def hdgSolve():
  12. hdgCoeff = setDefaultCoefficients()
  13. print("Solving...")
  14. hdgSolution = hdpg1d(hdgCoeff)
  15. # solve the problem adaptively and plot convergence history
  16. hdgSolution.adaptive()
  17. print("Problem solved. Please check the convergence plot.")
  18. utils(hdgSolution).convHistory()
  19. def runInteractive():
  20. while True:
  21. menu()
  22. selection = input("Please Select: ")
  23. if selection == '1':
  24. hdgSolve()
  25. break
  26. elif selection == '2':
  27. print("In development...")
  28. elif selection == '3':
  29. print("Bye.")
  30. break
  31. else:
  32. print("Unknown Option Selected!\n")
  33. continue