有个错误可以帮忙解决吗?谢谢

C:\Users\shenp\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/shenp/PycharmProjects/pythonProject/sandwater.py
[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, win, python 3.7.4
[W 01/03/22 09:09:53.087 5744] [__init__.py:adaptive_arch_select@953] Arch=[<Arch.cuda: 5>] is not supported, falling back to CPU
[Taichi] Starting on arch=x64
Traceback (most recent call last):
  File "C:/Users/shenp/PycharmProjects/pythonProject/sandwater.py", line 321, in <module>
    substep()
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\kernel_impl.py", line 669, in wrapped
    return primal(*args, **kwargs)
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\kernel_impl.py", line 596, in __call__
    key = self.ensure_compiled(*args)
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\kernel_impl.py", line 587, in ensure_compiled
    self.materialize(key=key, args=args, arg_features=arg_features)
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\kernel_impl.py", line 452, in materialize
    kernel_name, self.is_grad)
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\kernel_impl.py", line 446, in taichi_ast_generator
    compiled()
  File "C:/Users/shenp/PycharmProjects/pythonProject/sandwater.py", line 129, in substep
    for p in range(n_s_particles):
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\expr.py", line 33, in __init__
    self.ptr = impl.make_constant_expr(arg).ptr
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\util.py", line 196, in wrapped
    return func(*args, **kwargs)
  File "C:\Users\shenp\PycharmProjects\pythonProject\venv\lib\site-packages\taichi\lang\impl.py", line 413, in make_constant_expr
    raise ValueError(f'Invalid constant scalar expression: {type(val)}')
ValueError: Invalid constant scalar expression: <class 'taichi.lang.field.ScalarField'>

方便附上源码吗 :grinning:

好。我重新整理一下,谢谢你啦

我看到你解决的sand water的程序,我可以运行出来,但是另一个运行不出来

另一个是指? 可以麻烦贴一下代码吗