From ac18a503fd0ffc43c22bf0a4bebc8f557358ec17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Mart=C3=ADnez?= Date: Sat, 29 Aug 2026 10:44:32 +0200 Subject: [PATCH] print --- Project.toml | 2 ++ src/ComputationalModels/ComputationalModels.jl | 1 + src/ComputationalModels/Drivers.jl | 10 +++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index ffb206a..7a0a83d 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ GridapGmsh = "3025c34a-b394-11e9-2a55-3fee550c04c8" GridapSolvers = "6d3209ee-5e3c-4db7-a716-942eb12ed534" IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" @@ -35,6 +36,7 @@ GridapSolvers = "0.6, 0.7" IterativeSolvers = "0.9" LinearAlgebra = "1.10" PartitionedArrays = "≥0.3" +Printf = "1.11.0" StaticArrays = "1.9" WriteVTK = "1.21" julia = "1.10" diff --git a/src/ComputationalModels/ComputationalModels.jl b/src/ComputationalModels/ComputationalModels.jl index c2188ee..ea271ab 100644 --- a/src/ComputationalModels/ComputationalModels.jl +++ b/src/ComputationalModels/ComputationalModels.jl @@ -18,6 +18,7 @@ using GridapSolvers.SolverInterfaces: finished, print_message, converged using LinearAlgebra using WriteVTK +using Printf using GridapGmsh using GridapGmsh: GmshDiscreteModel diff --git a/src/ComputationalModels/Drivers.jl b/src/ComputationalModels/Drivers.jl index 50b1c88..a384e05 100644 --- a/src/ComputationalModels/Drivers.jl +++ b/src/ComputationalModels/Drivers.jl @@ -55,9 +55,9 @@ function solve!(m::StaggeredModel; flagconv = 1 # convergence flag 0 (max bisections) 1 (max steps) ∆τ = 1.0 / nsteps for τ in 0:nsteps-1 - println("*******************************************") - println(" Staggered Step: $τ ") - println("*******************************************") + printstyled(@sprintf("*******************************************\n"), color=:green, bold=true) + printstyled(@sprintf(" Staggered Step: %i \n", τ), color=:green, bold=true) + printstyled(@sprintf("*******************************************\n"), color=:green, bold=true) presolver(τ, ∆τ) τ⁻=evolτ(τ*∆τ) τ⁺=evolτ((τ+1)*∆τ) @@ -177,7 +177,7 @@ function solve!(m::StaticNonlinearModel; nbisect += 1 # @assert(nbisect <= stepping[:maxbisec], "Maximum number of bisections reached") else - print_message(nls.log, "\nSTEP: $Λ_, Λ: $Λ\n") + print_message(nls.log, sprint(io -> printstyled(io, @sprintf("\nSTEP: %i, Λ: %.3f\n", Λ_, Λ); color=:green, bold=true))) Λ_ += 1 # Write to PVD post(Λ) @@ -353,7 +353,7 @@ function solve!(m::DynamicNonlinearModel; update_velocity!(m.velocity.vh, x, x⁻, Δt) x⁻ .= x - print_message(nls.log, "\nStep: $itime, Time: $t\n") + print_message(nls.log, sprint(io -> printstyled(io, @sprintf("\nStep: %i, Time: %.3f s\n", itime, t); color=:green, bold=true))) post(t)