Welcome, Guest
Username: Password: Remember me

TOPIC: Instabilities using culverts if Z1 != Z2

Instabilities using culverts if Z1 != Z2 2 years 11 months ago #39468

  • nicogodet
  • nicogodet's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 157
  • Thank you received: 39
Hello,

In many models, we have instabilities when we use culverts (option = 2) and when Z1 is different from Z2.

Recently, I have a very small model so I tried to debbug this without success unfortunately.
I print every time step to listing and graphic output but I can't observe any instabilities but the model is unstable
GRACJG (BIEF) : EXCEEDING MAXIMUM ITERATIONS: 200 RELATIVE PRECISION: NaN
If I change Z1 and Z2 in my culvert file with Z1=Z2=max(Z1, Z2), the model runs smoothly without issues.

Fun fact, if I restart the computation from the latest valid output, the computation finishes without issues.

I can't share the model in public but I could email it to someone.
Attachments:
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 11 months ago #39474

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello,

For such issues (nan), you should use a debug configuration with debug options to investigate.

See e.g. the S9.gfortran.debug configuration in the $HOMETEL/configs/systel.edf.cfg configuration file, in particular the flag fflags_debug_gfo for gfortran compiler.
fflags_debug_gfo: -g -Wall -fcheck=all -fbacktrace -fbounds-check -finit-integer=-1 -finit-real=nan -ffpe-trap=invalid,zero,overflow

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 11 months ago #39476

  • nicogodet
  • nicogodet's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 157
  • Thank you received: 39
Indeed, more info.
CALLING BUSE

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0 0x7f7cf82acd21 in ???
#1 0x7f7cf82abef5 in ???
#0 0x7f84fc79ad21 in ???
#1 0x7f84fc799ef5 in ???
#2 0x7f7cf7e0920f in ???
#2 0x7f84fc2f720f in ???
#3 0x563c106e3b3c in buse_
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/buse.f:489
#3 0x56308a70eb3c in buse_
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/buse.f:489
#4 0x563c108a205e in telemac2d_
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/telemac2d.F:1183
#5 0x563c105c7f13 in homere_telemac2d
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/homere_telemac2d.F:297
#6 0x563c105c9b73 in main
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/homere_telemac2d.F:35
#4 0x56308a8cd05e in telemac2d_
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/telemac2d.F:1183
#5 0x56308a5f2f13 in homere_telemac2d
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/homere_telemac2d.F:297
#6 0x56308a5f4b73 in main
at /home/ngo/telemac-mascaret/v8p3r0/sources/telemac2d/homere_telemac2d.F:35
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.

Line 489 in buse.f
     Q = -SECBUS(N)*SQRT(2.D0*GRAV*(S2-(RD1+HAUT))
&                        /(CE2+VALVE+L+CS1+TRASH))


At the time of the crash, I have :
S2 = 2.4603593886199691
RD1+HAUT = 2.9199999999999999

So there is a negative value inside SQRT() which cause the crash.
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 11 months ago #39477

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
Ths bug as already been identified.
There was a discussion on the potential solution.
This probably had been fixed as it seems to remain...
The discussed solutions was to change:
IF(S1.GE.(RD1+H1).AND.S2.LT.(RD2+H2)) THEN
                  Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-(RD2+H2))
     &              /(1.D0+CE1+L))
                ELSE
                  Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-S2)/(L+CS2+CE1))
                ENDIF
to
IF(S1.GE.(RD1+H1).AND.S2.LT.(RD2+H2)) THEN
                  IF(S1.GE.(RD2+H2)) THEN
                    Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-(RD2+H2))
     &                /(1.D0+CE1+L))
                  ELSE
                    Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-S2)
     &                /(1.D0+CE1+L))
                  ENDIF
                ELSE
                  Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-S2)/(L+CS2+CE1))
                ENDIF
or to
IF(S1.GE.(RD1+H1).AND.S2.LT.(RD2+H2).AND.
     &             S1.GE.(RD2+H2)) THEN
                  Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-(RD2+H2))
     &              /(1.D0+CE1+L))
                ELSE
                  Q = SECBUS(N)*SQRT(2.D0*GRAV*(S1-S2)/(L+CS2+CE1))
                ENDIF
this is for case 1 and 1 direction but the solution should be adapted for all case and all direction
Christophe
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 8 months ago #40066

  • nicogodet
  • nicogodet's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 157
  • Thank you received: 39
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 3 months ago #40712

  • nicogodet
  • nicogodet's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 157
  • Thank you received: 39
Any chance the fix falls in next release ?
gitlab.pam-retd.fr/otm/telemac-mascaret/...bb47cdc55bfe79af54aa
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 3 months ago #40811

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello,

For sure, there will be a fix for negative values under square roots for culverts for next release. It will be based on Lucie and other colleagues experience.
The issue you have quoted is not only to solve this bug but also to improve the feature.
But it has to be double checked and validated before merging to the main version (and next release).

For now, you can fix for your release with what Lucie has implemented if you do not want to wait for next release. Your feed back can be good.

Chi-Tuan
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 2 years 2 months ago #41010

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello,

FYI, the possible negative values under square roots for culvert was fixed in the main and will be available in next release v8p4 (planned in December).

But you can already replace file buse.f with the fix.

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: nicogodet

Instabilities using culverts if Z1 != Z2 1 year 11 months ago #41681

  • nicogodet
  • nicogodet's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 157
  • Thank you received: 39
Does this branch reach v8p4 ?
gitlab.pam-retd.fr/otm/telemac-mascaret/-/commits/culvert_fix/

Lot of fixes and revisited documentation
The administrator has disabled public write access.

Instabilities using culverts if Z1 != Z2 1 year 11 months ago #41713

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello,

Indeed, many fixes, modifications and documentation are present in this branch but work is still in progress (in particular by Lucie) and could not have been done before the new release v8p4r0.
Anyway many fixes were merged to v8p4 but perhaps not all.

If what is already done for v8p4 is not enough for you but modifications are OK for you in this branch, feel free to import what is of interest for you in your personal version of v8p4 (or main) and any feedback is welcome.

Chi-Tuan
The administrator has disabled public write access.
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.