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

Cubed sphere tracer advection script #3266

Merged
merged 38 commits into from
Sep 19, 2023

Conversation

glwagner
Copy link
Member

@glwagner glwagner commented Sep 14, 2023

Some TODOs:

  • Make set! work for Face, Face, Center fields (eg streamfunctions)
  • Make broadcasting work for cubed sphere fields
  • Use plotting utilities from Imaginocean

With the above and fixing the tests then I think we are ready to merge.

Supersedes #3221; closes #3204

@glwagner
Copy link
Member Author

multi_region_tracer_advection_latlon.mp4

@glwagner
Copy link
Member Author

However, it doesn't work when the tracer passes over a corner:

multi_region_tracer_advection_latlon.mp4

@glwagner
Copy link
Member Author

(Note that the two videos above are with tracer_advection = WENO().)

@glwagner
Copy link
Member Author

It might've just been a CFL issue (here at coarser resolution, with a time-step estimated based on the minimum grid spacing):

multi_region_tracer_advection_latlon.mp4

@glwagner
Copy link
Member Author

Now with WENO(order=9)

multi_region_tracer_advection_latlon.mp4

@navidcy
Copy link
Collaborator

navidcy commented Sep 15, 2023

Let's leave the set! for another PR because there is still work to be done, in particular to fill halos for Face, Face fields...

@navidcy
Copy link
Collaborator

navidcy commented Sep 18, 2023

There seems to be some artifacty things introduced by the corners. See the below which starts with a tracer:

θ₀ = 1
Δφ = 20
θᵢ(λ, φ, z) = - θ₀ * cosd(4λ) * exp(-φ^2 / 2Δφ^2)

advected by streamfunction that corresponds to solid-body rotation about axis that passes via (lat, lon) = (0, 0).

φʳ = 0        # Latitude pierced by the axis of rotation
α  = 90 - φʳ  # Angle between axis of rotation and north pole (degrees)
ψᵣ(λ, φ, z) = - U * R * (sind(φ) * cosd(α) - cosd(λ) * cosd(φ) * sind(α))
cubed_sphere_tracer_advection.mp4

@simone-silvestri
Copy link
Collaborator

I think we need stretched WENO with 2D coefficients. Now WENO(grid) assumes 1D coefficients which is okay for latitude-longitude and rectilinear but not for cubed sphere.

It will be straightforward to update WENO once everything is in place

@navidcy
Copy link
Collaborator

navidcy commented Sep 18, 2023

I think we need stretched WENO with 2D coefficients. Now WENO(grid) assumes 1D coefficients which is okay for latitude-longitude and rectilinear but not for cubed sphere.

It will be straightforward to update WENO once everything is in place

Good point. So if I fall back to the default scheme for tracers then it should be OK?

@simone-silvestri
Copy link
Collaborator

A centered second order advection should be okay but you have to pair it with some diffusion otherwise oscillatory errors will break your solution

@navidcy
Copy link
Collaborator

navidcy commented Sep 18, 2023

A centered second order advection should be okay but you have to pair it with some diffusion otherwise oscillatory errors will break your solution

True! At least we know what's going on. Thanks @simone-silvestri!

Here it is without any diffusion:

cubed_sphere_tracer_advection.mp4

And here it is with ScalarDiffusivity(; κ=1e-2):

cubed_sphere_tracer_advection.mp4

You can still "see" the corner.

@navidcy
Copy link
Collaborator

navidcy commented Sep 19, 2023

Some remarks:

  • Make set! work for Face, Face, Center fields (eg streamfunctions)

It seems like there is a topology problem. For Face, Face, Center fields it seems that there are two corner points which do not correspond to any point in the interior. So even if set! fills everything in the interior (e.g., for 1:Nx) then fill_halo_regions! won't be able to assign values on those two special corner points. Is the FullyConnected topology a bit problematic when panels are rotated to one another? Or are we not thinking something straight? We were discussing this over zoom w @glwagner, @simone-silvestri, and @siddharthabishnu and decided that it belongs to a new PR.

  • Make broadcasting work for cubed sphere fields

We also decided to leave making broadcasting work for MultiRegionFields part of another PR.

So, with this and that, we should merge this PR at its current state.

@navidcy navidcy merged commit 6a8a7cf into main Sep 19, 2023
47 checks passed
@navidcy navidcy deleted the ncc-glw/cubed-sphere-tracer-advection branch September 19, 2023 15:45
navidcy added a commit that referenced this pull request Sep 20, 2023
* Add fill halo regions for zero and constant field

* Cosmetic stuff

* Generalize HydrostaticFreeSurfaceVelocityFields for prescribed velocities on the cubed sphere

* Add a tracer advection script

* Disambiguate replace velocities and generate TODO to move functionality to prescribed hydrostatic velocity fields

* Generate TODO to refactor multi region to appear before Models

* Much clean up

* Implement getindex and first for niceities

* Cosmetic improvement

* rename replace_horizontal_velocity_halos! -> replace_horizontal_vector_halos!

* fix docstring

* code alignment

* Get rid of practically useless PrescribedField test

* velocity -> vector

* add minimum_spacing method for MultiRegionGrid

* don't import deprecated PrescribedField

* replace_horizontal_velocity_halos -> replace_horizontal_vector_halos

* add convenience radius(::ConformalCubedSphereGrid)

* cleanup, correct angle units, another IC

* code alignment

* replace_horizontal_velocity_halos -> replace_horizontal_vector_halos

* use heatlatlon! from Imaginocean.jl

* Imaginocean instructions

* use Imaginocean

* declutter show for MultiRegionField

* remove extra line

* some updates

* Notes on braodcasting for cu bed pshere

* cleaner minimum_spacing for `MultiRegionGrid`

Co-authored-by: Gregory L. Wagner <[email protected]>

* even cleaner minimum_spacing for

* remove extra empty line

* add convenience functions for multiregion fields

* code alignment

* use multiregion field conveniences

* add number_of_regions(::MultiRegionGrid) convenience

* remove placeholder broadcasting code for multiregion

* fix signature in docstring

---------

Co-authored-by: Navid C. Constantinou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Advection of tracer with prescribed or constant velocities over a ConformalCubedSphereGrid
3 participants