-
Notifications
You must be signed in to change notification settings - Fork 239
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
Implementation of HeatTransportBHE process #2221
Conversation
59783a8
to
b1ea3e6
Compare
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.cpp
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.cpp
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.cpp
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.cpp
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.cpp
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
ProcessLib/BoundaryCondition/BHEBottomDirichletBoundaryCondition.h
Outdated
Show resolved
Hide resolved
e721c28
to
6b6b3ba
Compare
235283e
to
f8cfc21
Compare
} | ||
// If only one of the global indices (in or out) is negative the | ||
// implementation is not valid. | ||
if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0) |
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.
Is my understanding correct that the way the domain is partitioned is important for a successful simulation run? Do you have an idea to avoid partitioning such that in_out_global_indices.first
and in_out_global_indices.second
are always on the same partition or is it an open issue?
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.
Yes. No. ;)
I added the checks just out of my head to be sure that partitioning does not go wrong. It still might go wrong, but for other reasons. I wouldn't try to prevent partitioning, but add communication, s.t. the values are passed between the partitions.
PipeConfiguration1U const& pipes) | ||
: BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl}, | ||
_pipes(pipes) | ||
{ |
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.
Why aren't the implementations of the constructor and some other methods of this class in the cpp file?
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.
As suggested by TF, the implementation of the constructor and other functions have been moved to the cpp file. The one still staying in the h file is the "assembleRMatrices" function. This function is called in the constructor of local BHE element assembler to initialize the thermal resistance matrices.
1.0 * matBHE_loc_R; // K_ig | ||
R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) += | ||
1.0 * matBHE_loc_R; // K_og | ||
break; |
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.
Why no default branch?
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.
A default case has been added to prevent the code from getting into undefined status.
{ | ||
namespace BHE | ||
{ | ||
class BHE_1U final : public BHECommon |
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.
Brief documentation of the class would be nice.
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.
Documentation has been added.
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.
Looks in general good. Some minor things to discuss/correct.
/// Distance between pipes. | ||
double const distance; | ||
|
||
double const longitudinal_despersion_length; |
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.
Did you mean 'dispersion'?
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.
It means the longitudinal thermal dispersivity, all the name has been replaced by the longitudinal_thermal_dispersivity.
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.
@ChaofanChen there is typo in the variable name...
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.
Yes, but I don't think this variable name is clear enough, not just the typo problem. So I changed a lot including parameters' documentation.
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.
I will stick with "longitudinal_dispersion_length"
i; | ||
} | ||
|
||
_process_data._mesh_prop_materialIDs = material_ids; |
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.
Minor: I would move line 65 behind line 56.
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.
It has been fixed.
{ | ||
namespace HeatTransportBHE | ||
{ | ||
using namespace BHE; |
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.
@endJunction
I'm not sure if using namespace BHE;
is here in the header okay.
|
||
BHEType const& _bhe; | ||
|
||
std::size_t const element_id; |
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.
Class attributes start with _
.
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.
Fixed.
std::vector<ShapeMatrices, Eigen::aligned_allocator<ShapeMatrices>> | ||
_shape_matrices; | ||
|
||
std::size_t const element_id; |
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.
Class attributes start with _
.
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.
Fixed.
{ | ||
namespace HeatTransportBHE | ||
{ | ||
/// Used by for extrapolation of the integration point values. It is ordered |
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.
Used by for ...
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 extra word has been deleted.
@@ -0,0 +1 @@ | |||
The borehole diameter is one of the most important geometric parameters of borehole. |
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.
I think the explanation of a keyword should follow the style of what for i_borehole.md, which displays like the following
[tag] borehole
It represents the well used to install pipes for heat transport.
With the present form, the displayed one is
[tag]diameter
The borehole diameter is one of the most important geometric parameters of borehole.
It is better to change it to
[tag]diameter
It is the borehole diameter, one of the most important geometric parameters of borehole.
or
[tag]diameter
The borehole diameter, one of the most important geometric parameters of borehole.
The same for the following parameter documentations.
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.
They are rephrased.
public: | ||
BHEInflowDirichletBoundaryCondition( | ||
std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices, | ||
BHEType& bhe) |
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.
with const?
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.
Unfortunately not possible; The bhe has a global state which is updated in the getTinByTout
call.
That member function (the name is not telling it) is not const and is modifying the flow rate and returns new temperature for the BC.
@HBShaoUFZ Could you please rename the function and its documentation, which mistakenly says something about "fixed power"?
* | ||
* 1) Diersch_2011_CG | ||
* Two very important references to understand this class implementations are: | ||
* H.-J.G. Diersch, D. Bauer, W. Heidemann, W. R黨aak, P. Sch鋞zl, |
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.
It seems that there are Unicode characters in W. R ...aak, P. Sch...zl.
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.
Corrected.
OGS_FATAL( | ||
"Error!!! In the function BHE_1U::assembleRMatrices, " | ||
"the index of bhe unknowns is out of range! "); | ||
break; |
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.
This break is not needed.
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.
It's been removed.
return {bhe_material_ids, bhe_elements, bhe_nodes}; | ||
} | ||
} // end of namespace HeatTransportBHE | ||
} // namespace ProcessLib |
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.
Now new line at the end of the file. It is not important but github complains at here.
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.
Corrected.
{ | ||
OGS_FATAL( | ||
"The number of the given BHE properties (%d) are not consistent " | ||
"with the number of BHE groups in a mesh (%d).", |
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.
a mesh --> the mesh
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.
Corrected.
auto const& K_ip = ip_data.dNdxTdNdx_product_times_w; | ||
|
||
// auto const k_f = _process_data.thermal_conductivity_fluid(t, pos)[0]; | ||
// auto const k_g = _process_data.thermal_conductivity_gas(t, pos)[0]; |
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.
Are k_f and k_g needed for future development?
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.
Yes. Currently this is the fully saturated case. I leave the k_f and k_g here in case later on RichardsFlow or MultiphaseFlow process in integrated with the HeatTransportBHE process. For now these parameters are commented out.
|
||
std::size_t const _element_id; | ||
|
||
bool const _is_axially_symmetric; |
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.
Is _is_axially_symmetric
needed? or another question, can the current implementation of BHE be applied for axis-symmetrical problem? I see that GlobalDim = 3.
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.
Removed member; Kept in ctor for shape function initialization.
1.0 * matBHE_loc_R; // K_i1 | ||
R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) += | ||
1.0 * matBHE_loc_R; // K_ig | ||
break; |
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.
break --> return
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.
Done.
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.
Looks good. Only minor stuffs.
Avoid duplicates. Remove unused code parts. Update source code docu. Use STL algorithms. Stronger assertions and improve error messages. etc.
1) move function bodies from .h to .cpp file. 2) add documentation of the BHE_1U class. 3) add the default case for the switch.
double R_gg, R_gs; | ||
std::tie(R_gg, R_gs) = thermalResistancesGroutSoil(chi, R_ar, R_g); | ||
|
||
return {R_fig, R_fog, R_gg, R_gs}; |
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.
Compilation warning:
BHE_1U.cpp:234:13: warning: suggest braces around initialization of subobject [-Wmissing-braces]
return {R_fig, R_fog, R_gg, R_gs};
^~~~~~~~~~~~~~~~~~~~~~~~
{ }
Please change it to
return {{R_fig, R_fog, R_gg, R_gs}};
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.
Fixed in 68af007
OpenGeoSys development has been moved to GitLab. |
In this pull request, the HeatTransport BHE process is implemented.
TODO:
Fix compilation (@endJunction)compiles on jenkins now.Provide project file tags' docu (WIP by Chaofan)