Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Chaofan Chen
ogs
Commits
3d5ffa6e
Verified
Commit
3d5ffa6e
authored
1 year ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
[py] ruff fixes in Tests/Data/Parabolic/T/3D_3BHEs_array.
parent
21cad5d1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py
+22
-24
22 additions, 24 deletions
Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py
Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py
+23
-24
23 additions, 24 deletions
...s/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py
with
45 additions
and
48 deletions
Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py
+
22
−
24
View file @
3d5ffa6e
...
...
@@ -5,19 +5,19 @@
# http://www.opengeosys.org/project/license
###
import
sys
print
(
sys
.
version
)
import
os
import
sys
import
numpy
as
np
from
pandas
import
read_csv
from
tespy.networks
import
load_network
try
:
import
ogs.callbacks
as
OpenGeoSys
except
ModuleNotFoundError
:
import
OpenGeoSys
from
pandas
import
read_csv
from
tespy.networks
import
load_network
print
(
sys
.
version
)
# User setting ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# parameters
...
...
@@ -148,36 +148,34 @@ class BC(OpenGeoSys.BHENetwork):
df
.
loc
[:,
"
flowrate
"
]
=
0
cur_flowrate
=
df
[
"
flowrate
"
].
tolist
()
return
(
True
,
True
,
Tout_val
,
cur_flowrate
)
else
:
# read Tout_val to dataframe
for
i
in
range
(
n_BHE
):
df
.
loc
[
df
.
index
[
i
],
"
Tout_val
"
]
=
Tout_val
[
i
]
# TESPy solver
cur_Tin_val
,
cur_flowrate
=
get_tespy_results
(
t
)
# check norm if network achieves the converge
if_success
=
False
pre_Tin_val
=
Tin_val
norm
=
np
.
linalg
.
norm
(
abs
(
np
.
asarray
(
pre_Tin_val
)
-
np
.
asarray
(
cur_Tin_val
))
)
if
norm
<
10e-6
:
if_success
=
True
# return to OGS
return
(
True
,
if_success
,
cur_Tin_val
,
cur_flowrate
)
# read Tout_val to dataframe
for
i
in
range
(
n_BHE
):
df
.
loc
[
df
.
index
[
i
],
"
Tout_val
"
]
=
Tout_val
[
i
]
# TESPy solver
cur_Tin_val
,
cur_flowrate
=
get_tespy_results
(
t
)
# check norm if network achieves the converge
if_success
=
False
pre_Tin_val
=
Tin_val
norm
=
np
.
linalg
.
norm
(
abs
(
np
.
asarray
(
pre_Tin_val
)
-
np
.
asarray
(
cur_Tin_val
)))
if
norm
<
10e-6
:
if_success
=
True
# return to OGS
return
(
True
,
if_success
,
cur_Tin_val
,
cur_flowrate
)
# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
if
ogs_prj_directory
!=
""
:
os
.
chdir
(
ogs_prj_directory
)
if
ogs_prj_directory
!=
""
:
# noqa: F821
os
.
chdir
(
ogs_prj_directory
)
# noqa: F821
nw
=
load_network
(
"
./pre/tespy_nw
"
)
# set if print the network iteration info
nw
.
set_attr
(
iterinfo
=
False
)
# create bhe dataframe of the network system from bhe_network.csv
df
=
create_dataframe
()
df
=
create_dataframe
()
# noqa: PD901
n_BHE
=
np
.
size
(
df
.
iloc
[:,
0
])
# create local variables of the components label and connections label in
...
...
This diff is collapsed.
Click to expand it.
Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py
+
23
−
24
View file @
3d5ffa6e
...
...
@@ -6,18 +6,19 @@
###
import
sys
print
(
sys
.
version
)
import
os
from
pathlib
import
Path
import
numpy
as
np
from
pandas
import
read_csv
from
tespy.networks
import
load_network
try
:
import
ogs.callbacks
as
OpenGeoSys
except
ModuleNotFoundError
:
import
OpenGeoSys
from
pandas
import
read_csv
from
tespy.networks
import
load_network
print
(
sys
.
version
)
# User setting ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# parameters
...
...
@@ -151,37 +152,35 @@ class BC(OpenGeoSys.BHENetwork):
df
.
loc
[:,
"
flowrate
"
]
=
0
cur_flowrate
=
df
[
"
flowrate
"
].
tolist
()
return
(
True
,
True
,
Tout_val
,
cur_flowrate
)
else
:
# read Tout_val to dataframe
for
i
in
range
(
n_BHE
):
df
.
loc
[
df
.
index
[
i
],
"
Tout_val
"
]
=
Tout_val
[
i
]
# TESPy solver
cur_Tin_val
,
cur_flowrate
=
get_tespy_results
(
t
)
# check norm if network achieves the converge
if_success
=
False
pre_Tin_val
=
Tin_val
norm_dx
=
np
.
linalg
.
norm
(
abs
(
np
.
asarray
(
pre_Tin_val
)
-
np
.
asarray
(
cur_Tin_val
))
)
norm_x
=
np
.
linalg
.
norm
(
np
.
asarray
(
cur_Tin_val
))
if
norm_dx
/
norm_x
<
1e-6
:
if_success
=
True
# return to OGS
return
(
True
,
if_success
,
cur_Tin_val
,
cur_flowrate
)
# read Tout_val to dataframe
for
i
in
range
(
n_BHE
):
df
.
loc
[
df
.
index
[
i
],
"
Tout_val
"
]
=
Tout_val
[
i
]
# TESPy solver
cur_Tin_val
,
cur_flowrate
=
get_tespy_results
(
t
)
# check norm if network achieves the converge
if_success
=
False
pre_Tin_val
=
Tin_val
norm_dx
=
np
.
linalg
.
norm
(
abs
(
np
.
asarray
(
pre_Tin_val
)
-
np
.
asarray
(
cur_Tin_val
)))
norm_x
=
np
.
linalg
.
norm
(
np
.
asarray
(
cur_Tin_val
))
if
norm_dx
/
norm_x
<
1e-6
:
if_success
=
True
# return to OGS
return
(
True
,
if_success
,
cur_Tin_val
,
cur_flowrate
)
# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir
=
os
.
get
cwd
()
project_dir
=
Path
.
cwd
()
print
(
"
Project dir is:
"
,
project_dir
)
nw
=
load_network
(
"
./pre/tespy_nw_closedloop
"
)
# set if print the network iteration info
nw
.
set_attr
(
iterinfo
=
False
)
# create bhe dataframe of the network system from bhe_network.csv
df
=
create_dataframe
()
df
=
create_dataframe
()
# noqa: PD901
n_BHE
=
np
.
size
(
df
.
iloc
[:,
0
])
# create local variables of the components label and connections label in
...
...
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