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

Vinet EOS implemented #202

Merged
merged 34 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b7df57b
Branch for aematts' work.
Nov 28, 2022
ec64f46
First half tested version of Vinet EOS.
Dec 1, 2022
2df39fd
Fully working Vinet EOS with unit tests.
Dec 6, 2022
abb27be
Merge branch 'main' into aemattssing
Dec 6, 2022
d941a13
Documentation added. Took away everything snlgruneisen. Neither eos_b…
Dec 13, 2022
649e0b6
Fixed LaTeX spelling mistakes.
Dec 13, 2022
3b4464b
Hopefully last correction of LaTeX errors in documentation.
Dec 13, 2022
c380fe7
Still correcting LaTeX in documentation.
Dec 13, 2022
151da1a
Merge branch 'main' into aemattssing
aematts Dec 16, 2022
1fcc814
Responded to review comments: Changed while loops to for loops,
Dec 21, 2022
a055997
Merge branch 'main' into aemattssing
Yurlungur Jan 4, 2023
da6fbc5
Merge branch 'main' into aemattssing
Yurlungur Jan 9, 2023
3ccaa68
Merge branch 'main' into aemattssing
Yurlungur Jan 10, 2023
9cf4c01
Merge branch 'main' into aemattssing
aematts Jan 17, 2023
3227c21
Almost final version of Vinet EOS. Still some things to do on error h…
Jan 17, 2023
b1f652a
Merge branch 'main' into aemattssing
aematts Jan 19, 2023
af87cd6
Fixed format and added entry in CHANGELOG.md
Jan 19, 2023
8bed5df
Merge branch 'main' into aemattssing
aematts Jan 27, 2023
bc5542a
Almost done, just an issue with REQUIRE_MAYBE_THROWS.
Feb 3, 2023
be3852e
Merge branch 'main' into aemattssing
Yurlungur Feb 3, 2023
5b102f9
Merge branch 'main' into aemattssing
aematts Feb 10, 2023
6ca8ec2
Fixed one faulty check in test.
Feb 10, 2023
5a5bd42
update ports of call in case it helps
jonahm-LANL Feb 13, 2023
d6c6f50
actually define portability-strategy-none
jonahm-LANL Feb 13, 2023
e848df9
missing include
jonahm-LANL Feb 13, 2023
2bac33a
commented out test for testing test in Vinet Setup section of test code.
Feb 13, 2023
3c0f2fa
fixed format, nothing else.
Feb 13, 2023
77a2bf5
Small final edits.
Feb 13, 2023
f050dde
fix compilation errors on GPUs
jonahm-LANL Feb 13, 2023
63958a9
format
jonahm-LANL Feb 13, 2023
67f2254
Merge branch 'main' into aemattssing
Yurlungur Feb 13, 2023
63a9474
Update singularity-eos/eos/eos_vinet.hpp
Yurlungur Feb 14, 2023
0f405e7
portable fors
jonahm-LANL Feb 14, 2023
b0f3fd1
formatting
jonahm-LANL Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
- [[PR226]](https://github.com/lanl/singularity-eos/pull/226) added entropy interpolation to stellar collapse eos

### Fixed (Repair bugs, etc)
- [[PR228]](https://github.com/lanl/singularity-eos/pull/228) added untracked header files in cmake
- [[PR215]](https://github.com/lanl/singularity-eos/pull/215) and [[PR216]](https://github.com/lanl/singularity-eos/pull/216) fix duplicate definition of EPS and fix CI

### Added (new features/APIs/variables/...)
- [[PR202]](https://github.com/lanl/singularity-eos/pull/202) added the Vinet analytical EOS wth test cases and documentation.
- [[PR226]](https://github.com/lanl/singularity-eos/pull/226) added entropy interpolation to stellar collapse eos
- [[PR209]](https://github.com/lanl/singularity-eos/pull/209) added more documentation around how to contribute to the project and also what a contributor can expect from the core team
- [[PR214]](https://github.com/lanl/singularity-eos/pull/214) added documentation about adding a new EOS

Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ if(SINGULARITY_USE_KOKKOS)
message(WARNING "`Kokkos` version could not be inferred. Note that versions less than `3.3` are DEPRECATED and may not work properly.")
endif() #Kokkos_VERSION_MAJOR
####
else()
set(PORTABILITY_STRATEGY "None")
list(APPEND SINGULARITY_PUBLIC_DEFINES PORTABILITY_STRATEGY_NONE)
endif() #SINGULARITY_USE_KOKKOS
message(STATUS "Portability strategy set to ${PORTABILITY_STRATEGY}")

# TODO(JMM): If linear algebra needs grow beyond mixed cell closures,
# we may need to rename this variable.
Expand Down
72 changes: 72 additions & 0 deletions doc/sphinx/src/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,78 @@ There is an overload of the ``Gruneisen`` class which computes
Gruneisen(const Real C0, const Real s1, const Real s2, const Real s3, const Real G0,
const Real b, const Real rho0, const Real T0, const Real P0, const Real Cv)

Extender Vinet EOS
aematts marked this conversation as resolved.
Show resolved Hide resolved
``````````````````

The extended Vinet EOS is a full EOS, extended in both temperature and density from the Vinet
universal EOS for solids (also called Rose cold curve). It is expected to work well in
compression but is untested in expansion. It is published in Appendix 2
in `J. Appl. Phys. 119, 015904 (2016)`_.

.. _J. Appl. Phys. 119, 015904 (2016): https://doi.org/10.1063/1.4939675

While the Mie-Gruneisen EOS is based on a Hugoniot as reference curve, the Vinet is based on an isotherm:

.. math::

P(\rho,T) = P_{ref}(\rho) + \alpha_0 B_0 (T - T_{ref})

where the reference isotherm is

.. math::

P_{ref}(X)&=\frac{3 B_0}{X^2} Z \exp[\eta_0 Z] \left( 1 + \sum_{n=2}^N d_n Z^n \right) \, , \\
X &= \left( \frac{\rho_0}{\rho} \right)^{1/3} \\
Z &= 1-X

Note that :math:`P_{ref}=0` when :math:`\rho = \rho_0`, the reference state on the reference
isotherm is always at ambient pressure. However, the reference isotherm is not necessarily
at room temperature.

It can be shown that :math:`B_0` is the isothermal bulk modulus, and :math:`\alpha_0` the
thermal expansion coefficient, at the reference state, and that

.. math::

\eta_0 = \frac{3}{2}\left[ \left[ \frac{\partial B}{\partial P}\right]_0 -1\right] \, .

By assuming that also the constant volume heat capacity is a constant, :math:`{C_V}_0`, an entropy
can be derived

.. math::

S(V,T) = S_0 + \alpha_0 B_0 (V - V_0) + {C_V}_0 \ln \frac{T}{T_{ref}}

and from that a thermodynamic consistent energy

.. math::

E(X,T) =& 9 \frac{B_0 V_0}{{\eta_0}^2}\left(f_0 - \exp[\eta_0 Z] \left(f_0 - \eta_0 Z \left(f_0 + \sum_{n=1}^N f_n Z^n \right)\right)\right) \\
& - \alpha_0 B_0 V_0 (1-X^3) T_{ref} + {C_V}_0 (T - T_{ref}) + E_0

where the energy coefficients :math:`f_n` are determined from the pressure coefficients :math:`d_n`, :math:`n\geq 2`, by

.. math::

f_N &= d_N \\
f_n &= d_n - \frac{n+2}{\eta_0} f_{n+1} \\
d_0 &= 1.0 \\
d_1 &= 0.0


The constructor for the ``Vinet`` EOS has the signature

.. code-block:: cpp

Vinet(const Real rho0, const Real T0, const Real B0, const Real BP0, const Real A0,
const Real Cv0, const Real E0, const Real S0, const Real *expconsts)

where ``rho0`` is :math:`\rho_0`, ``T0`` is :math:`T_{ref}`, ``B0`` is
:math:`B_0`, ``BP0`` is :math:`(\partial B/\partial P)_0`, ``A0`` is :math:`\alpha_0`,
``Cv0`` is :math:`{C_V}_0`, ``E0`` is :math:`E_0`, ``S0`` is :math:`S_0`, and
``expconsts`` is a pointer to the constant array of length 39 containing the expansion coefficients
:math:`d_2` to :math:`d_{40}`. Expansion coefficients not used should be set to 0.0.

JWL EOS
````````

Expand Down
1 change: 1 addition & 0 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set(EOS_HEADERS
eos/eos_spiner.hpp
eos/eos_davis.hpp
eos/eos_gruneisen.hpp
eos/eos_vinet.hpp
eos/eos_builder.hpp
eos/eos_jwl.hpp
eos/modifiers/relativistic_eos.hpp
Expand Down
3 changes: 2 additions & 1 deletion singularity-eos/eos/eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <singularity-eos/eos/eos_jwl.hpp>
#include <singularity-eos/eos/eos_spiner.hpp>
#include <singularity-eos/eos/eos_stellar_collapse.hpp>
#include <singularity-eos/eos/eos_vinet.hpp>

// Modifiers
#include <singularity-eos/eos/modifiers/eos_unitsystem.hpp>
Expand All @@ -62,7 +63,7 @@ using singularity::detail::transform_variadic_list;

// all eos's
static constexpr const auto full_eos_list =
tl<IdealGas, Gruneisen, JWL, DavisReactants, DavisProducts
tl<IdealGas, Gruneisen, Vinet, JWL, DavisReactants, DavisProducts
#ifdef SPINER_USE_HDF
,
SpinerEOSDependsRhoT, SpinerEOSDependsRhoSie, StellarCollapse
Expand Down
12 changes: 12 additions & 0 deletions singularity-eos/eos/eos_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ EOS EOSBuilder::buildEOS(EOSBuilder::EOSType type, EOSBuilder::params_t base_par
Real Cv = mpark::get<Real>(base_params["Cv"]);
return Gruneisen(C0, s1, s2, s3, G0, b, rho0, T0, P0, Cv);
}
// if (type == EOSType::Vinet) {
// Real rho0 = mpark::get<Real>(base_params["rho0"]);
// Real T0 = mpark::get<Real>(base_params["T0"]);
// Real B0 = mpark::get<Real>(base_params["B0"]);
// Real BP0 = mpark::get<Real>(base_params["BP0"]);
// Real A0 = mpark::get<Real>(base_params["A0"]);
// Real Cv0 = mpark::get<Real>(base_params["Cv0"]);
// Real E0 = mpark::get<Real>(base_params["E0"]);
// Real S0 = mpark::get<Real>(base_params["S0"]);
// Real d2to40 = mpark::get<Real>(base_params["d2to40"]);
// return Vinet(rho0, T0, B0, BP0, A0, Cv0, E0, S0, d2to40);
// }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding the comment no need to worry about this though. At least for now. We don't have to hook it into EOS builder.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove the code if it's not being included?

if (type == EOSType::JWL) {
GETBASE(Real, A); // I got tired of writing this over and over
GETBASE(Real, B);
Expand Down
1 change: 1 addition & 0 deletions singularity-eos/eos/eos_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace EOSBuilder {
enum class EOSType {
IdealGas,
Gruneisen,
// Vinet,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove the commented out code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's fine to leave or fine to remove. Slightly better to remove, but I consider this non-blocking.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My preference is, assuming it stays, to put a // TODO: or some such comment that provides context to the commented out code. My preference is also for removal. I'm inclined to block if left in its current state (either remove or add context comment).

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok let's just remove the commented out code then

JWL,
DavisReactants,
DavisProducts
Expand Down
Loading