Coder Social home page Coder Social logo

Problem to run the test program about grid2grid HOT 8 OPEN

lheea avatar lheea commented on July 1, 2024
Problem to run the test program

from grid2grid.

Comments (8)

trimtrim avatar trimtrim commented on July 1, 2024

I used the intel Fortran compiler with version 19.1.1.217

from grid2grid.

trimtrim avatar trimtrim commented on July 1, 2024

I fixed the bug by adding the following line at line #140 of file hosOcen.inc
CALL this%dict_%initialize("HOSOcean")
The code is just before the following code:
! Read and initalize HOS simulation parameter
Call this%init_read_mod()

from grid2grid.

trimtrim avatar trimtrim commented on July 1, 2024

I think the hosNWT has similar bug suggest to add following at #150 of hosNWT.inc
CALL this%dict_%initialize("HOSNWT")
The code is just above the following code:
! Read and initalize HOS simulation parameter depending on file extension
Call this%init_read_mod()

from grid2grid.

YoungmChoi avatar YoungmChoi commented on July 1, 2024

Dear trimtrim,

I understand your problem. The test routine called "testSurf2Vol()" was used in Grid2Grid version1.
As we updated to Grid2Grid version 2, we adopted the dictionary input format which may conflict.

There are two subroutines initializing HOS Ocean or NWT types.

  • initialize the type with basic arguments (no advanced feature will be updated, only default option)
  • initialize the type with dictionary input (we can control many parameters)

I recommend you to use dictionary format which allows us a flexible input format, you will understand after comparing two subroutines.

Here's what happens:

  • You tested with the original subroutine with basic input (no dictionary pointer allocated in this subroutine). You allocated the dictionary pointer (actually, the pointer (address) is allocated but no data is included). Of course, this is one way to solve it, but I would fix the code as:

1. hosOcean.typ

type, public :: typHOSOcean
...
Integer :: extraInterpolationNumber

end type

2. hosOcean.inc

Add the lines:
Subroutine initHOSOceanSurf2VolDict(this, HOSDict)
....
#78: this%extraInterpolationNumber = this%dict_%getIntOrDefault("extraInterpolationNumber", 1)
....
End Subroutine

Subroutine initHOSOcean(this, ...)
....
#138: this%extraInterpolationNumber = 1
....
End Subroutine

Change the code:
#209 : this%nXmode_ = nint(x1) * this%extraInterpolationNumber
#216 : this%nYmode_ = nint(x2) * this%extraInterpolationNumber

The same principles can be applied to HOSNWT. I will update the code and tutorials based on your comment.

Thank you for reporting the error:)

Have a nice day.

Best regards,
Young-Myung Choi

from grid2grid.

trimtrim avatar trimtrim commented on July 1, 2024

Dear Young-Myung Choi,
Thanks for the quick reply. The method you used is more appropriate. If possible, can you please upload more tutorial cases which can help the user further understand the features of the library?

Many thanks!
Regards

from grid2grid.

YoungmChoi avatar YoungmChoi commented on July 1, 2024

Dear trimtrim,

Thank you for the fast response. Then, I'll update the code as I recommended in the previous answer.

We are planning to update Grid2Grid (version 3) to have generalized structure & input/output and more options. I'll try to make many tutorials to understand the features of the library after update.

If you have suggestion or idea which could be good to include in the future, please let us know. We will very appreciate.

Thank you and have a nice day!

Best regards,
Young-Myung Choi

from grid2grid.

trimtrim avatar trimtrim commented on July 1, 2024

Dear Young-Myung Choi,
Can you share an example case, which uses dictionary to init the typHOSVol2Vol and carry out the computation like testVol2Vol subroutine ?
Many thanks!

from grid2grid.

YoungmChoi avatar YoungmChoi commented on July 1, 2024

Dear trimtrim,

You can take some code of "postGrid2Grid.inc". The class "typPostGrid2Grid" has a member class "typHOSVol2Vol" as:

postGrid2Grid.typ

Type, public :: typPostGrid2Grid
...
Type(typHOSVol2Vol) :: hosVol2Vol_
...
End Type

Then, you can see the initialize subroutine for "typPostGrid2Grid":

postGrid2Grid.inc

subroutine initializePostG2G(this, inputFileName)

! initialize HOS Vol2Vol with Dictionary
hosTypeName = this%dict_%getChar("Grid2Grid")
Call this%hosVol2Vol_%initialize(this%dict_%subDict(hosTypeName))

end subroutine

For the input file, you use the input for postGrid2Grid execution in the source code:

postGrid2Grid.dict

In this file format, there is keyword Grid2Grid with value "HOSOcean". Then, the sub-dictionary named "HOSOcean" given in the file will pass into the vol2vol class (dict_%subDict(HOSOcean) returns sub-dictionary).

HOSOcean
{
type Ocean;
...
}

Remark that there is $zMesh which contains the data of zMesh dictionary in the above (like a macro). If you just need a wrapper for HOS, you can simply look inside "example/fortGrid2Grid".

Have a nice day!

Best regards,
Young-Myung Choi

from grid2grid.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.