OpenTidalFarm / OpenTidalFarm

Layout optimisation for tidal turbine farms
opentidalfarm.org
Other
33 stars 14 forks source link

Why NewtonSolver kept on not converging? (code and domain provided) #40

Closed AldeVal closed 2 years ago

AldeVal commented 3 years ago

Hello, i've been learning OpenTidalFarm to simulate both tidal and farm optimization for my undergraduate thesis. I tried doing a simulation on my own domain with most of Example 2.3 commands. However, i kept on getting errors of 'NewtonSolver' reaching maximum iterations (won't converge). So far i've tried :

  1. Reducing timesteps (from 300 to 60), it works until certain time elapsed then the error occured
  2. Changing viscosity constant, kept getting the error
  3. Tried the compute_distance.py code with my own domain.xml as the input for viscosity expression, the compute_distance.py code itself got the same error
  4. Tried initial_condition of (0, 0, 0), the simulation showed the error at the very beginning of simulation

I wonder what could be wrong in the simulation that could cause this? I'm providing my code and domain (.geo) if that helps.

The code : tidal_selat_bali.txt The domain .geo : selat_bali.txt

Thanks in advance!

Edit : the error simulation log :

Computed solution at time 0.0. Computed solution at time 60.0. Computed solution at time 120.0. Computed solution at time 180.0. Computed solution at time 240.0. Computed solution at time 300.0. Traceback (most recent call last): File "tidal_selat_bali.py", line 97, in for sol in solver.solve(): #annotate=False): File "/usr/local/lib/python2.7/dist-packages/opentidalfarm/solvers/coupled_sw_solver.py", line 525, in solve J=derivative(F, state_new)) File "/home/fenics/local/lib/python2.7/site-packages/dolfin_adjoint/solving.py", line 356, in solve ret = backend.solve(*args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 300, in solve _solve_varproblem(args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/dolfin/fem/solving.py", line 349, in _solve_varproblem solver.solve() RuntimeError:

------------------------------------------------------------------------- DOLFIN encountered an error. If you are not able to resolve this issue *** using the information listed below, you can ask for help at


*** fenics-support@googlegroups.com


Remember to include the error message listed below and, if possible, include a minimal running example to reproduce the error.


------------------------------------------------------------------------- Error: Unable to solve nonlinear system with NewtonSolver. Reason: Newton solver did not converge because maximum number of iterations reached. Where: This error was encountered inside NewtonSolver.cpp. *** Process: 0


DOLFIN version: 2017.1.0 Git changeset: 3d1f687ec9ee39afc0fe6e01800431995b42ad04 *** -------------------------------------------------------------------------

Aborted

AldeVal commented 2 years ago

I figured that it probably has something to do with the NetCDF tidal solution data resolution.

EDIT : Turns out what really mattered was the bathymetry I used a bathymetry from satellite altimetry which had noises at some points I interpolated the noise and now it runs as intended even with TPXO global data