Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
teqp_fork_old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven Michael Pohl
teqp_fork_old
Commits
c408d388
Commit
c408d388
authored
2 years ago
by
Ian Bell
Browse files
Options
Downloads
Patches
Plain Diff
And this time with a test
parent
71e74225
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tests/catch_test_cubics.cxx
+56
-0
56 additions, 0 deletions
src/tests/catch_test_cubics.cxx
with
56 additions
and
0 deletions
src/tests/catch_test_cubics.cxx
+
56
−
0
View file @
c408d388
...
...
@@ -185,4 +185,60 @@ TEST_CASE("Check manual integration of subcritical VLE isotherm for binary mixtu
double
pfinal
=
J
.
back
().
at
(
"pL / Pa"
).
back
();
CHECK
(
std
::
abs
(
pfinal
/
pfinal_goal
-
1
)
<
1e-5
);
}
}
TEST_CASE
(
"Check infinite dilution of subcritical VLE derivatives"
,
"[cubic][isochoric][infdil]"
)
{
// Values taken from http://dx.doi.org/10.6028/jres.121.011
std
::
valarray
<
double
>
Tc_K
=
{
190.564
,
154.581
},
pc_Pa
=
{
4599200
,
5042800
},
acentric
=
{
0.011
,
0.022
};
auto
model
=
canonical_PR
(
Tc_K
,
pc_Pa
,
acentric
);
const
auto
N
=
Tc_K
.
size
();
using
state_type
=
std
::
valarray
<
double
>
;
REQUIRE
(
N
==
2
);
auto
get_start
=
[
&
](
double
T
,
auto
i
)
{
std
::
valarray
<
double
>
Tc_
(
Tc_K
[
i
],
1
),
pc_
(
pc_Pa
[
i
],
1
),
acentric_
(
acentric
[
i
],
1
);
auto
PR
=
canonical_PR
(
Tc_
,
pc_
,
acentric_
);
auto
[
rhoL
,
rhoV
]
=
PR
.
superanc_rhoLV
(
T
);
state_type
o
(
N
*
2
);
o
[
i
]
=
rhoL
;
o
[
i
+
N
]
=
rhoV
;
return
o
;
};
int
i
=
1
;
double
T
=
120
;
auto
rhostart_dil
=
get_start
(
T
,
i
);
auto
rhostart_notdil
=
rhostart_dil
;
rhostart_notdil
[
1
-
i
]
+=
1e-6
;
rhostart_notdil
[
1
-
i
+
N
]
+=
1e-6
;
SECTION
(
"Along isotherm"
)
{
// Derivative function with respect to p
auto
xprime
=
[
&
](
const
state_type
&
X
)
{
REQUIRE
(
X
.
size
()
%
2
==
0
);
auto
N
=
X
.
size
()
/
2
;
// Memory maps into the state vector for inputs and their derivatives
auto
rhovecL
=
Eigen
::
Map
<
const
Eigen
::
ArrayXd
>
(
&
(
X
[
0
]),
N
);
auto
rhovecV
=
Eigen
::
Map
<
const
Eigen
::
ArrayXd
>
(
&
(
X
[
0
])
+
N
,
N
);
return
get_drhovecdp_Tsat
(
model
,
T
,
rhovecL
,
rhovecV
);
};
auto
dernotdil
=
xprime
(
rhostart_notdil
);
auto
derdil
=
xprime
(
rhostart_dil
);
CHECK
(
true
);
}
SECTION
(
"Along isobar"
)
{
// Derivative function with respect to T
auto
xprime
=
[
&
](
const
state_type
&
X
)
{
REQUIRE
(
X
.
size
()
%
2
==
0
);
auto
N
=
X
.
size
()
/
2
;
// Memory maps into the state vector for inputs and their derivatives
auto
rhovecL
=
Eigen
::
Map
<
const
Eigen
::
ArrayXd
>
(
&
(
X
[
0
]),
N
);
auto
rhovecV
=
Eigen
::
Map
<
const
Eigen
::
ArrayXd
>
(
&
(
X
[
0
])
+
N
,
N
);
return
get_drhovecdT_psat
(
model
,
T
,
rhovecL
.
eval
(),
rhovecV
.
eval
());
};
auto
dernotdil
=
xprime
(
rhostart_notdil
);
auto
derdil
=
xprime
(
rhostart_dil
);
CHECK
(
true
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment