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 to build Cantera against Sundials 4.0.0 and newer #672

Merged
merged 3 commits into from
Aug 9, 2019

Conversation

band-a-prend
Copy link
Contributor

Please fill in the issue number this pull request is fixing:

Fixes #620

Changes proposed in this pull request:

  • Simple fix for Cantera compatibility with Sundials 3.2;
  • Fix to make Cantera build against >=Sundials-4.0.

@codecov
Copy link

codecov bot commented Jul 24, 2019

Codecov Report

Merging #672 into master will decrease coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
- Coverage   70.63%   70.63%   -0.01%     
==========================================
  Files         372      372              
  Lines       43575    43567       -8     
==========================================
- Hits        30778    30772       -6     
+ Misses      12797    12795       -2
Impacted Files Coverage Δ
src/kinetics/ImplicitSurfChem.cpp 84.66% <ø> (-0.1%) ⬇️
src/numerics/IDA_Solver.cpp 0% <ø> (ø) ⬆️
src/zeroD/ReactorNet.cpp 83.59% <ø> (-0.09%) ⬇️
include/cantera/numerics/CVodesIntegrator.h 0% <ø> (ø) ⬆️
include/cantera/numerics/Integrator.h 3.07% <0%> (ø) ⬆️
src/numerics/CVodesIntegrator.cpp 77.05% <100%> (+0.68%) ⬆️
src/transport/GasTransport.cpp 90.37% <0%> (-0.21%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27f30c6...32d8fe4. Read the comment docs.

Copy link
Member

@speth speth 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 looking into the required changes to work with the newer SUNDIALS releases. I think the suggested change will simplify things a bit and localize the preprocessor checks on CT_SUNDIALS_VERSION to the CVodesIntegrator class.

virtual void setIterator(IterType t) {
warn("setInterator");
}
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Given that we never use any method besides Newton iteration, my suggestion would be to:

  • deprecate setIterator and remove the m_iter variable
  • remove the existing calls to setIterator, and
  • directly call CVodeCreate with the CV_NEWTON constant if we're using an older version of Sundials.

@band-a-prend
Copy link
Contributor Author

I checked that Cantera build and pass tests with SUNDIALS v.5.0.0-dev.1 but refrained mentioning it's 5.0 in the SConstruct version check until 5.0 final release.

include/cantera/numerics/Integrator.h Outdated Show resolved Hide resolved
@bryanwweber
Copy link
Member

@band-a-prend can you remove the "cantera" from the beginning of the commit message? If you want, you can classify the commit with [Doc], [Thermo], [Tests], etc.

@band-a-prend
Copy link
Contributor Author

@bryanwweber
I removed it. It really was redundant here.

The Sundials 3.1 and 3.2 are compatible with each other
so this patch just allows to pass check for the installed Sundials 3.2
The changelog of Sundials 4.0.0 states:

"With the introduction of SUNNonlinSol modules, the input parameter iter
to CVodeCreate has been removed along with the function CVodeSetIterType
and the constants CV_NEWTON and CV_FUNCTIONAL.
Similarly, the ITMETH parameter has been removed from the Fortran interface
function FCVMALLOC. Instead of specifying the nonlinear iteration type
when creating the CVODE(S) memory structure, CVODE(S) uses
the SUNNONLINSOL_NEWTON module implementation of a Newton iteration by default."

so the appropreate conditional changes are added to control
the code execution via CT_SUNDIALS_VERSION preprocessor variable
to omit the parameters of Sundials solver that are no longer required.
Remove m_iter variable and deprecate setIterator function
because only Newton (CV_NEWTON) iteration method is used.
@speth speth merged commit 1606ce1 into Cantera:master Aug 9, 2019
band-a-prend added a commit to band-a-prend/gentoo-overlay that referenced this pull request Aug 14, 2019
This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672
band-a-prend added a commit to band-a-prend/gentoo that referenced this pull request Aug 14, 2019
This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
gentoo-repo-qa-bot pushed a commit to gentoo-mirror/gentoo that referenced this pull request Sep 5, 2019
This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Sep 6, 2019
Fix python installation path using 'libdirname' env variable.
This patch is backport of upstream patch [1].

[1] Cantera/cantera#674

This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Closes: #12701
Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
thebitpit pushed a commit to thebitpit/gentoo that referenced this pull request Sep 13, 2019
Fix python installation path using 'libdirname' env variable.
This patch is backport of upstream patch [1].

[1] Cantera/cantera#674

This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Closes: gentoo#12701
Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
thebitpit pushed a commit to thebitpit/gentoo that referenced this pull request Sep 13, 2019
Fix python installation path using 'libdirname' env variable.
This patch is backport of upstream patch [1].

[1] Cantera/cantera#674

This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Closes: gentoo#12701
Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
thebitpit pushed a commit to thebitpit/gentoo that referenced this pull request Sep 14, 2019
Fix python installation path using 'libdirname' env variable.
This patch is backport of upstream patch [1].

[1] Cantera/cantera#674

This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] Cantera/cantera#672

Closes: gentoo#12701
Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
@band-a-prend band-a-prend deleted the sundials branch December 26, 2019 15:38
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.

SUNDIALS 4.1.0 does not work with Cantera 2.4.0
3 participants