Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
MostafaMollaali
dynamic
Commits
98af01aa
Commit
98af01aa
authored
6 years ago
by
Chaofan Chen
Browse files
Options
Downloads
Patches
Plain Diff
Using existed function to get value from map or output error message.
parent
a4394d4b
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
ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
+11
-22
11 additions, 22 deletions
.../HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
with
11 additions
and
22 deletions
ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
+
11
−
22
View file @
98af01aa
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
"BaseLib/ConfigTree.h"
#include
"BaseLib/ConfigTree.h"
#include
"BaseLib/Error.h"
#include
"BaseLib/Error.h"
#include
"BaseLib/Algorithm.h"
#include
"CreateFlowAndTemperatureControl.h"
#include
"CreateFlowAndTemperatureControl.h"
#include
"RefrigerantProperties.h"
#include
"RefrigerantProperties.h"
...
@@ -28,20 +29,6 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
...
@@ -28,20 +29,6 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
curves
,
curves
,
RefrigerantProperties
const
&
refrigerant
)
RefrigerantProperties
const
&
refrigerant
)
{
{
auto
find_curve_or_error
=
[
&
](
std
::
string
const
&
name
,
std
::
string
const
&
error_message
)
->
MathLib
::
PiecewiseLinearInterpolation
const
&
{
auto
const
it
=
curves
.
find
(
name
);
if
(
it
==
curves
.
end
())
{
ERR
(
error_message
.
c_str
());
OGS_FATAL
(
"Curve with name '%s' could not be found in the curves list."
,
name
.
c_str
());
}
return
*
it
->
second
;
};
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__type}
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__type}
auto
const
type
=
config
.
getConfigParameter
<
std
::
string
>
(
"type"
);
auto
const
type
=
config
.
getConfigParameter
<
std
::
string
>
(
"type"
);
if
(
type
==
"TemperatureCurveConstantFlow"
)
if
(
type
==
"TemperatureCurveConstantFlow"
)
...
@@ -49,10 +36,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
...
@@ -49,10 +36,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__flow_rate}
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__flow_rate}
double
const
flow_rate
=
config
.
getConfigParameter
<
double
>
(
"flow_rate"
);
double
const
flow_rate
=
config
.
getConfigParameter
<
double
>
(
"flow_rate"
);
auto
const
&
temperature_curve
=
find_curve_or_error
(
auto
const
&
temperature_curve
=
*
BaseLib
::
getOrError
(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__temperature_curve}
curves
,
config
.
getConfigParameter
<
std
::
string
>
(
"temperature_curve"
),
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__temperature_curve}
"Required temperature curve not found."
);
config
.
getConfigParameter
<
std
::
string
>
(
"temperature_curve"
),
"Required temperature curve not found."
);
return
TemperatureCurveConstantFlow
{
flow_rate
,
temperature_curve
};
return
TemperatureCurveConstantFlow
{
flow_rate
,
temperature_curve
};
}
}
...
@@ -70,10 +58,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
...
@@ -70,10 +58,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
if
(
type
==
"FixedPowerFlowCurve"
)
if
(
type
==
"FixedPowerFlowCurve"
)
{
{
auto
const
&
flow_rate_curve
=
find_curve_or_error
(
auto
const
&
flow_rate_curve
=
*
BaseLib
::
getOrError
(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__flow_rate_curve}
curves
,
config
.
getConfigParameter
<
std
::
string
>
(
"flow_rate_curve"
),
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__flow_rate_curve}
"Required flow rate curve not found."
);
config
.
getConfigParameter
<
std
::
string
>
(
"flow_rate_curve"
),
"Required flow rate curve not found."
);
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__power}
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__power}
double
const
power
=
config
.
getConfigParameter
<
double
>
(
"power"
);
double
const
power
=
config
.
getConfigParameter
<
double
>
(
"power"
);
...
...
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