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

mesh = aster_read_mesh(meshfile) doesn't work in my case... #51

Closed
Sukhe1993 opened this issue Sep 9, 2019 · 9 comments
Closed

mesh = aster_read_mesh(meshfile) doesn't work in my case... #51

Sukhe1993 opened this issue Sep 9, 2019 · 9 comments

Comments

@Sukhe1993
Copy link

Hi, I am a beginner in Julia and I am learning JuliaFEM atm.
I added the JuliaFEM and LinearAlgebra Package.
but when come to:

mesh = aster_read_mesh(meshfile)

then comes message as follows:

MethodError: no method matching get_nodes(::AsterReader.MEDFile, ::Dict{Int64,Array{String,1}}, ::String)
Closest candidates are:
get_nodes(::AsterReader.MEDFile, !Matched::Dict{Int32,Array{String,1}}, ::String) at C:\Users\21631933.julia\packages\AsterReader\LfzMD\src\read_aster_mesh.jl:119

Stacktrace:
[1] aster_read_mesh_(::AsterReader.MEDFile, ::Nothing) at C:\Users\21631933.julia\packages\AsterReader\LfzMD\src\read_aster_mesh.jl:201
[2] aster_read_mesh(::String, ::Nothing) at C:\Users\21631933.julia\packages\AsterReader\LfzMD\src\read_aster_mesh.jl:177
[3] #aster_read_mesh#121(::Bool, ::typeof(aster_read_mesh), ::String, ::Nothing) at C:\Users\21631933.julia\packages\JuliaFEM\or1RT\src\preprocess_aster_reader.jl:59
[4] aster_read_mesh(::String, ::Nothing) at C:\Users\21631933.julia\packages\JuliaFEM\or1RT\src\preprocess_aster_reader.jl:59 (repeats 2 times)
[5] top-level scope at In[11]:1

Can anyone helps me with this issue?
THANKS.

@Sukhe1993 Sukhe1993 changed the title mesh = aster_read_mesh(meshfile) doesn't work mesh = aster_read_mesh(meshfile) doesn't work in my case... Sep 9, 2019
@TeroFrondelius
Copy link
Member

Hi @Sukhe1993,
You will need to give a file name as a string:

meshfile = joinpath(datadir, "JuliaFEMSMP18.med")
mesh = aster_read_mesh(meshfile)

This equals:

mesh = aster_read_mesh( "datadir/JuliaFEMSMP18.med")

Here is the full example: https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/examples/linear_static.jl and here is the mesh file: https://github.com/JuliaFEM/JuliaFEM.jl/tree/master/examples/linear_static

I just noticed that instead of datadir it should be linear_static in the above example.

@Sukhe1993
Copy link
Author

Hi @Sukhe1993,
You will need to give a file name as a string:

meshfile = joinpath(datadir, "JuliaFEMSMP18.med")
mesh = aster_read_mesh(meshfile)

This equals:

mesh = aster_read_mesh( "datadir/JuliaFEMSMP18.med")

Here is the full example: https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/examples/linear_static.jl and here is the mesh file: https://github.com/JuliaFEM/JuliaFEM.jl/tree/master/examples/linear_static

I just noticed that instead of datadir it should be linear_static in the above example.

Thanks, TeroFrondelius,

I gave the name same as the example below and follow the example below.
http://www.juliafem.org/JuliaFEM.jl/latest/examples/2d_hertz_contact.html
However, it still doesn't work.

@TeroFrondelius
Copy link
Member

Can you post your code and the error message.

@Sukhe1993
Copy link
Author

Can you post your code and the error message.

Thanks for your help

using JuliaFEM, LinearAlgebra, Pkg
using JuliaFEM, LinearAlgebra, Pkg
datadir = Pkg.dir("JuliaFEM","examples")
┌ Warning: Pkg.dir(pkgname, paths...) is deprecated; instead, do import JuliaFEM; joinpath(dirname(pathof(JuliaFEM)), "..", paths...).
└ @ Pkg.API C:\cygwin\home\Administrator\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.2\Pkg\src\API.jl:415
"C:\Users\21631933\.julia\packages\JuliaFEM\or1RT\examples"
meshfile = joinpath(datadir,"hertz_2d_full.med")
"C:\Users\21631933\.julia\packages\JuliaFEM\or1RT\examples\hertz_2d_full.med"
mesh = aster_read_mesh(meshfile)
HDF5-DIAG: Error detected in HDF5 (1.10.5) thread 0:
#000: E:/mingwbuild/mingw-w64-hdf5/src/hdf5-1.10.5/src/H5F.c line 370 in H5Fis_hdf5(): unable open file
major: File accessibilty
minor: Not an HDF5 file
#1: E:/mingwbuild/mingw-w64-hdf5/src/hdf5-1.10.5/src/H5Fint.c line 826 in H5F__is_hdf5(): unable to open file
major: Low-level I/O
minor: Unable to initialize object
#2: E:/mingwbuild/mingw-w64-hdf5/src/hdf5-1.10.5/src/H5FD.c line 734 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#3: E:/mingwbuild/mingw-w64-hdf5/src/hdf5-1.10.5/src/H5FDsec2.c line 346 in H5FD_sec2_open(): unable to open file: name = 'C:\Users\21631933.julia\packages\JuliaFEM\or1RT\examples\hertz_2d_full.med', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
major: File accessibilty
minor: Unable to open file
Cannot access file C:\Users\21631933.julia\packages\JuliaFEM\or1RT\examples\hertz_2d_full.med

Stacktrace:
[1] error(::String, ::String) at .\error.jl:42
[2] h5f_is_hdf5(::String) at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:2329
[3] #h5open#3(::Bool, ::typeof(HDF5.h5open), ::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::HDF5.HDF5Properties, ::HDF5.HDF5Properties) at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:627
[4] #h5open at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:0 [inlined]
[5] #h5open#4(::Bool, ::typeof(HDF5.h5open), ::String, ::String) at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:675
[6] h5open at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:658 [inlined]
[7] h5read(::String, ::String) at C:\Users\21631933.julia\packages\HDF5\DktP4\src\HDF5.jl:724
[8] AsterReader.MEDFile(::String) at C:\Users\21631933.julia\packages\AsterReader\LfzMD\src\read_aster_mesh.jl:40
[9] aster_read_mesh(::String, ::Nothing) at C:\Users\21631933.julia\packages\AsterReader\LfzMD\src\read_aster_mesh.jl:177
[10] #aster_read_mesh#121(::Bool, ::typeof(aster_read_mesh), ::String, ::Nothing) at C:\Users\21631933.julia\packages\JuliaFEM\or1RT\src\preprocess_aster_reader.jl:59
[11] aster_read_mesh(::String, ::Nothing) at C:\Users\21631933.julia\packages\JuliaFEM\or1RT\src\preprocess_aster_reader.jl:59 (repeats 2 times)
[12] top-level scope at In[6]:1

@Sukhe1993
Copy link
Author

Can you post your code and the error message.

_ipynb.pdf
This is the pdf file, cheers

@TeroFrondelius
Copy link
Member

No such file or directory

Please download the med file to the same directory you are running the example and change the command to have just the file name.

@Sukhe1993
Copy link
Author

Sukhe1993 commented Sep 11, 2019 via email

@ahojukka5
Copy link
Member

Most of the output is because the documentation generation is failing. Did you already resolve this problem? Anyway, the problem seems to be quite trivial. You just need to have your script and mesh file in the same directory. This is working for me:

using AsterReader
meshfile = download("https://github.com/JuliaFEM/AsterReader.jl/raw/master/test/test_read_aster_mesh/quad4.med")
mesh = aster_read_mesh(meshfile)
println(mesh)

@ahojukka5
Copy link
Member

Now AsterReader.jl is giving more clear error message when user tries to load file not existing.

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

3 participants