Skip to content

Commit

Permalink
fix source terms
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert committed May 21, 2024
1 parent 93462e2 commit 80052c8
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/equations/bbm_bbm_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,22 @@ function rhs!(du_ode, u_ode, t, mesh, equations::BBMBBMEquations1D, initial_cond
@error "unknown type of first-derivative operator: $(typeof(solver.D1))"
end

@timeit timer() "source terms" calc_sources!(dq, q, t, source_terms, equations, solver)

@timeit timer() "deta elliptic" ldiv!(tmp3, invImD2, tmp1)
@timeit timer() "dv elliptic" ldiv!(tmp4, invImD2, tmp2)
@timeit timer() "source terms" begin
deta[:] = tmp1
dv[:] = tmp2
calc_sources!(dq, q, t, source_terms, equations, solver)
end

deta[:] = tmp3
dv[:] = tmp4
@timeit timer() "deta elliptic" begin
tmp1[:] = deta
ldiv!(tmp3, invImD2, tmp1)
deta[:] = tmp3
end
@timeit timer() "dv elliptic" begin
tmp2[:] = dv
ldiv!(tmp4, invImD2, tmp2)
dv[:] = tmp4
end
return nothing
end

Expand Down Expand Up @@ -247,13 +256,19 @@ function rhs!(du_ode, u_ode, t, mesh, equations::BBMBBMEquations1D, initial_cond
@error "unknown type of first-derivative operator: $(typeof(solver.D1))"
end

@timeit timer() "source terms" calc_sources!(dq, q, t, source_terms, equations, solver)
@timeit timer() "source terms" begin
deta[:] = tmp1
dv[:] = tmp2
calc_sources!(dq, q, t, source_terms, equations, solver)
end

@timeit timer() "deta elliptic" begin
tmp1[:] = deta
ldiv!(tmp3, invImD2n, tmp1)
deta[:] = tmp3
end
@timeit timer() "dv elliptic" begin
tmp2[:] = dv
ldiv!(tmp4, invImD2d, tmp2[2:(end - 1)])
dv[1] = dv[end] = zero(eltype(dv))
dv[2:(end - 1)] = tmp4
Expand Down

0 comments on commit 80052c8

Please sign in to comment.