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

Added multifluid_ecs_mutant #102

Merged
merged 2 commits into from
Mar 6, 2024
Merged

Conversation

svenpohl1991
Copy link
Contributor

Added a polynomial based extended corresponding states mixture model.
So far its working only for binary mixtures.

Copy link
Collaborator

@ianhbell ianhbell left a comment

Choose a reason for hiding this comment

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

I think the unit conversions cancel out, right? So please remove them. Otherwise, I think it looks fine after the comments are resolved.

One last thing I noticed: please add at least one test to the catch tests as an integration test so we can catch any memory issues if present

include/teqp/models/multifluid_ecs_mutant.hpp Show resolved Hide resolved

auto tc_func = pow(molefraction[0], 2.0) * Tc[0] + pow(molefraction[1], 2.0) * Tc[1] + 2.0 * molefraction[0] * molefraction[1] * \
(p00 + p10 * delta + p01 * tau + p20 * delta * delta + p02 * tau * tau + p11 * delta * tau) * tc_scale;
return forceeval(tc_func);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix indentation

auto tau = tc_scale / temperature;
auto delta = density / dc_scale;

auto vc_ = pow(molefraction[0], 2.0) * vc[0] * 1E3 + pow(molefraction[1], 2.0) * vc[1] * 1E3 + 2.0 * molefraction[0] * molefraction[1] * \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these unit conversions in here? teqp is supposed to operate with base SI unless specified explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its an intern reduction for the polynomial to avoid high coefficients, the numver also could be a fixed thing, but I picked the critical constants.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I stick with my original idea: stick with base SI everywhere, one less things to get confused by. The coefficients can be whatever; does it really make a difference if the degree of the polynomials is relatively small?


public:

Eigen::ArrayXd Tc, vc;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some doxygen docs here on what is in Tc and vc would be nice

include/teqp/models/multifluid_ecs_mutant.hpp Show resolved Hide resolved

auto vc_ = pow(molefraction[0], 2.0) * vc[0] * 1E3 + pow(molefraction[1], 2.0) * vc[1] * 1E3 + 2.0 * molefraction[0] * molefraction[1] * \
(p00 + p10 * delta + p01 * tau + p20 * delta * delta + p02 * tau * tau + p11 * delta * tau) * vc_scale * 1E3;
auto dc_func = 1E3 * (1.0 / vc_);
Copy link
Collaborator

Choose a reason for hiding this comment

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

again unit conversion, please use base SI

auto p11 = dr_coeffs(4, 0) + molefraction[0] * dr_coeffs(4, 1) + molefraction[0] * molefraction[0] * dr_coeffs(4, 2);
auto p02 = dr_coeffs(5, 0) + molefraction[0] * dr_coeffs(5, 1) + molefraction[0] * molefraction[0] * dr_coeffs(5, 2);
auto dc_scale = 1.0/(0.125* pow( pow(vc[0],1.0/3.0) + pow(vc[1],1.0/3.0),3.0));
auto vc_scale = (0.125 * pow(pow(vc[0], 1.0 / 3.0) + pow(vc[1], 1.0 / 3.0), 3.0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this not 1/dc_scale?

auto tau = tc_scale / temperature;
auto delta = density / dc_scale;

auto vc_ = pow(molefraction[0], 2.0) * vc[0] * 1E3 + pow(molefraction[1], 2.0) * vc[1] * 1E3 + 2.0 * molefraction[0] * molefraction[1] * \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I stick with my original idea: stick with base SI everywhere, one less things to get confused by. The coefficients can be whatever; does it really make a difference if the degree of the polynomials is relatively small?

Copy link
Collaborator

@ianhbell ianhbell left a comment

Choose a reason for hiding this comment

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

Looking much better. Are you ready to merge from your side?

include/teqp/models/multifluid_ecs_mutant.hpp Show resolved Hide resolved
namespace teqp {

/*!
Implementation of the polynomial extended corresponding states (pECS) mixture model \n
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will do - I will tidy it up after I merge

Copy link
Collaborator

@ianhbell ianhbell left a comment

Choose a reason for hiding this comment

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

I think this looks good to me. If there are other issues identified afterwards (like a missing forceeval), I will open an issue

@ianhbell ianhbell merged commit 5edf503 into usnistgov:main Mar 6, 2024
5 checks passed
@ianhbell ianhbell added this to the 0.19 milestone Mar 6, 2024
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