diff --git a/CHANGELOG.md b/CHANGELOG.md index bc90d1d88..4e6e38214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - Try to remove type piracies - Remove `params` from edge, node structs (appearantly never used) +## v2.5.0 November 17, 2024 + - update show methods for physics, grid + ## v2.4.0 November 11, 2024 - Use `precs` based linear solver API, see https://github.com/SciML/LinearSolve.jl/pull/514 with ExtendableSparse 1.6 - Deprecate VoronoiFVM solver strategies diff --git a/Project.toml b/Project.toml index 6ad8d901f..e7db401c6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "VoronoiFVM" uuid = "82b139dc-5afc-11e9-35da-9b9bdfd336f3" authors = ["Jürgen Fuhrmann ", "Patrick Jaap", "Daniel Runge", "Dilara Abdel", "Jan Weidner", "Alexander Seiler", "Patricio Farrell", "Matthias Liero"] -version = "2.4.0" +version = "2.5.0" [deps] BandedMatrices = "aae01518-5342-5314-be14-df237901396f" @@ -27,6 +27,7 @@ SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" +TextWrap = "b718987f-49a8-5099-9789-dcd902bef87d" [weakdeps] ExtendableFEMBase = "12fb9182-3d4c-4424-8fd1-727a0899810c" @@ -41,7 +42,7 @@ CommonSolve = "0.2" DiffResults = "1" DocStringExtensions = "0.8,0.9" ExtendableFEMBase = "0.7,0.8" -ExtendableGrids = "1.10.1" +ExtendableGrids = "1.11.0" ExtendableSparse = "1.6" ForwardDiff = "0.10.35" GridVisualize = "0.5.2,0.6.1,1" @@ -59,4 +60,5 @@ SparseDiffTools = "^1.19, 2" StaticArrays = "0.12,1" Statistics = "1.9" Symbolics = "4.2,5,6" +TextWrap= "1.0.2" julia = "1.9" diff --git a/src/VoronoiFVM.jl b/src/VoronoiFVM.jl index 83f4cf924..c28013d08 100644 --- a/src/VoronoiFVM.jl +++ b/src/VoronoiFVM.jl @@ -53,7 +53,7 @@ using SparseDiffTools: SparseDiffTools, forwarddiff_color_jacobian!, using StaticArrays: StaticArrays, @MVector, @SArray, @SMatrix using Statistics: Statistics, mean using Symbolics: Symbolics - +using TextWrap: print_wrapped """ $(TYPEDEF) diff --git a/src/vfvm_physics.jl b/src/vfvm_physics.jl index 5225a747d..98a75e9b0 100644 --- a/src/vfvm_physics.jl +++ b/src/vfvm_physics.jl @@ -59,22 +59,13 @@ Re-exported from ForwardDiff. # # Dummy callbacks # -function nofunc(f, u, node, data=nothing) -end +function nofunc(args...) end -function nosrc(f, node, data=nothing) -end -function default_storage(f, u, node, data=nothing) +function default_storage(f, u, node, data) f .= u end -function nofunc_generic(f, u, sys) -end - -function nofunc_generic_sparsity(sys) -end - ########################################################## """ @@ -200,7 +191,7 @@ mutable struct Physics{Flux <: Function, data::Data """ - Number of species including boundary species. + Number of species including boundary species. Meaningless & deprecated. """ num_species::Int8 end @@ -236,15 +227,15 @@ function Physics(; num_species = 0, reaction::Function = nofunc, edgereaction::Function = nofunc, storage::Function = default_storage, - source::Function = nosrc, + source::Function = nofunc, bflux::Function = nofunc, breaction::Function = nofunc, - bsource::Function = nosrc, + bsource::Function = nofunc, bstorage::Function = nofunc, boutflow::Function = nofunc, outflowboundaries::Vector{Int} = Int[], - generic::Function = nofunc_generic, - generic_sparsity::Function = nofunc_generic_sparsity, + generic::Function = nofunc, + generic_sparsity::Function = nofunc, kwargs...) return Physics(flux, storage, @@ -296,23 +287,27 @@ $(SIGNATURES) Show physics object """ function Base.show(io::IO, physics::AbstractPhysics) - str = @sprintf("VoronoiFVM.Physics(num_species=%d", physics.num_species) + str = "Physics(" if isdata(physics.data) - str = str * ", data=$(typeof(physics.data))" - end - function addfunc(func, name) - if func != nofunc - str = str * ", $(name)=$(nameof(func))" - end + str = str * "data=$(typeof(physics.data)), " end - + + # function addfunc(func, name) + # if func != nofunc + # str = str * ", $(name)=$(nameof(func))" + # end + # end + for name in fieldnames(typeof(physics)) - if (name != :num_species) && (name != :data) && getfield(physics, name) != nofunc - str = str * ", $(name)=$(nameof(getfield(physics,name)))" + if (name != :num_species) && (name != :data) && (name != :outflowboundaries) && getfield(physics, name) != nofunc + str = str * "$(name)=$(nameof(getfield(physics,name))), " end end + if length(physics.outflowboundaries)>0 + str=str * "outflowboundaries=$(physics.outflowboundaries)" + end str = str * ")" - println(io, str) + print(io, str) end """ diff --git a/src/vfvm_system.jl b/src/vfvm_system.jl index 7e3e71600..6e39a565c 100644 --- a/src/vfvm_system.jl +++ b/src/vfvm_system.jl @@ -996,13 +996,14 @@ function _initialize_inactive_dof!(U::DenseSolutionArray, system::DenseSystem) end function Base.show(io::IO, sys::AbstractSystem) - str = @sprintf("%s(num_species=%d)", typeof(sys), num_species(sys)) - println(io, str) + str = "$(typeof(sys))(\n grid = $(sys.grid),\n physics = $(sys.physics),\n num_species = $(num_species(sys)))" + sz=displaysize(io) + print_wrapped(io, str; replace_whitespace=false, subsequent_indent=" ", width=sz[2]) end ##################################################### -has_generic_operator(sys::AbstractSystem) = sys.physics.generic_operator != nofunc_generic -has_generic_operator_sparsity(sys::AbstractSystem) = sys.physics.generic_operator_sparsity != nofunc_generic_sparsity +has_generic_operator(sys::AbstractSystem) = sys.physics.generic_operator != nofunc +has_generic_operator_sparsity(sys::AbstractSystem) = sys.physics.generic_operator_sparsity != nofunc ################################################################## """