Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to method of lines for FiniteDifference #187

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Switch to method of lines for FiniteDifference #187

merged 1 commit into from
Sep 3, 2024

Conversation

gerlero
Copy link
Owner

@gerlero gerlero commented Jul 14, 2024

No description provided.

src/finite.jl Outdated
C .= capacity.(prob.eq, u)
odesol = solve(odeprob, ImplicitEuler(), abstol = abstol, verbose = false)

if odesol.retcode != ReturnCode.Success && !isnothing(presol) && presol.retcode == ReturnCode.Success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
if odesol.retcode != ReturnCode.Success && !isnothing(presol) && presol.retcode == ReturnCode.Success
if odesol.retcode != ReturnCode.Success && !isnothing(presol) &&
presol.retcode == ReturnCode.Success

src/finite.jl Outdated
function f!(∂u_∂t, u, ::SciMLBase.NullParameters, t)
K = conductivity.(eq, u[(begin + 1):end])
Kf = (K[begin:(end - 1)] .+ K[(begin + 1):end]) / 2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/finite.jl Outdated
Kf = (K[begin:(end - 1)] .+ K[(begin + 1):end]) / 2

if u[begin] > zero(u[begin])
∂u_∂t[begin] = -(Kf[begin] / Δr * u[begin + 1] - Kf[begin] / Δr * u[begin + 2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
∂u_∂t[begin] = -(Kf[begin] / Δr * u[begin + 1] - Kf[begin] / Δr * u[begin + 2])
∂u_∂t[begin] = -(Kf[begin] / Δr * u[begin + 1] -
Kf[begin] / Δr * u[begin + 2])

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 81.06061% with 25 lines in your changes missing coverage. Please review.

Project coverage is 76.45%. Comparing base (7551271) to head (b603429).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/finite.jl 81.06% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
- Coverage   77.21%   76.45%   -0.77%     
==========================================
  Files          22       22              
  Lines         755      773      +18     
==========================================
+ Hits          583      591       +8     
- Misses        172      182      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/finite.jl Outdated
(integrator) -> nothing,
save_positions = (false, false))

odeprob = ODEProblem(f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
odeprob = ODEProblem(f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))
odeprob = ODEProblem(
f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))

src/finite.jl Outdated

odesol = solve(odeprob, ImplicitEuler(), abstol = abstol, verbose = false)

if odesol.retcode != ReturnCode.Success && !isnothing(presol) && presol.retcode == ReturnCode.Success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
if odesol.retcode != ReturnCode.Success && !isnothing(presol) && presol.retcode == ReturnCode.Success
if odesol.retcode != ReturnCode.Success && !isnothing(presol) &&
presol.retcode == ReturnCode.Success

src/finite.jl Outdated
u[(begin + 1)] = prob.b
u[(begin + 2):end] .= prob.i

odeprob = ODEProblem(f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
odeprob = ODEProblem(f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))
odeprob = ODEProblem(
f!, u, (t, prob._tstop), callback = CallbackSet(steady_state, exhausted))

@gerlero gerlero force-pushed the lines branch 4 times, most recently from ae999a2 to 0318d3f Compare September 3, 2024 13:02
@gerlero gerlero merged commit 444f433 into main Sep 3, 2024
6 of 7 checks passed
@gerlero gerlero deleted the lines branch September 3, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant