Skip to content
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

Merged
merged 13 commits into from
Nov 7, 2018
Merged

Conversation

HBShaoUFZ
Copy link
Contributor

@HBShaoUFZ HBShaoUFZ commented Sep 26, 2018

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)

@HBShaoUFZ HBShaoUFZ force-pushed the bhe_impl branch 2 times, most recently from 59783a8 to b1ea3e6 Compare September 26, 2018 14:07
@HBShaoUFZ HBShaoUFZ force-pushed the bhe_impl branch 2 times, most recently from e721c28 to 6b6b3ba Compare October 1, 2018 09:06
@HBShaoUFZ HBShaoUFZ force-pushed the bhe_impl branch 2 times, most recently from 235283e to f8cfc21 Compare October 2, 2018 09:28
}
// 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)
Copy link
Member

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?

Copy link
Member

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)
{
Copy link
Member

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?

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no default branch?

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation has been added.

Copy link
Member

@TomFischer TomFischer left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean 'dispersion'?

Copy link
Member

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.

Copy link
Member

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...

Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class attributes start with _.

Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class attributes start with _.

Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used by for ...

Copy link
Member

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.
Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with const?

Copy link
Member

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,
Copy link
Member

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.

Copy link
Member

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;
Copy link
Member

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.

Copy link
Member

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
Copy link
Member

@wenqing wenqing Nov 6, 2018

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.

Copy link
Member

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).",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a mesh --> the mesh

Copy link
Member

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];
Copy link
Member

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?

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break --> return

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@wenqing wenqing left a 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.

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};
Copy link
Member

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}};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 68af007

@ogsbot
Copy link
Member

ogsbot commented Jun 19, 2020

OpenGeoSys development has been moved to GitLab.

See this pull request on GitLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants