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

Fix symbolic bug #252

Closed
wants to merge 20 commits into from
Closed

Fix symbolic bug #252

wants to merge 20 commits into from

Conversation

mjohnson541
Copy link
Collaborator

Fix bug when feeding symbolic variables through getkfkrev.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 52.74725% with 86 lines in your changes are missing coverage. Please review.

Project coverage is 48.56%. Comparing base (1f37bfd) to head (38cc087).

Files Patch % Lines
src/PhaseState.jl 64.70% 48 Missing ⚠️
src/ReactionMechanismSimulator.jl 0.00% 28 Missing ⚠️
src/Reactor.jl 44.44% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #252      +/-   ##
==========================================
- Coverage   48.71%   48.56%   -0.15%     
==========================================
  Files          31       31              
  Lines        8313     8351      +38     
==========================================
+ Hits         4050     4056       +6     
- Misses       4263     4295      +32     

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

@mjohnson541
Copy link
Collaborator Author

I've also added finite differences as a Jacobian source and improved our handling of jac_prototype.

@mjohnson541
Copy link
Collaborator Author

Decided to not add finite differences because how much the accuracy of the Jacobian degrades.

@mjohnson541 mjohnson541 requested a review from hwpang March 10, 2024 22:54
Copy link
Contributor

@hwpang hwpang left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I have some questions and requests for improving code formatting.

src/PhaseState.jl Outdated Show resolved Hide resolved
if signbit(f)
kf = getkf(rxn,ph,T,P,C,ns,V,phi)
else
if isa(f,Num) || !signbit(f)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you run a formatting script over your changes or this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm having difficulty getting the formatter extension to connect with the julia kernel. Was there anything in particular you had in mind?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add blank after comma?

Copy link
Contributor

Choose a reason for hiding this comment

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

I ran formatter on the files changed in this PR, so I'm good with the formatting

@@ -310,7 +327,7 @@ function Reactor(domain::T, y0unlumped::Array{W1,1}, tspan::Tuple, reducedmodelm
if modelingtoolkit
sys = modelingtoolkitize(ode)
jac = eval(ModelingToolkit.generate_jacobian(sys)[2])
odefcn = ODEFunction(dydt; jac=jac, paramjac=jacp!)
odefcn = ODEFunction(dydt; jac=jac, paramjac=jacp!, jac_prototype=jac_prototype)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is modelingtoolkitize tested in our test? Maybe we should add a test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should, but we need a very small mechanism to make it fast.

src/Reactor.jl Outdated Show resolved Hide resolved
Co-authored-by: Hao-Wei Pang <45482070+hwpang@users.noreply.github.com>
Copy link
Contributor

@hwpang hwpang left a comment

Choose a reason for hiding this comment

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

One last question, otherwise LGTM

- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: 1.8
Copy link
Contributor

@hwpang hwpang Mar 21, 2024

Choose a reason for hiding this comment

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

Why do we pin to 1.8? What is preventing us to move up to 1.10?

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.

None yet

2 participants