diff --git a/docs/download_resources.jl b/docs/download_resources.jl index 2dfbeffb2f..48d2671053 100644 --- a/docs/download_resources.jl +++ b/docs/download_resources.jl @@ -5,12 +5,9 @@ const directory = joinpath(@__DIR__, "src", "tutorials") mkpath(directory) for (file, url) in [ - "periodic-rve.msh" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/periodic-rve.msh", - "periodic-rve-coarse.msh" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/periodic-rve-coarse.msh", "transient_heat.gif" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/transient_heat.gif", "transient_heat_colorbar.svg" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/transient_heat_colorbar.svg", "porous_media.gif" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/porous_media.gif", - "porous_media_0p25.inp" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/porous_media_0p25.inp", "reactive_surface.gif" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/reactive_surface.gif", "nsdiffeq.gif" => "https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/nsdiffeq.gif", ] diff --git a/docs/src/literate-tutorials/computational_homogenization.jl b/docs/src/literate-tutorials/computational_homogenization.jl index 945c02fe06..7dd71bd413 100644 --- a/docs/src/literate-tutorials/computational_homogenization.jl +++ b/docs/src/literate-tutorials/computational_homogenization.jl @@ -9,7 +9,7 @@ #- #md # !!! tip #md # This example is also available as a Jupyter notebook: -#md # [`computational_homogenization.ipynb`](@__NBVIEWER_ROOT_URL__/examples/computational_homogenization.ipynb). +#md # [`computational_homogenization.ipynb`](@__NBVIEWER_ROOT_URL__/tutorials/computational_homogenization.ipynb). #- # # ## Introduction @@ -197,17 +197,21 @@ using FerriteGmsh #src notebook: use coarse mesh to decrease build time #src script: use the fine mesh #src markdown: use the coarse mesh to decrease build time, but make it look like the fine -#nb ## grid = togrid("periodic-rve.msh") -#nb grid = togrid("periodic-rve-coarse.msh") -#jl ## grid = togrid("periodic-rve-coarse.msh") -#jl grid = togrid("periodic-rve.msh") -#md grid = togrid("periodic-rve.msh") #- +import Downloads #hide +meshfile = "periodic-rve.msh" #src +#jl meshfile = "periodic-rve.msh" +#md meshfile = "periodic-rve-coarse.msh" #hide +#nb meshfile = "periodic-rve-coarse.msh" +isfile(meshfile) || Downloads.download( #hide + string("https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/", meshfile), #hide + meshfile) #hide +grid = togrid(meshfile) #src +#nb grid = togrid(meshfile) #md grid = redirect_stdout(devnull) do #hide -#md togrid("periodic-rve-coarse.msh") #hide -#md end #hide - -grid = togrid("periodic-rve.msh") #src +#md togrid(meshfile) #hide +#md end #hide +#md grid # Next we construct the interpolation and quadrature rule, and combining them into # cellvalues as usual: diff --git a/docs/src/literate-tutorials/porous_media.jl b/docs/src/literate-tutorials/porous_media.jl index 65c211dd43..7ca7e8afd3 100644 --- a/docs/src/literate-tutorials/porous_media.jl +++ b/docs/src/literate-tutorials/porous_media.jl @@ -96,7 +96,7 @@ #md # the final [section](@ref porous-media-plain-program) # # Required packages -using Ferrite, FerriteMeshParser, Tensors +using Ferrite, FerriteMeshParser, Tensors, Downloads # ### Elasticity # We start by defining the elastic material type, containing the elastic stiffness, @@ -249,8 +249,14 @@ end; # `get_ferrite_grid` function. We then create one cellset for each phase (solid and porous) # for each element type. These 4 sets will later be used in their own `SubDofHandler` function get_grid() + ## Try downloading the grid if not available already + gridfile = "porous_media_0p25.inp" + isfile(gridfile) || Downloads.download( + string("https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/", gridfile), + gridfile) + ## Import grid from abaqus mesh - grid = get_ferrite_grid(joinpath(@__DIR__, "porous_media_0p25.inp")) + grid = get_ferrite_grid(gridfile) ## Create cellsets for each fieldhandler addcellset!(grid, "solid3", intersect(getcellset(grid, "solid"), getcellset(grid, "CPS3"))) diff --git a/test/test_examples.jl b/test/test_examples.jl index d20001d18f..5758277c8e 100644 --- a/test/test_examples.jl +++ b/test/test_examples.jl @@ -41,12 +41,11 @@ end # end module TestComputationalHomogenization - include(joinpath(@__DIR__, "../docs/download_resources.jl")) mktempdir() do dir cd(dir) do - cp(joinpath(@__DIR__, "../docs/src/tutorials/periodic-rve.msh"), - joinpath(dir, "periodic-rve.msh") - ) + # Add already downloaded file to allow running test suite offline + mesh_file = joinpath(@__DIR__, "../docs/src/tutorials/periodic-rve.msh") + isfile(mesh_file) && cp(mesh_file, joinpath(dir, basename(mesh_file))) include(joinpath(@__DIR__, "../docs/src/literate-tutorials/computational_homogenization.jl")) end end