{"id":21044307,"url":"https://github.com/trixi-framework/talk-2022-juliacon_toolchain","last_synced_at":"2025-03-13T22:09:49.021Z","repository":{"id":41098030,"uuid":"508297024","full_name":"trixi-framework/talk-2022-juliacon_toolchain","owner":"trixi-framework","description":"From Mesh Generation to Adaptive Simulation: A Journey in Julia at JuliaCon 2022","archived":false,"fork":false,"pushed_at":"2022-07-27T09:58:16.000Z","size":112,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-20T17:28:22.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trixi-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-28T12:49:36.000Z","updated_at":"2024-07-29T14:01:21.000Z","dependencies_parsed_at":"2022-08-03T02:31:18.416Z","dependency_job_id":null,"html_url":"https://github.com/trixi-framework/talk-2022-juliacon_toolchain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2022-juliacon_toolchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2022-juliacon_toolchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2022-juliacon_toolchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trixi-framework%2Ftalk-2022-juliacon_toolchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trixi-framework","download_url":"https://codeload.github.com/trixi-framework/talk-2022-juliacon_toolchain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489898,"owners_count":20299001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T14:16:15.848Z","updated_at":"2025-03-13T22:09:48.999Z","avatar_url":"https://github.com/trixi-framework.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# JuliaCon 2022: From Mesh Generation to Adaptive Simulation: A Journey in Julia\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT)\n[![YouTube](https://img.shields.io/youtube/views/_N4ozHr-t9E?style=social)](https://www.youtube.com/watch?v=_N4ozHr-t9E)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.youtube.com/watch?v=hoViWRAhCBE\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg\n    src=\"https://user-images.githubusercontent.com/25242486/176432903-668ce8bf-4119-4d15-a46e-a1df90944e14.png\"\n    width=\"500px\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis is the companion repository for the [JuliaCon 2022](https://juliacon.org/2022) talk\n\n**From Mesh Generation to Adaptive Simulation: A Journey in Julia**\u003cbr\u003e\n*Andrew R. Winters*\u003cbr\u003e\n[Recorded talk on YouTube](https://www.youtube.com/watch?v=_N4ozHr-t9E)\n\n(see abstract [below](#abstract)). Here you can find the presentation slides\nin [talk.pdf](talk.pdf) as well as Julia scripts in the [examples](examples/)\ndirectory to locally create results of mesh generation with\n[HOHQMesh.jl](https://github.com/trixi-framework/HOHQMesh.jl)\nand [Trixi.jl](https://github.com/trixi-framework/Trixi.jl) simulations\npresented in the talk.\n\nTo reduce the size of the file for the [talk.pdf](talk.pdf), the video is not\nembedded. Instead, the video shown in the\npresentation is available [here](https://youtu.be/Q3Pi41gbOkI).\n\n\n## Abstract\n\nWe present a Julia toolchain for the adaptive simulation of hyperbolic PDEs\nsuch as flow equations on complex domains. It begins with using HOHQMesh.jl to\ncreate a curved, unstructured mesh. This mesh is then used in Trixi.jl, a\nnumerical simulation framework for conservation laws. We visualize the\nresults using Julia’s plotting packages. We highlight select features\nin Trixi.jl, like adaptive mesh refinement (AMR) or shock capturing,\nuseful for practical applications with complex transient behavior.\n\n\n### More detailed description\n\nApplications of interest in computational fluid mechanics typically occur\non domains with curved boundaries. Further, the solution of a non-linear\nphysical model can develop complex phenomena such as discontinuities,\nsingularities, and turbulence.\n\nAttacking such complex flow problems may seem daunting. In this talk,\nhowever, we present a toolchain with components entirely available in\nthe Julia ecosystem to do just that. In broad strokes the workflow is:\n\n1. Use [HOHQMesh.jl](https://github.com/trixi-framework/HOHQMesh.jl)\n   to interactively prototype and visualize a domain with curved boundaries.\n2. HOHQMesh generates an all quadrilateral mesh amenable for high-order numerical\n   methods.\n3. The mesh file is passed to [Trixi.jl](https://github.com/trixi-framework/Trixi.jl),\n   a numerical simulation framework for conservation laws.\n4. Solution-adaptive refinement of the mesh within Trixi is handled by\n   [P4est.jl](https://github.com/trixi-framework/P4est.jl).\n5. After the simulation, interactive visualization can be done using\n   [Makie.jl](https://makie.juliaplots.org/stable/).\n6. Solution data can also be exported with\n   [Trixi2Vtk.jl](https://github.com/trixi-framework/Trixi2Vtk.jl)\n   for visualization in\n   external software like [ParaView](https://www.paraview.org/).\n\nThe strength and simplicity of this workflow is through the combination\nof several packages either originally written in Julia, like Trixi.jl,\nor wrappers, like P4est.jl or HOHQMesh.jl, that provide Julia users access\nto powerful, well-developed numerical libraries and tools written in other\nprogramming languages.\n\n## Getting started\n\n\n### Installing Julia\nTo obtain Julia, go to https://julialang.org/downloads/ and download the latest\nstable release (v1.7.3 as of 2022-06-28). Then, follow the\n[platform-specific instructions](https://julialang.org/downloads/platform/)\nto install Julia on your machine.\nNote that there is no need to compile anything\nif you are using Linux, MacOS, or Windows.\nAvoid the JuliaPro distribution or the LTS release as Trixi may not work with them.\n\nAfter the installation, open a terminal and start the Julia *REPL*\n(i.e., the interactive prompt) with\n```shell\njulia\n```\n\n### Installing the required Julia packages\nTo run the scripts in the [examples](examples/) directory and allow for\nfully reproducible results, we have used Julia's package manager\nto pin all packages to a fixed release. This makes it straightforward to\nreproduce the Julia environment in which all the results presented were created.\n\nIf you have not done it yet, clone the repository where this code is stored:\n```shell\ngit clone https://github.com/trixi-framework/talk-2022-juliacon_toolchain.git\n```\nThen, navigate to your repository folder and install the required packages:\n```shell\ncd talk-2022-juliacon_toolchain\njulia --project=. -e 'using Pkg; Pkg.instantiate()'\n```\nThis will download and build all required packages, including the ODE package\n[OrdinaryDiffEq](https://github.com/SciML/OrdinaryDiffEq.jl), the visualization\npackage [GLMakie](https://github.com/JuliaPlots/Makie.jl/tree/master/GLMakie),\nthe mesh generator [HOHQMesh.jl](https://github.com/trixi-framework/HOHQMesh.jl),\nand [Trixi](https://github.com/trixi-framework/Trixi.jl).\nThe `--project=.` argument tells Julia to use the `Project.toml`\nand `Manifest.toml` files from this repository to figure out which packages to install.\n\nOnce the initialization and installation is complete you must start Julia with the\n`--project` flag set to your local clone of this repository\n```shell\njulia --project=@.\n```\n\n\n## Mesh created with tools from HOHQMesh.jl\nTo reproduce the figures and create the mesh file output execute from the REPL\n```julia\ninclude(joinpath(\"examples\", \"interactive_cylinder_with_sine_walls.jl\"))\n```\nThis will create the directory `out` where the mesh file is saved.\n\n## Simulation with Trixi.jl\nThe elixir file described in the presentation to setup and run a simulation\nof Mach 2 flow over a cylinder is `elixir_euler_mach2_cylinder.jl`.\nTo run the simulation up to a final time of 0.5, execute from the REPL\n```julia\nusing Trixi\ntrixi_include(joinpath(\"examples\", \"elixir_euler_mach2_cylinder.jl\"), tspan=(0.0,0.5))\n```\nwhere the final time is adjusted within the `trixi_include` call.\nThis simulation to the final time 0.5 takes approximately 20 minutes on a single thread.\nTo visualize the solution `sol` at the final time execute\n```julia\nusing GLMakie\npd = PlotData2D(sol)\nplot(pd[\"rho\"])\n```\n\n## Combined script\nThe script `build_mesh_and_run_mach2_cylinder.jl` executes the entire toolchain\ndescribed in the talk. That is, the script generates the mesh, runs the simulation,\nvisualizes the final result in Makie, converts the output files to VTK format\nusing Trixi2Vtk, and saves them to the `plot_files` directory. Execute this script with\n```julia\ninclude(joinpath(\"examples\", \"build_mesh_and_run_mach2_cylinder.jl\"))\n```\n\nAs written, the script `elixir_euler_mach2_cylinder.jl` sets `tspan = (0.0, 0.0)` on line 94.\nThis can be adjusted\nto take a different final time, e.g., the final time for the video is 2.25.\n\nTo reproduce the ParaView visualization, first open ParaView (after\n[downloading and installing](https://www.paraview.org/download/) it if necessary).\nThen load the ParaView state by clicking\nthrough `File -\u003e Load State` and open `supersonic_cylinder_state.pvsm`.\nNext, from the prompt \"Load State Data File Options\" select \"Choose File Names\",\nnavigate to the `plot_files` directory and select the appropriate\n`solution.pvd` and `solution_celldata.pvd` files.\n\n\n## Authors\nThis repository was initiated by\n[Andrew R. Winters](https://liu.se/en/employee/andwi94).\n\n\n## License\nThe contents of this repository are licensed under the MIT license\n(see [LICENSE.md](LICENSE.md)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrixi-framework%2Ftalk-2022-juliacon_toolchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrixi-framework%2Ftalk-2022-juliacon_toolchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrixi-framework%2Ftalk-2022-juliacon_toolchain/lists"}