Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remove_initial_w #576

Merged
merged 1 commit into from
Nov 22, 2024
Merged

Remove remove_initial_w #576

merged 1 commit into from
Nov 22, 2024

Conversation

tommbendall
Copy link
Contributor

The remove_initial_w routine no longer works, but I actually don't think it's necessary so this PR removes it.

I think we can achieve the same result by including boundary conditions in the initial projection of the velocity field.

This causes a failing test in the case studies but has not been picked up by our normal testing because the mountain_hydrostatic test is currently set to xfail, as the hydrostatic equations have not been fixed yet.


As a record, below is the error message from remove_initial_w:

Traceback (most recent call last):
  File "/home/thomas/firedrake/src/gusto/case_studies/case_studies/compressible_euler/mountain_nonhydrostatic.py", line 283, in <module>
    mountain_nonhydrostatic(**vars(args))
  File "/home/thomas/firedrake/src/gusto/case_studies/case_studies/compressible_euler/mountain_nonhydrostatic.py", line 224, in mountain_nonhydrostatic
    remove_initial_w(u0)
  File "/home/thomas/firedrake/src/gusto/gusto/initialisation/hydrostatic_initialisation.py", line 232, in remove_initial_w
    bc.apply(u)
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/thomas/firedrake/src/firedrake/firedrake/adjoint_utils/dirichletbc.py", line 32, in wrapper
    ret = apply(self, *args, **kwargs)
  File "/home/thomas/firedrake/src/firedrake/firedrake/bcs.py", line 448, in apply
    r = r.sub(idx)
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/thomas/firedrake/src/firedrake/firedrake/function.py", line 349, in sub
    return self._components[i]
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/home/thomas/firedrake/src/firedrake/firedrake/function.py", line 333, in _components
    return tuple(type(self)(self.function_space().sub(i), self.topological.sub(i))
  File "/home/thomas/firedrake/src/firedrake/firedrake/function.py", line 333, in <genexpr>
    return tuple(type(self)(self.function_space().sub(i), self.topological.sub(i))
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/thomas/firedrake/src/firedrake/firedrake/functionspaceimpl.py", line 187, in sub
    raise IndexError("Invalid component %d, not in [0, %d)" % (i, bound))
IndexError: Invalid component 1, not in [0, 1)

@tommbendall tommbendall added the bug Pull requests or issues to relating to something not working label Nov 22, 2024
Copy link
Contributor

@jshipton jshipton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, that's why it didn't cause failing tests!

@jshipton jshipton merged commit e138b5e into main Nov 22, 2024
4 checks passed
@jshipton jshipton deleted the TBendall/RemoveInitialW branch November 22, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Pull requests or issues to relating to something not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants