NaN error #1436
Replies: 6 comments 3 replies
-
NaNs often occur either because the time step is too small, or because the problem being posed is too extreme or not physical (such that a reasonable and stable time step cannot be found). One issue is that the use of w_bcs = WVelocityBoundaryConditions(grid, top = ValueBoundaryCondition(0.0), bottom=ValueBoundaryCondition(0.0)) You are trying to specify an impenetrable boundary condition on the vertical velocity, which requires w_bcs = WVelocityBoundaryConditions(grid, top = NormalFlowBoundaryCondition(0.0), bottom=NormalFlowBoundaryCondition(0.0)) this is also the default for a grid with boundary_conditions = (u=u_bcs, v=v_bcs, w=w_bcs, T=T_bcs)) to boundary_conditions = (u=u_bcs, v=v_bcs, T=T_bcs)) in your constructor for A good approach for developing a complex simulation is to start with something simple (or something that worked previously) and modify the script incrementally (slowly!), re-running and re-testing the script after each significant change. For this is useful to run either a two-dimensional version of the problem or a very low resolution simulation. I also suggest adding some lines at the bottom of your script to plot the solution so you can visually inspect it after a run. Your setup looks like a laboratory-scale simulation of convection. I think starting with uniform cooling (rather than spatially varying), omitting the effect of salinity, and using an |
Beta Was this translation helpful? Give feedback.
-
sir, this code worked when I omitted the effect of rotation, But after adding the rotation effect it started creating problems. |
Beta Was this translation helpful? Give feedback.
-
@Sumanshekhar17 We are more than happy to help with debugging Oceananigans.jl scripts and simulation setups, but you need to show some effort and willingness too. We cannot set up your simulation for you. @glwagner provided some excellent advice on how you can develop a complex simulation, I suggest you follow it. This is how we develop our simulations, slowly and iteratively. Most importantly: we check what it is doing by plotting the solution and making movies. Plotting and debugging simulations in 2D is easier. If you can post some figures and movies of your solution we might be able to help. |
Beta Was this translation helpful? Give feedback.
-
@Sumanshekhar17 Sorry if I was a little rude. We want to help but we need more information. How did you come up with your values for Making a movie of the solution without rotation then with rotation could be very helpful. I'll turn this issue into a GitHub discussion so we can continue discussing there. |
Beta Was this translation helpful? Give feedback.
-
Dear @glwagner and @ali-ramadhan sir should I upload my calculations also where I have scaled down the values? |
Beta Was this translation helpful? Give feedback.
-
dear sir, successful_animation.mp4above is the animation of the same. |
Beta Was this translation helpful? Give feedback.
-
Respected sir,
I want to simulate a small prototype of Open Ocean convection and did all necessary scaling according to that. Please have a look at my code, I don't know why my code isn't working. It is giving NaN error.
Beta Was this translation helpful? Give feedback.
All reactions