FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
755 stars 188 forks source link

Example using nloptMMA not working #237

Closed paluneau closed 2 years ago

paluneau commented 2 years ago

I was trying to run the example in examples/plugin/VarIneq2.edp, but with the nloptMMA algorithm (instead of the default nloptAUGLAG version with int kas = 3 hardcoded at line 7). I received what I think is an invalid argument error, but don't really know where it comes from. Since no plot is displayed, I believe the error arises before the call to plot in the function J, or before the first call to J. Here's the output:

  -- Square mesh : nb vertices  =49 ,  nb triangles = 72 ,  nb boundary edges 24
invalid argument
  number of required edges : 0
  -- adaptmesh Regulary:  Nb triangles 28 , h  min 0.229294 , h max 0.35466
     area =  1 , M area = 9.18274 , M area/( |Khat| nt) 0.757379
     infiny-regulaty:  min 0.636584  max 1.10571
     anisomax  1.59067, beta max = 1.27869 min  0.964871
  --  mesh:  Nb of Triangles =     28, Nb of Vertices 21
invalid argument
  number of required edges : 0
  -- adaptmesh Regulary:  Nb triangles 26 , h  min 0.23677 , h max 0.395011
     area =  1 , M area = 9.18274 , M area/( |Khat| nt) 0.815639
     infiny-regulaty:  min 0.683696  max 1.20142
     anisomax  1.59139, beta max = 1.19416 min  0.944822
  --  mesh:  Nb of Triangles =     26, Nb of Vertices 20
times: compile 0.007727s, execution 0.003953s,  mpirank:0
 CodeAlloc : nb ptr  3662,  size :414168 mpirank: 0
Ok: Normal End
frederichecht commented 2 years ago

It is strange because on my mac , I have no error

the output is: -- Square mesh : nb vertices =49 , nb triangles = 72 , nb boundary edges 24 number of required edges : 0 -- adaptmesh statistics: Nb triangles 358 , h min 0.0424856 , h max 0.211854 area = 1 , M area = 151.095 , M area/( |Khat| nt) 0.974693 infiny-regularity: min 0.395418 max 1.78157 anisomax 4.72521, beta max = 1.38485 min 0.816325 -- mesh: Nb of Triangles = 358, Nb of Vertices 206 number of required edges : 0 -- adaptmesh statistics: Nb triangles 407 , h min 0.0335664 , h max 0.181409 area = 1 , M area = 197.523 , M area/( |Khat| nt) 1.12078 infiny-regularity: min 0.370323 max 2.30122 anisomax 4.0377, beta max = 1.44009 min 0.700502 -- mesh: Nb of Triangles = 407, Nb of Vertices 228 times: compile 0.008011s, execution 0.317631s, mpirank:0 ######## We forget of deleting 0 Nb pointer, 0Bytes , mpirank 0, memory leak =3384992 CodeAlloc : nb ptr 4608, size :510176 mpirank: 0 Ok: Normal End logout

and the graphic is Ok.

paluneau commented 2 years ago

I think I found my problem: I had to uncomment the section (lines 147-153) that projects start on lb or ub if out of bounds. That's my bad.

Could it be interesting to automate this operation by putting this block of code in a conditional statement (if(kas<3){...}) instead of commenting it? I wouldn't mind creating a pull request if you deem the modification worthy.

Merci!

frederichecht commented 2 years ago

I do ,

it is in version