SNL-WaterPower / WecOptTool-MATLAB

WEC Design Optimization Toolbox
GNU General Public License v3.0
12 stars 9 forks source link

2020a Update 2 Bug: Reference to non-existent field 'Nf'. #160

Closed ssolson closed 4 years ago

ssolson commented 4 years ago

The errors seem to all be the same (example at bottom).

test_results.pdf

I believe I am even with WOT master

image

Error occurred in WecOptLib.tests.unit.getNemohTest/testNoExtraFigures and it did not run to completion.
    ---------
    Error ID:
    ---------
    'MATLAB:nonExistentField'
    --------------
    Error Details:
    --------------
    Reference to non-existent field 'Nf'.

    Error in WecOptLib.vendor.WEC_Sim.Read_NEMOH (line 147)
            for k = 1:hydro(F).Nf

    Error in WecOptTool.solver.NEMOH/getHydro (line 171)
                hydro = WecOptLib.vendor.WEC_Sim.Read_NEMOH(hydro, rundir);

    Error in WecOptTool.solver (line 50)
        hydro = solver.getHydro(varargin{:});

    Error in WecOptLib.tests.unit.getNemohTest>testNoExtraFigures (line 53)
        WecOptTool.solver("NEMOH",             ...
    ----------------------
    Additional Diagnostic:
    ----------------------
    Temporary folder preserved on failure: C:\Users\sterl_000\AppData\Local\Temp\tp7fc54586_a521_48a5_94f7_08553ed320b2testNoExtraFigures
ryancoe commented 4 years ago

Looks like an @ssolson problem... jk, but passing on macOS ;)

>> !git rev-parse HEAD
1caa02b33d125424d28637fd757de4463479c937
>> runTests

All passed: test_results.pdf

ssolson commented 4 years ago

Can you tell me what your raw value is if you put a debug at read_NEMOH.m line 48. E.g. I do not see the number of frequencies being read in from NEMOH.cal as shown in the screenshot below. This looks like where the missing Nf should be defined (line 75).

image

ryancoe commented 4 years ago

With a dbstop here: https://github.com/SNL-WaterPower/WecOptTool/blob/1caa02b33d125424d28637fd757de4463479c937/toolbox/%2BWecOptLib/%2Bvendor/%2BWEC_Sim/Read_NEMOH.m#L48


>> runTests
Running WecOptLib.tests.unit.AutoFolderTest
.....
Done WecOptLib.tests.unit.AutoFolderTest
__________

Running WecOptLib.tests.unit.PlotsTest
.Warning: Provided wave spectra have no weightings (field mu). Equal weighting presumed. 
> In WecOptTool.types/SeaState/makeMu (line 364)
  In WecOptTool.types/SeaState/validateArray (line 346)
  In WecOptTool.types (line 63)
  In WecOptLib.tests.unit/PlotsTest/testPowerPerFreqMultiSpectra (line 73)
.
Done WecOptLib.tests.unit.PlotsTest
__________

Running WecOptLib.tests.unit.SeaStateTest
Warning: Provided wave spectra have no weightings (field mu). Equal weighting presumed. 
> In WecOptTool.types/SeaState/makeMu (line 364)
  In WecOptTool.types/SeaState/validateArray (line 346)
  In WecOptTool.types (line 63)
  In WecOptLib.tests.unit/SeaStateTest/setup (line 18)
.......... ..........
Done WecOptLib.tests.unit.SeaStateTest
__________

Running WecOptLib.tests.unit.bisectionTest
.....
Done WecOptLib.tests.unit.bisectionTest
__________

Running WecOptLib.tests.unit.getFoldersTest
....
Done WecOptLib.tests.unit.getFoldersTest
__________

Running WecOptLib.tests.unit.getNemohCylinderTest
48  b = 0;
K>> raw

raw =

  33×1 cell array

    {'--- Environment --------------------------------------------------------------'                                                                                             }
    {'1025.0000       ! RHO           ! KG/M**3   ! Fluid specific volume '                                                                                                       }
    {'9.8100          ! G             ! M/S**2    ! Gravity '                                                                                                                     }
    {'0.              ! DEPTH         ! M         ! Water depth'                                                                                                                  }
    {'0. 0.           ! XEFF YEFF     ! M         ! Wave measurement point'                                                                                                       }
    {'--- Description of floating bodies -------------------------------------------'                                                                                             }
    {'1              ! Number of bodies'                                                                                                                                          }
    {'--- Body 1 ------------------------------------------------------------------'                                                                                              }
    {''./mesh/axisym_1.dat' ! Name of mesh file'                                                                                                                                  }
    {'418          171           ! Number of points and number of panels'                                                                                                         }
    {'6                          ! Number of degrees of freedom'                                                                                                                  }
    {'1 1. 0. 0. 0. 0. 0.        ! Surge'                                                                                                                                         }
    {'1 0. 1. 0. 0. 0. 0.        ! Sway'                                                                                                                                          }
    {'1 0. 0. 1. 0. 0. 0.        ! Heave'                                                                                                                                         }
    {'2 1. 0. 0. 0. 0. 0.0000    ! Roll about a point'                                                                                                                            }
    {'2 0. 1. 0. 0. 0. 0.0000    ! Pitch about a point'                                                                                                                           }
    {'2 0. 0. 1. 0. 0. 0.0000    ! Yaw about a point'                                                                                                                             }
    {'6                          ! Number of resulting generalised forces'                                                                                                        }
    {'1 1. 0.    0. 0. 0. 0.     ! Force in x direction'                                                                                                                          }
    {'1 0. 1.    0. 0. 0. 0.     ! Force in y direction'                                                                                                                          }
    {'1 0. 0. 1. 0. 0. 0.        ! Force in z direction'                                                                                                                          }
    {'2 1. 0. 0. 0. 0. 0.0000    ! Moment force in x direction about a point'                                                                                                     }
    {'2 0. 1. 0. 0. 0. 0.0000    ! Moment force in y direction about a point'                                                                                                     }
    {'2 0. 0. 1. 0. 0. 0.0000    ! Moment force in z direction about a point'                                                                                                     }
    {'0                          ! Number of lines of additional information'                                                                                                     }
    {'--- Load cases to be solved --------------------------------------------------'                                                                                             }
    {'10   0.1000      1.0000      ! Number of wave frequencies, Min, and Max (rad/s)'                                                                                            }
    {'1  0.  0.                    ! Number of wave directions, Min and Max (degrees)'                                                                                            }
    {'--- Post processing ----------------------------------------------------------'                                                                                             }
    {'0  0.1  10.                  ! IRF                    ! IRF calculation (0 for no calculation), time step and duration'                                                     }
    {'0                            ! Show pressure'                                                                                                                               }
    {'0  0.  180.                  ! Kochin function        ! Number of directions of calculation (0 for no calculations), Min and Max (degrees)'                                 }
    {'0  50  400.  400.            ! Free surface elevation ! Number of points in x direction (0 for no calcutions) and y direction and dimensions of domain in x and y direction'}

K>> 
ryancoe commented 4 years ago

Can you checkout some of previous commits and see where you start having problems?

ssolson commented 4 years ago

So It seems to break at the blueprint model. The last runTests I can get to avoid this error is 673e107af2052f393bab71252502bc0396b1d5d1.

I had run these tests (post blueprint model commit) previously and they were working but I cannot find where I posted those test results.

In the latest commit (origin master HEAD) when I dbstop at 48. Call pwd and open the Nemoh.cal file all the lines are there as they should be (e.g. the text file appears correct). But the textscan is only pulling in the 8 rows I show in the screenshot above.

I will continue working on this tomorrow. Maybe @H0R5E has a better test/ debug suggestion?

H0R5E commented 4 years ago

Which version of MATLAB are you on Sterling? Could this be a regression with update 4?

ssolson commented 4 years ago

I am currently running update 2 ('9.8.0.1380330 (R2020a) Update 2').

ssolson commented 4 years ago

I updated to 4 ( '9.8.0.1417392 (R2020a) Update 4') and moved to the latest commit (1caa02b33d125424d28637fd757de4463479c937) All tests pass.

   73 Passed, 0 Failed, 0 Incomplete.
   149.8416 seconds testing time

test_results.pdf

I believe this was a version issue. Mat for reference before I close this did you have this running on Update 2?

ryancoe commented 4 years ago

MATLAB 2020a has been the most buggy release I've dealt with...

H0R5E commented 4 years ago

I think it was working on update 2, but I've currently got update 3 and it's fine. As I don't think you can get a particular update of a release, I think it's safe to close this one. Perhaps add "[2020a Update 2 Bug]" to the title so people can search it.