-
Notifications
You must be signed in to change notification settings - Fork 179
Add Modelica Tough coupling user guide #3696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JayHuLBL
wants to merge
96
commits into
master
Choose a base branch
from
issue1495_clean_Mo2To_Interface
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
aedf419
added coupling files
JayHuLBL f056e4c
corrected comments
JayHuLBL c086363
creating the dummy code
JayHuLBL 8ac10d6
adding user guide
JayHuLBL ee88d9f
merged master
JayHuLBL 722f65c
updated python code comments
JayHuLBL 1a7f512
updated SI units
JayHuLBL 7c8c720
created tough avatot
JayHuLBL 1b92a77
updated modelica-tough user guide
JayHuLBL 2f80ca5
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 2bf3b3a
added toughTemp folder
JayHuLBL 3b82fa8
dummy commit
JayHuLBL 8f71638
converting Fortran script to python
JayHuLBL 4f5090f
converting fortran code
JayHuLBL a295afc
converting script
JayHuLBL ec2a088
converted Fortran functinality to python
JayHuLBL 55b65a9
dummy commit
JayHuLBL 3322640
changed the data format to fortran style
JayHuLBL a65d87c
corrected data format, so have the right results
JayHuLBL 3d793e1
Updated user guide for TOUGH coupling
EttoreZ e8fa41b
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL f700977
cleaned the documentation
JayHuLBL c9da375
added the toughTemp
JayHuLBL 3bd73f8
used the tough avatar code, updated reference
JayHuLBL 52b7601
updated revision note
JayHuLBL cb09d53
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL f50d995
added release note
JayHuLBL 041bec9
updated flow chart figure
JayHuLBL 17a54f1
added to the exclusion list
JayHuLBL d8e7e38
added toughTemp folder
JayHuLBL 0015cf2
avoided delete the Dummy file
JayHuLBL 70db3f3
deleted not used files
JayHuLBL 048b8ed
sorted configuration file conf.yml
JayHuLBL 5b578e7
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 7e66505
increased the time out time
JayHuLBL 626cb06
merged master
JayHuLBL fe42068
temporary disabled other tests
JayHuLBL dcb2bb6
merged master
JayHuLBL 4b6f924
merged master
JayHuLBL 41c873a
removed obsolete text [ci skip]
JayHuLBL 20de026
Update TOUGH co-simulation script
EttoreZ f962393
merged master
JayHuLBL b3da830
updated reference
JayHuLBL 3cfaace
added model to exclude optimica CI test
JayHuLBL b2d89b2
enabled all ci tests
JayHuLBL b959c9a
improved documentation
JayHuLBL 9d3aacb
corrected typo, added reference
JayHuLBL 06948ef
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 92d2caa
merged master
JayHuLBL 4de65cf
improving tutorial
JayHuLBL 9e2beb7
merged master
JayHuLBL f15c2fd
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL cfb271a
refining guide [ci skip]
JayHuLBL c1a5464
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 375d688
fixed typo
JayHuLBL 17485ad
improved documentation
JayHuLBL 60826d3
Started revising the user guide. Renamed files [ci skip]
mwetter b233e0f
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL fd061c0
Merge branch 'issue1495_clean_Mo2To_Interface' of https://github.com/…
JayHuLBL 99b0521
debuging the example models
JayHuLBL c6364a7
merged master [ci skip]
JayHuLBL 3337a9e
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 9de5ff7
debugging python
JayHuLBL cddc362
updated reference [ci skip]
JayHuLBL a89688d
improved the python code so the TOUGH working folder in system temp f…
JayHuLBL 8d5dd51
updated python code comments
JayHuLBL b6d5f48
added number of modelica segment and the interested observation points
JayHuLBL bda3509
added number of TOUGH grids, bore length as python input
JayHuLBL 63afc77
addressing comments
JayHuLBL b042f80
renamed the package
JayHuLBL 474e87b
corrected wrong syntax
JayHuLBL 0bf0c5a
corrected OME error
JayHuLBL 1807ae7
deleted binary
JayHuLBL e2593df
renamed the image folder
JayHuLBL d2f22b0
cleaned up the user guide and documentation
JayHuLBL a901146
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL bc3a5b5
renamed class
JayHuLBL 9040e80
updated guide and improved dummy code
JayHuLBL 763b9c1
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 50f6598
fixed text color annotation
JayHuLBL 8c85d40
changed display variables
JayHuLBL dcd7748
fixed typo
JayHuLBL 5a5373b
increased the timeout
JayHuLBL 66d5911
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL 6718860
changed working folder permission
JayHuLBL b5726d0
updated BESTEST references
JayHuLBL fa04c74
reverted the accidently changed references
JayHuLBL ea075b4
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL cf28559
merged master and updated to use Python3.12
JayHuLBL fc02408
merged master and updated to use Python3.12
JayHuLBL 5d1c541
Merge branch 'master' into issue1495_clean_Mo2To_Interface
JayHuLBL c495dd7
test commit, to check if creating temp folder causing CI test error
JayHuLBL 33ffdd5
testing add folder removing in the mos
JayHuLBL fa1c193
updated comment
JayHuLBL e3485d1
reverted changes
JayHuLBL ed4ea29
improved comments
JayHuLBL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
162 changes: 162 additions & 0 deletions
162
Buildings/Fluid/Geothermal/Borefields/TOUGH/BaseClasses/GroundResponse.mo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| within Buildings.Fluid.Geothermal.Borefields.TOUGH.BaseClasses; | ||
| model GroundResponse "Ground response calculated by the TOUGH simulator" | ||
|
|
||
| parameter Modelica.Units.SI.Height hBor "Total height of the borehole"; | ||
| parameter Integer nSeg "Total number of segments"; | ||
| parameter Integer nInt "Number of points in the ground to be investigated"; | ||
| parameter Integer nTouSeg "Total number of grids along the entire borehole in the TOUGH mesh"; | ||
| parameter Modelica.Units.SI.Time samplePeriod "Sample period of component" | ||
| annotation(Dialog(group="Sampling")); | ||
|
|
||
| Modelica.Blocks.Interfaces.RealInput QBor_flow[nSeg]( | ||
| final unit=fill("W", nSeg)) | ||
| "Heat flow from boreholes (positive if heat from fluid into soil)" | ||
| annotation (Placement(transformation(extent={{-140,20},{-100,60}}), | ||
| iconTransformation(extent={{-120,50},{-100,70}}))); | ||
| Modelica.Blocks.Interfaces.RealInput TBorWal_start[nSeg]( | ||
| final unit=fill("K", nSeg), | ||
| displayUnit=fill("degC", nSeg), | ||
| quantity=fill("ThermodynamicTemperature", nSeg)) | ||
| "Initial borehole outer wall temperature at the begining of the simulation" | ||
| annotation (Placement(transformation(extent={{-140,-20},{-100,20}}), | ||
| iconTransformation(extent={{-120,-10},{-100,10}}))); | ||
| Modelica.Blocks.Interfaces.RealInput TOut( | ||
| final unit="K", | ||
| displayUnit="degC", | ||
| quantity="ThermodynamicTemperature") | ||
| "Outdoor air temperature" | ||
| annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}), | ||
| iconTransformation(extent={{-120,-70},{-100,-50}}))); | ||
| Modelica.Blocks.Interfaces.RealOutput TBorWal[nSeg]( | ||
| final unit=fill("K", nSeg), | ||
| displayUnit=fill("degC", nSeg), | ||
| quantity=fill("ThermodynamicTemperature", nSeg)) | ||
| "Temperature of current borehole wall temperature" | ||
| annotation (Placement(transformation(extent={{100,40},{140,80}}), | ||
| iconTransformation(extent={{100,50},{120,70}}))); | ||
| Modelica.Blocks.Interfaces.RealOutput pInt[nInt] | ||
| "Pressure of the interested points in the ground" | ||
| annotation (Placement(transformation(extent={{100,0},{140,40}}), | ||
| iconTransformation(extent={{100,10},{120,30}}))); | ||
| Modelica.Blocks.Interfaces.RealOutput xInt[nInt] | ||
| "Satuation of the interested points in the ground" | ||
| annotation (Placement(transformation(extent={{100,-40},{140,0}}), | ||
| iconTransformation(extent={{100,-30},{120,-10}}))); | ||
| Modelica.Blocks.Interfaces.RealOutput TInt[nInt]( | ||
| final unit=fill("K", nInt), | ||
| displayUnit=fill("degC", nInt), | ||
| quantity=fill("ThermodynamicTemperature", nInt)) | ||
| "Temperature at the interested points in the ground" | ||
| annotation (Placement(transformation(extent={{100,-80},{140,-40}}), | ||
| iconTransformation(extent={{100,-70},{120,-50}}))); | ||
|
|
||
| Buildings.Utilities.IO.Python_3_12.Real_Real pyt( | ||
| final moduleName="GroundResponse", | ||
| final functionName="doStep", | ||
| final nDblRea=nSeg+3*nInt, | ||
| final nDblWri=2*nSeg + 6, | ||
| final samplePeriod=samplePeriod, | ||
| final flag=0, | ||
| final passPythonObject=true) | ||
| "Python interface model to call TOUGH simulator" | ||
| annotation (Placement(transformation(extent={{40,-10},{60,10}}))); | ||
| Modelica.Blocks.Routing.Multiplex mul( | ||
| final n=2*nSeg + 6) | ||
| "Multiplex" | ||
| annotation (Placement(transformation(extent={{0,-10},{20,10}}))); | ||
| Modelica.Blocks.Sources.ContinuousClock clock | ||
| "Current time" | ||
| annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}))); | ||
| Buildings.Controls.OBC.CDL.Reals.Sources.Constant griNum[3]( | ||
| final k={nSeg,nTouSeg,nInt}) "Total number of grids" | ||
| annotation (Placement(transformation(extent={{-80,60},{-60,80}}))); | ||
| Buildings.Controls.OBC.CDL.Reals.Sources.Constant borHei(final k=hBor) | ||
| "Total height of the borehole" | ||
| annotation (Placement(transformation(extent={{-40,-90},{-20,-70}}))); | ||
|
|
||
| equation | ||
| // Delete the TOUGH temporary working folder | ||
| // Note that the working folder path is specified in the Python function. | ||
| when {terminal()} then | ||
| Modelica.Utilities.Files.remove("Resources/Python-Sources/tmp-tou-work"); | ||
| end when; | ||
|
|
||
| connect(pyt.yR[1:nSeg], TBorWal) | ||
| annotation (Line(points={{61,0},{80,0},{80,60},{120,60}}, color={0,0,127})); | ||
| connect(mul.y, pyt.uR) | ||
| annotation (Line(points={{21,0},{38,0}},color={0,0,127})); | ||
| connect(pyt.yR[nSeg + 1:nSeg + nInt], pInt) annotation (Line(points={{61,0},{80, | ||
| 0},{80,20},{120,20}}, color={0,0,127})); | ||
| connect(pyt.yR[nSeg+nInt+1:nSeg+2*nInt], xInt) | ||
| annotation (Line(points={{61,0},{80,0},{80,-20},{120,-20}}, color={0,0,127})); | ||
| connect(pyt.yR[nSeg+2*nInt+1:nSeg+3*nInt], TInt) | ||
| annotation (Line(points={{61,0},{80,0},{80,-60},{120,-60}}, color={0,0,127})); | ||
| connect(griNum.y, mul.u[1:3]) annotation (Line(points={{-58,70},{-30,70},{-30, | ||
| 0},{0,0}}, color={0,0,127})); | ||
| connect(QBor_flow, mul.u[4:nSeg+3]) annotation (Line(points={{-120,40},{-40,40}, | ||
| {-40,0},{0,0}}, color={0,0,127})); | ||
| connect(TBorWal_start, mul.u[nSeg+4:2*nSeg+3]) annotation (Line(points={{-120,0}, | ||
| {0,0}}, color={0,0,127})); | ||
| connect(TOut, mul.u[2*nSeg+4]) annotation (Line(points={{-120,-40},{-40,-40},{ | ||
| -40,0},{0,0}}, color={0,0,127})); | ||
| connect(clock.y, mul.u[2*nSeg+5]) annotation (Line(points={{-59,-60},{-30,-60}, | ||
| {-30,0},{0,0}}, color={0,0,127})); | ||
| connect(borHei.y, mul.u[2*nSeg+6]) annotation (Line(points={{-18,-80},{-10,-80}, | ||
| {-10,0},{0,0}}, color={0,0,127})); | ||
|
|
||
| annotation (defaultComponentName="toughRes", | ||
| Icon(coordinateSystem(preserveAspectRatio=false), graphics={ | ||
| Rectangle( | ||
| extent={{-100,100},{100,-100}}, | ||
| lineColor={0,0,0}, | ||
| fillColor={255,255,255}, | ||
| fillPattern=FillPattern.Solid), | ||
| Rectangle( | ||
| extent={{-100,30},{100,-100}}, | ||
| lineColor={0,0,0}, | ||
| fillColor={127,127,0}, | ||
| fillPattern=FillPattern.Solid), | ||
| Rectangle( | ||
| extent={{-52,30},{-94,-100}}, | ||
| lineColor={0,0,0}, | ||
| fillColor={135,135,135}, | ||
| fillPattern=FillPattern.Solid), | ||
| Line( | ||
| points={{-66,-4},{72,-4}}, | ||
| color={255,0,0}, | ||
| arrow={Arrow.None,Arrow.Filled}), | ||
| Rectangle( | ||
| extent={{-100,30},{-94,-100}}, | ||
| lineColor={0,0,0}, | ||
| fillColor={0,128,255}, | ||
| fillPattern=FillPattern.Solid), | ||
| Text( | ||
| extent={{-150,150},{150,110}}, | ||
| textString="%name", | ||
| textColor={0,0,255})}), Diagram(coordinateSystem(preserveAspectRatio= | ||
| false)), | ||
| Documentation(info="<html> | ||
| <p> | ||
| This model calculates the ground temperature response to obtain the temperature | ||
| at the borehole wall in a geothermal system where heat is being injected into or | ||
| extracted from the ground. | ||
| </p> | ||
| <p> | ||
| The instance <code>pyt</code> finds the ground response with the | ||
| <a href=\"https://tough.lbl.gov/software/tough3\">TOUGH</a> simulator | ||
| through the Python interface | ||
| <a href=\"modelica://Buildings.Utilities.IO.Python_3_12.Real_Real\"> | ||
| Buildings.Utilities.IO.Python_3_12.Real_Real</a>. See | ||
| <a href=\"modelica://Buildings.Fluid.Geothermal.Borefields.TOUGH.UsersGuide\"> | ||
| Buildings.Fluid.Geothermal.Borefields.TOUGH.UsersGuide</a> | ||
| for instructions. | ||
| </p> | ||
| </html>", revisions="<html> | ||
| <ul> | ||
| <li> | ||
| March 8, 2024, by Jianjun Hu:<br/> | ||
| First implementation. | ||
| </li> | ||
| </ul> | ||
| </html>")); | ||
| end GroundResponse; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
terminal()function is not supported by Optimica 1.66.The function is also being used in Buildings.DHC.Loads.HotWater.ThermostaticMixingValve. Running the model
Buildings.DHC.Loads.HotWater.Examples.StorageTankWithExternalHeatExchangerwith Optimica 1.66, we can see