Skip to content

Added multifluid_ecs_mutant#102

Merged
ianhbell merged 2 commits into
usnistgov:mainfrom
svenpohl1991:ecs_mutant
Mar 6, 2024
Merged

Added multifluid_ecs_mutant#102
ianhbell merged 2 commits into
usnistgov:mainfrom
svenpohl1991:ecs_mutant

Conversation

@svenpohl1991

Copy link
Copy Markdown
Contributor

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

@ianhbell ianhbell left a comment

Copy link
Copy Markdown
Collaborator

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

Comment thread include/teqp/models/multifluid_ecs_mutant.hpp

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread include/teqp/models/multifluid_ecs_mutant.hpp

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@svenpohl1991 svenpohl1991 requested a review from ianhbell March 5, 2024 08:17

@ianhbell ianhbell left a comment

Copy link
Copy Markdown
Collaborator

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?

Comment thread include/teqp/models/multifluid_ecs_mutant.hpp
namespace teqp {

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

Copy link
Copy Markdown
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

@svenpohl1991 svenpohl1991 requested a review from ianhbell March 6, 2024 13:55

@ianhbell ianhbell left a comment

Copy link
Copy Markdown
Collaborator

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
@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.

2 participants