Skip to content

Commit

Permalink
restore verbose output in staggered solver
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Mar 2, 2024
1 parent 740fd60 commit 7564d6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/physics/stagSolve.nim
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ proc solve*(s:Staggered; x,b:Field; m:SomeNumber; sp0: var SolverParams) =
sp.calls = 1
sp.seconds = getElapsedTime()
sp.flops += float((s.g.len*4*72+24)*x.l.nEven) # ???
#if sp0.verbosity>0:
if sp0.verbosity>0:
#let its = sp.iterations
#let s = sp.seconds
#let f = sp.flops
#let gf = 1e-9*f/s
#echo "op time: ", top
#echo "stagSolve: ", sp.getStats
echo "stagSolve: ", sp.getStats
sp0.addStats(sp)

proc solve*(s:Staggered; r,x:Field; m:SomeNumber; res:float;
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/solverUtils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ proc relResid*(r,x: any, a: float): float =
mixin norm2, simdReduce
var t: type(r[0].norm2)
var u: type(r[0].norm2)
let an = a * x.l.physVol.float / (x.norm2 + float.epsilon)
for e in r:
let r2 = r[e].norm2
let x2 = x[e].norm2
let s = 1.0/(1.0+a*x2)
let s = 1.0/(1.0+an*x2)
t += s*r2
u += s
var ts = simdSum(t)
Expand Down

0 comments on commit 7564d6f

Please sign in to comment.