From e5f8a5db6d988bf2830c673ab870f4fe40e57bb0 Mon Sep 17 00:00:00 2001 From: huiyuxie Date: Sun, 25 Aug 2024 19:52:06 -1000 Subject: [PATCH] start --- Project.toml | 7 ++++--- src/Trixi.jl | 1 + src/callbacks_step/glm_speed.jl | 2 +- src/equations/ideal_glm_mhd_2d.jl | 4 ++-- src/equations/ideal_glm_mhd_3d.jl | 4 ++-- src/semidiscretization/semidiscretization_coupled.jl | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index f8be84e0ce3..2ca53eb51a4 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Michael Schlottke-Lakemper ", "Gregor version = "0.8.9-DEV" [deps] +Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" @@ -50,13 +51,13 @@ TrixiBase = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [weakdeps] -Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" Convex = "f65535da-76fb-5f13-bab9-19810c17039a" ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" [extensions] -TrixiMakieExt = "Makie" TrixiConvexECOSExt = ["Convex", "ECOS"] +TrixiMakieExt = "Makie" [compat] CodeTracking = "1.0.5" @@ -109,6 +110,6 @@ UUIDs = "1.6" julia = "1.8" [extras] -Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" Convex = "f65535da-76fb-5f13-bab9-19810c17039a" ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" diff --git a/src/Trixi.jl b/src/Trixi.jl index 90fa590c50a..d9b9245918e 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -18,6 +18,7 @@ module Trixi # Include other packages that are used in Trixi.jl # (standard library packages first, other packages next, all of them sorted alphabetically) +using Accessors: @reset using LinearAlgebra: LinearAlgebra, Diagonal, diag, dot, mul!, norm, cross, normalize, I, UniformScaling, det using Printf: @printf, @sprintf, println diff --git a/src/callbacks_step/glm_speed.jl b/src/callbacks_step/glm_speed.jl index 8ee406af5f9..4760020504f 100644 --- a/src/callbacks_step/glm_speed.jl +++ b/src/callbacks_step/glm_speed.jl @@ -83,7 +83,7 @@ function update_cleaning_speed!(semi, glm_speed_callback, dt) c_h_deltat = calc_dt_for_cleaning_speed(cfl, mesh, equations, solver, cache) # c_h is proportional to its own time step divided by the complete MHD time step - equations.c_h = glm_scale * c_h_deltat / dt + @reset equations.c_h = glm_scale * c_h_deltat / dt return semi end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index ab2a4b066a1..76457ef2009 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -11,8 +11,8 @@ The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats `gamma` in two space dimensions. """ -mutable struct IdealGlmMhdEquations2D{RealT <: Real} <: - AbstractIdealGlmMhdEquations{2, 9} +struct IdealGlmMhdEquations2D{RealT <: Real} <: + AbstractIdealGlmMhdEquations{2, 9} gamma::RealT # ratio of specific heats inv_gamma_minus_one::RealT # = inv(gamma - 1); can be used to write slow divisions as fast multiplications c_h::RealT # GLM cleaning speed diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 2ffaa575243..d6f2bb01d63 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -11,8 +11,8 @@ The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats `gamma` in three space dimensions. """ -mutable struct IdealGlmMhdEquations3D{RealT <: Real} <: - AbstractIdealGlmMhdEquations{3, 9} +struct IdealGlmMhdEquations3D{RealT <: Real} <: + AbstractIdealGlmMhdEquations{3, 9} gamma::RealT # ratio of specific heats inv_gamma_minus_one::RealT # = inv(gamma - 1); can be used to write slow divisions as fast multiplications c_h::RealT # GLM cleaning speed diff --git a/src/semidiscretization/semidiscretization_coupled.jl b/src/semidiscretization/semidiscretization_coupled.jl index 7c1fbef972b..63f470f919a 100644 --- a/src/semidiscretization/semidiscretization_coupled.jl +++ b/src/semidiscretization/semidiscretization_coupled.jl @@ -383,7 +383,7 @@ function update_cleaning_speed!(semi_coupled::SemidiscretizationCoupled, c_h_deltat = calc_dt_for_cleaning_speed(cfl, mesh, equations, solver, cache) # c_h is proportional to its own time step divided by the complete MHD time step - equations.c_h = glm_scale * c_h_deltat / dt + @reset equations.c_h = glm_scale * c_h_deltat / dt end return semi_coupled