Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5 file for HydroChrono input #60

Open
AgreeU opened this issue Aug 27, 2024 · 3 comments
Open

H5 file for HydroChrono input #60

AgreeU opened this issue Aug 27, 2024 · 3 comments

Comments

@AgreeU
Copy link

AgreeU commented Aug 27, 2024

I have successfully compiled HydroChrono. However, I am a bit confused about the input format of its H5 file. I am not sure how to structure this file in the right format, which is preventing me from running some other test cases. Could you provide some references or guidelines? I am not familiar with this, as I have previously used NEMOH.

Also, as I understand it, I just need to copy the compiled DLL and LIB files, and link them with my own cases to use HydroChrono for calculations, right?

Uploading rm3.h5…

@NREL NREL deleted a comment Aug 27, 2024
@dav-og
Copy link
Collaborator

dav-og commented Aug 27, 2024

Hi @AgreeU,

This is a bit of an issue with HydroChrono at the moment - we still use WEC-Sim's BEMIO utility to generate the .h5 files (for now, at least).

However, recently BEM Rosetta included the capability to export hydrodynamic coefficients to .h5 file format. You should be able to import Nemoh data and export it to .h5 with BEMRosetta. Its available in GUI form, CLI and Python package. However, I haven't yet tested its .h5 export feature with HydroChrono.

In the future we want to make HydroChrono more user friendly (e.g. PR #56 is developing a Python wrapper for HydroChrono), but at the moment the best approach is to just modify some of the existing demo/example cases and compile them.

@AgreeU
Copy link
Author

AgreeU commented Aug 28, 2024

Hi @dav-og ,
Thank you for patiently guiding me. I am trying to use bemio to build an h5 document, which supports NEMOH. In addition, by defining the include directory and then copying several DLLs to the exe directory, I have managed to run the rm3 case. Looking forward to more communication in the future.

@AgreeU
Copy link
Author

AgreeU commented Aug 28, 2024

Hi, @dav-og
I have encountered a strange issue. I have noticed that the HDF5 files generated by bemio are in column vector format, while the HDF5 files from chrono are in row vector format. I am wondering if there is any method used to transpose the data. This is causing some issues when reading the column vector format in Hydrochrono. For example, in the following code, the result of dims[1] is 0, which leads to a crash.

void H5FileInfo::Init1D(H5::H5File& file, std::string data_name, Eigen::VectorXd& var) {
…………
hsize_t dims[2] = {0, 0}; // dataset dimensions
int rank = filespace.getSimpleExtentDims(dims);
// read file into data_out 2d array
H5::DataSpace mspace1(rank, dims);
double* temp = new double[dims[0] * dims[1]];

std::cout << "1D dims: " << dims[0] << std::endl;
std::cout << "1D dims: " << dims[1] << std::endl;
                             …………

}

rm3.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants