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
f9af76e8
Commit
f9af76e8
authored
3 years ago
by
Ian Bell
Browse files
Options
Downloads
Patches
Plain Diff
Nicer timing with fug. coeff.
parent
35bdef79
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/time_fugcoeff.cpp
+18
-7
18 additions, 7 deletions
src/time_fugcoeff.cpp
with
18 additions
and
7 deletions
src/time_fugcoeff.cpp
+
18
−
7
View file @
f9af76e8
...
@@ -28,10 +28,12 @@ int main()
...
@@ -28,10 +28,12 @@ int main()
bool
loaded_REFPROP
=
load_REFPROP
(
err
,
path
,
DLL_name
);
bool
loaded_REFPROP
=
load_REFPROP
(
err
,
path
,
DLL_name
);
printf
(
"Loaded refprop: %s @ address %zu
\n
"
,
loaded_REFPROP
?
"true"
:
"false"
,
REFPROP_address
());
printf
(
"Loaded refprop: %s @ address %zu
\n
"
,
loaded_REFPROP
?
"true"
:
"false"
,
REFPROP_address
());
if
(
!
loaded_REFPROP
)
{
return
EXIT_FAILURE
;
}
if
(
!
loaded_REFPROP
)
{
return
EXIT_FAILURE
;
}
SETPATHdll
(
const_cast
<
char
*>
(
path
.
c_str
()),
400
);
char
hpath
[
256
]
=
" "
;
strcpy
(
hpath
,
const_cast
<
char
*>
(
path
.
c_str
()));
SETPATHdll
(
hpath
,
255
);
int
ierr
=
0
,
nc
=
1
;
int
ierr
=
0
,
nc
=
1
;
char
herr
[
25
5
],
hfld
[
1000
0
]
=
"PROPANE"
,
hhmx
[
25
5
]
=
"HMX.BNC"
,
href
[
4
]
=
"DEF"
;
char
herr
[
25
6
],
hfld
[
1000
1
]
=
"PROPANE"
,
hhmx
[
25
6
]
=
"HMX.BNC"
,
href
[
4
]
=
"DEF"
;
SETUPdll
(
nc
,
hfld
,
hhmx
,
href
,
ierr
,
herr
,
10000
,
255
,
3
,
255
);
SETUPdll
(
nc
,
hfld
,
hhmx
,
href
,
ierr
,
herr
,
10000
,
255
,
3
,
255
);
if
(
ierr
!=
0
)
{
if
(
ierr
!=
0
)
{
printf
(
"This ierr: %d herr: %s
\n
"
,
ierr
,
herr
);
printf
(
"This ierr: %d herr: %s
\n
"
,
ierr
,
herr
);
...
@@ -45,6 +47,8 @@ int main()
...
@@ -45,6 +47,8 @@ int main()
//std::cout << kFlag << std::endl;
//std::cout << kFlag << std::endl;
}
}
nlohmann
::
json
outputs
=
nlohmann
::
json
::
array
();
double
T
=
300
,
D_moldm3
=
30
,
D_molm3
=
D_moldm3
*
1e3
;
double
T
=
300
,
D_moldm3
=
30
,
D_molm3
=
D_moldm3
*
1e3
;
int
N
=
100000
;
int
N
=
100000
;
std
::
vector
<
std
::
string
>
component_list
=
{
"Methane"
,
"Ethane"
,
"n-Propane"
,
"n-Butane"
,
"n-Pentane"
,
"n-Hexane"
};
std
::
vector
<
std
::
string
>
component_list
=
{
"Methane"
,
"Ethane"
,
"n-Propane"
,
"n-Butane"
,
"n-Pentane"
,
"n-Hexane"
};
...
@@ -52,12 +56,12 @@ int main()
...
@@ -52,12 +56,12 @@ int main()
for
(
int
Ncomp
:
{
1
,
2
,
3
,
4
,
5
,
6
})
{
for
(
int
Ncomp
:
{
1
,
2
,
3
,
4
,
5
,
6
})
{
std
::
vector
<
std
::
string
>
fluid_set
(
component_list
.
begin
(),
component_list
.
begin
()
+
Ncomp
);
std
::
vector
<
std
::
string
>
fluid_set
(
component_list
.
begin
(),
component_list
.
begin
()
+
Ncomp
);
auto
one_teqp
=
[
&
]()
{
{
// teqp!!
// teqp!!
auto
model
=
build_multifluid_model
(
fluid_set
,
"../mycp"
,
"../mycp/dev/mixtures/mixture_binary_pairs.json"
);
auto
model
=
build_multifluid_model
(
fluid_set
,
"../mycp"
,
"../mycp/dev/mixtures/mixture_binary_pairs.json"
);
using
id
=
IsochoricDerivatives
<
decltype
(
model
),
double
>
;
using
id
=
IsochoricDerivatives
<
decltype
(
model
),
double
>
;
auto
rhovec
=
D_molm3
*
Eigen
::
ArrayXd
::
Ones
(
Ncomp
)
/
Ncomp
;
auto
rhovec
=
(
D_molm3
*
Eigen
::
ArrayXd
::
Ones
(
Ncomp
)
/
Ncomp
).
eval
()
;
auto
tic
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
tic
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
usummer
=
0.0
;
double
usummer
=
0.0
;
for
(
auto
j
=
0
;
j
<
N
;
++
j
)
{
for
(
auto
j
=
0
;
j
<
N
;
++
j
)
{
...
@@ -67,8 +71,9 @@ int main()
...
@@ -67,8 +71,9 @@ int main()
auto
toc
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
toc
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
elap_us
=
std
::
chrono
::
duration
<
double
>
(
toc
-
tic
).
count
()
/
N
*
1e6
;
double
elap_us
=
std
::
chrono
::
duration
<
double
>
(
toc
-
tic
).
count
()
/
N
*
1e6
;
std
::
cout
<<
elap_us
<<
" us/call for fugacity coefficient w/ "
<<
Ncomp
<<
" component(s) with value "
<<
usummer
<<
std
::
endl
;
std
::
cout
<<
elap_us
<<
" us/call for fugacity coefficient w/ "
<<
Ncomp
<<
" component(s) with value "
<<
usummer
<<
std
::
endl
;
}
return
nlohmann
::
json
{
{
"val"
,
usummer
},{
"time"
,
elap_us
},{
"model"
,
"teqp"
},
{
"Ncomp"
,
Ncomp
}
};
{
};
auto
one_REFPROP
=
[
&
](){
// REFPROP!
// REFPROP!
// Initialize the model
// Initialize the model
...
@@ -94,8 +99,14 @@ int main()
...
@@ -94,8 +99,14 @@ int main()
auto
toc
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
toc
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
elap_us
=
std
::
chrono
::
duration
<
double
>
(
toc
-
tic
).
count
()
/
N
*
1e6
;
double
elap_us
=
std
::
chrono
::
duration
<
double
>
(
toc
-
tic
).
count
()
/
N
*
1e6
;
std
::
cout
<<
elap_us
<<
" us/call for FUGCOF w/ "
<<
Ncomp
<<
" component(s) with value "
<<
usummer
<<
std
::
endl
;
std
::
cout
<<
elap_us
<<
" us/call for FUGCOF w/ "
<<
Ncomp
<<
" component(s) with value "
<<
usummer
<<
std
::
endl
;
}
return
nlohmann
::
json
{
{
"val"
,
usummer
},{
"time"
,
elap_us
},{
"model"
,
"REFPROP"
},
{
"Ncomp"
,
Ncomp
}
};
};
outputs
.
push_back
(
one_teqp
());
outputs
.
push_back
(
one_REFPROP
());
}
}
std
::
ofstream
file
(
"fugcoeff_timings.json"
);
file
<<
outputs
;
}
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
\ 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