Git Product home page Git Product logo

Comments (17)

dionhaefner avatar dionhaefner commented on June 20, 2024

Can you show what you tried?

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

Please paste your code here instead of uploading an image.

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

The first slice here is empty since it goes backwards (from the second-last element to the start of the array):

vs.salt = update(vs.salt, at[-2:0, 6:7, -2,0], 35.0)

This has nothing to do with the update function and everything to do with how NumPy applies slices. A simpler example:

>>> import numpy as np
>>> arr = np.arange(100)
>>> arr[-2:0]
array([], dtype=int64)
>>> arr[-2:]
array([98, 99])

Notice how arr[-2:0] is empty, so your updates don't apply to anything. Use arr[-2:] instead.

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

Works fine on my end:

# this is my attempt at using the update function
vs.salt = update(vs.salt, at[-2:, 6:7, -2,0], 35.0)
print(vs.salt[-2:, 6:7, -2,0])

Prints

[[35.]
 [35.]]

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

If you increase the number of grid cells, you will have to reduce the grid spacing to get the same total extent of the grid (to not make the globe twice as large), and reduce the time step to ensure convergence.

For example, if we double the number of grid cells:

@veros_routine
def set_parameter(self, state):
    ...
    settings.nx, settings.ny, settings.nz = 60, 84, 15

You also need to halve the grid spacing:

@veros_routine
def set_grid(self, state):
    ...
    vs.dxt = update(vs.dxt, at[...], 1.0)
    vs.dyt = update(vs.dyt, at[...], 1.0)

and change the time step:

@veros_routine
def set_parameter(self, state):
    ...
    settings.dt_tracer = 86400 / 4.0

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

You can update ssh in set_forcing to whatever value you want. This function is called in every timestep.

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

I see. The following should work:

def set_parameters(state):
    ...
    settings.enable_streamfunction = False  # enable SSH

def set_initial_conditions(state):
    ...
    # add an SSH anomaly of 10m somewhere in the domain
    vs.psi = update(vs.psi, at[10:20, 10:20, :], 10.0 * settings.grav)

SSH is time varying by default, but you need to disable the streamfunction solver to enable it.

from veros.

kasped avatar kasped commented on June 20, 2024

from veros.

dionhaefner avatar dionhaefner commented on June 20, 2024

Please read the docs: https://veros.readthedocs.io/en/latest/reference/diagnostics.html#diagnostics

from veros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.