Comments (20)
There's no general recipe for this. You will have to find the index of the desired location (by looking it up in the coordinate arrays vs.xt
, vs.yt
), then change the variables at that locations (either in set_initial_conditions
or in set_forcing
, depending whether you want it to happen once or in every time step).
from veros.
Besides what's in the docs, we unfortunately don't have any beginner's resources yet. If you have a specific question and share what you tried I am happy to help.
from veros.
I noticed that it contains a runtime error: solution diverged at iteration 37.
I just copy pasted the terminal output in a text file which is attached below. The error is something related to the sqrtsa = npx.sqrt(sa) in gsw.py in /veros/veros/core/density.
So the solution became unstable and diverged. It seems to me like you also increased the time step? Like, the CFL diagnostic runs every model day, which should be at 48 time steps with the default step of 0.5 hours. But in the log I see its output after 24 time steps. That would explain why the setup diverged; the default values are close to the largest possible stable time steps.
I have another question as you mentioned that the real run would take several days in real time; how much would it take if I want to do a 80-100 year simulation on a HPC system ?
That depends how much hardware you want to throw at it :) On a single CPU node you will probably get something like 1 yr/day with JAX. By using multiple nodes or GPUs you can probably push that to something like 10 yr/day. But it all depends on your hardware and cluster architecture.
from veros.
I meant the main model time step (dt_tracer
and dt_mom
). The CFL diagnostic has no influence on the model, I just used it to deduce that you must have changed the time step from the default of 1800.
from veros.
You can use any Python code when running with NumPy:
def set_forcing(self, ...):
...
import matplotlib.pyplot as plt
plt.imshow(vs.force_salt_surface)
plt.show()
from veros.
Sorry but I'm kinda new to this model, so can you just elaborate a little on the procedure to perturb the variable. For example, If I want to decrease salinity gradually (with a fixed amount per year) then what do I have to do ?
from veros.
The simplest way would probably be to add / subtract a constant term here:
https://github.com/team-ocean/veros/blob/master/veros/setups/global_1deg/global_1deg.py#L328
A negative term would indicate a constant freshwater influx at the surface which gradually reduces salinity.
from veros.
For understanding the model code ,what can be a good start ?
from veros.
How to change the runtime of the global_1deg setup ?
I have tried settings.runlen=86400*365*3
to run it for 3 years but the output files does not contain any time step , i.e., Dimension of Time is 0.
from veros.
That sounds correct. Which commands did you use to create and run the setup? And can you share the output of the run?
from veros.
I just changed the settings.runlen
in the global_1deg.py
setup from it's default settings.runlen=10*settings.dt_tracer
to settings.runlen=86400*365*3
and ran the setup file.
files.zip
from veros.
Sorry, I meant the output to the terminal. Did it actually run for 3 years (which should take several days of real-time)?
from veros.
I am actually using a HPC system.
I noticed that it contains a runtime error: solution diverged at iteration 37
.
I just copy pasted the terminal output in a text file which is attached below. The error is something related to the sqrtsa = npx.sqrt(sa)
in gsw.py in /veros/veros/core/density.
I have another question as you mentioned that the real run would take several days in real time; how much would it take if I want to do a 80-100 year simulation on a HPC system ?
from veros.
Thanks...changing the CFL diagnostic time step from 24 to 48 worked; also checked the default global_1deg code and the CFL diagnostic time step is 24 there.
from veros.
Okay!!
yes I also changed that before. But in the docs I guess I have read that the dt_tracer
can be anything >= dt_mom
. But anyways got it now.
from veros.
If I'm doing 100 years of simulation, what would be the approx spin up time for global_1deg.py ?
from veros.
Depends on what part of the ocean you need spun up. 100 years sounds about right for equilibration of the MOC, but it's always safer to check (plot some mean variable over time and make sure it's converged). Or ask your advisor :)
from veros.
I have been trying to decrease the salinity in the North Atlantic using the 4 degree model. But the method seems to be not working. Did I miss something ?
I made a mask of 1s and 0s stored in the custom variable vs.freshwater
salt_mask_raw=xr.open_dataset('freshwater_mask.nc')
salt_mask_data = salt_mask_raw.freshwater_mask
longitude=salt_mask_data.longitude
latitude=salt_mask_data.latitude
salt_mask_data_interpolate = veros.tools.interpolate((latitude,longitude),salt_mask_data,(vs.xt,vs.yt), kind='nearest')
vs.freshwater = vs.freshwater.at[:, :].set(salt_mask_data_interpolate)
Then used the following code to decrease salinity in the mased region -
ampl = 1.0 # Decrease rate of 10 PSU per year
t_start = 4055.56 # Start time of the salinity decrease
t_duration = 10.0 # Duration of the salinity decrease in years
t_sim = vs.time / (360.*86400.) # Current simulation time in years
cond = jnp.less_equal(t_sim-t_start, t_duration)
decrease_years = jnp.where(cond, jnp.minimum(t_sim - t_start, t_duration), 0.0)
forc_val = jnp.where(cond, ampl * decrease_years, 0.0)
vs.forc_salt_surface = jnp.where(cond, vs.forc_salt_surface - (vs.freshwater * forc_val), vs.forc_salt_surface)
from veros.
Define not working?
Code looks fine to me for the most part, but please format it with triple backticks next time ```
The part that stands out to me is this:
cond = jnp.less_equal(t_sim-t_start, t_duration)
decrease_years = jnp.where(cond, jnp.minimum(t_sim - t_start, t_duration), 0.0)
forc_val = jnp.where(cond, ampl * decrease_years, 0.0)
vs.forc_salt_surface = jnp.where(cond, vs.forc_salt_surface - (vs.freshwater * forc_val), vs.forc_salt_surface)
That seems complicated for a simple ramp. I would implement this like so:
forc_val = ampl * jnp.clip((t_sim - t_start) / t_duration, 0, 1)
vs.forc_salt_surface = vs.forc_salt_surface - (vs.freshwater * forc_val)
If this still doesn't work I'd recommend you run your setup with NumPy on your local machine and plot some of the variables here (forc_salt_surface
, freshwater
).
from veros.
So the code didn't work.
But to plot force_salt_surface
and freshwater
it has to be added to the digontics before spin up, right ?
from veros.
Related Issues (20)
- Non-hydrostatic solver HOT 5
- Linear solver issue when parallelising VEROS HOT 1
- Document overturning variables HOT 2
- Bathymetry in Veros HOT 1
- Changing grid resolution and a closed ITF in global_4deg setup HOT 1
- How to run Veros via MPI on a cluster with slurm? HOT 1
- How to run veros with multi-GPU HOT 5
- The latest model version is not displayed correctly in documentation HOT 2
- How to change the sampling frequency of Veros 1
- How to change the sampling and output frequency of veros 1_deg model ? HOT 6
- No output files generating while using mpirun with JAX HOT 18
- How to add a mask file to veros and how to call in the model setup ? HOT 15
- Output variables HOT 11
- ENH: more metadata in diagnostic outputs? HOT 2
- North Atlantic Missing assets.json HOT 2
- Set beginning and ending time for simulation? HOT 4
- Veros using 10% of CPU HOT 1
- Using the North Atlantic regional setup for other regions HOT 5
- Update function HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from veros.