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

First version of constraint boundary conditions #2145

Merged
merged 15 commits into from Jun 27, 2018

Conversation

Projects
None yet
3 participants
@TomFischer
Copy link
Member

TomFischer commented Jun 19, 2018

For discussion:

  • Output information via DBUG or INFO?
  • Open question: How to specify which getFlux function (for instance heat, mass or Darcy flux) should be used for the constraint calculation?

@TomFischer TomFischer force-pushed the TomFischer:ConstraintBCs branch from 4fbed0f to 6210aeb Jun 19, 2018

ProcessLib::createLocalAssemblers<
ConstraintDirichletBoundaryConditionLocalAssembler>(
_bulk_mesh.getDimension(), _bc_mesh.getElements(),
*_dof_table_boundary, 1, _local_assemblers, false, _integration_order,

This comment has been minimized.

@wenqing

wenqing Jun 19, 2018

Member

How about to introduce two constants as:

    const int component = 1;
    const bool lower = false; 

to replace the numbers, 1. false, in the argument list?

This comment has been minimized.

@TomFischer

TomFischer Jun 20, 2018

Author Member

Replacing the number makes the code more readable. Are you sure the suggested names are correct? What do think about the following replacements:

const int shape_function_order = 1;
const bool is_axisymmetric = false;

?

This comment has been minimized.

@wenqing

wenqing Jun 20, 2018

Member

Sorry I've checked a wrong argument list. The names of shape_function_order and is_axisymmetric are correct.

unsigned const number_nodes = boundary_element->getNumberOfNodes();
for (unsigned i = 0; i < number_nodes; ++i)
{
unsigned const id = boundary_element->getNode(i)->getID();

This comment has been minimized.

@wenqing

wenqing Jun 19, 2018

Member

getID() returns std::size_t.

This comment has been minimized.

@TomFischer

TomFischer Jun 20, 2018

Author Member

Changed to auto.

class ConstraintDirichletBoundaryCondition final : public BoundaryCondition
{
public:
/// @param parameter used for setting the values for the boundary condition

This comment has been minimized.

@wenqing

wenqing Jun 19, 2018

Member

It is better to capitalize the first letter of argument comment.

This comment has been minimized.

@TomFischer

TomFischer Jun 20, 2018

Author Member

Capitalized.

}

// make the pairs (node id, value) unique
std::sort(tmp_bc_values.begin(), tmp_bc_values.end(),

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

The comment is about making vector unique, but here it's only sorted... ???

/// @param integration_order The order of the integration.
ConstraintDirichletBoundaryConditionLocalAssembler(
MeshLib::Element const& surface_element,
std::size_t /*const local_matrix_size*/,

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

Commenting 'const' changes function's signature...


IntegrationMethod const _integration_method;
std::size_t _bulk_element_id;
unsigned _bulk_face_id;

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

these _bulk_*_id are not const?

});

const int shape_function_order = 1;
const bool is_axisymmetric = false;

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

isn't this a property of the bc_mesh?

// check if the boundary element is active
if (_lower)
{
if (_flux_values[boundary_element->getID()] < _constraint_threshold)

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

A comparator before the for-loop would be better:

auto is_flux = [&](std::size_t const element_id) {
    return _lower ? _flux_values[element_id] < _constraint_threshold
       : _flux_values[element_id] > _constraint_threshold; }
for ( ... boundary elements ...)
{
   if (is_flux(boundary_element->getID())
   {
       continue;
   }
   ...
}
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__constraining_process_variable}
config.getConfigParameter<std::string>("constraining_process_variable");

const int process_id = 0; // assume monolithic implementation

This comment has been minimized.

@endJunction

endJunction Jun 20, 2018

Member

Maybe this can be checked if the constraining_process is monolithic?

@TomFischer TomFischer force-pushed the TomFischer:ConstraintBCs branch 3 times, most recently from d71e80d to 7db4f7b Jun 21, 2018

private:
MeshLib::Element const& _surface_element;

std::vector<double> _detJ_times_integralMeasure;

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

integration point weight could also be added (multiplied) in the same scalar...

// for correct results it is necessary to multiply the normal with -1
surface_element_normal *= -1;

std::size_t const n_integration_points =

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

I'd recommend to use 'auto' here... The return type might change, and is currently an 'unsigned int'.

ConstViscosityThermalConvection_pcs_0_ts_3_t_0.001010.vtu ConstViscosityThermalConvection_pcs_0_ts_3_t_0.001010.vtu p p 1e-15 1e-14
ConstViscosityThermalConvection_pcs_0_ts_4_t_0.101010.vtu ConstViscosityThermalConvection_pcs_0_ts_4_t_0.101010.vtu p p 1e-15 1e-14
ConstViscosityThermalConvection_pcs_0_ts_5_t_1.101010.vtu ConstViscosityThermalConvection_pcs_0_ts_5_t_1.101010.vtu p p 1e-15 1e-14
ConstViscosityThermalConvection_pcs_0_ts_6_t_10.000000.vtu ConstViscosityThermalConvection_pcs_0_ts_6_t_10.000000.vtu p p 1e-15 1e-14

This comment has been minimized.


// make the pairs (node id, value) unique
// first: sort the (node id, value) pairs according to the node id
std::sort(tmp_bc_values.begin(), tmp_bc_values.end(),

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

Sorry, but I still don't see where the tmp_bc_values are "made unique". There is a copy, but not a std::unique followed by erase....

This comment has been minimized.

@TomFischer

TomFischer Jun 26, 2018

Author Member

I changed the comment.

GlobalVector const&)>
getFlux);

~ConstraintDirichletBoundaryCondition() = default;

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

Can be dropped, isn't it?

// At the moment (2018-04-26) the surface normal is not oriented
// according to the right hand rule
// for correct results it is necessary to multiply the normal with -1
surface_element_normal *= -1;

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

Computing a normalized surface normal for element/face could be a free function in MeshLib.

Eigen::Map<Eigen::RowVectorXd const>(bulk_flux.data(),
bulk_flux.size())
.dot(Eigen::Map<Eigen::RowVectorXd const>(
surface_element_normal.getCoords(), 3)));

This comment has been minimized.

@endJunction

endJunction Jun 25, 2018

Member

Since the surface element normal does not change, it could be stored in the integration point data...

This comment has been minimized.

@TomFischer

TomFischer Jun 26, 2018

Author Member

The normal doesn't change for all integration points, am I right? For this reason, I made the normal an attribute of the object and did not move it to the integration point data.

This comment has been minimized.

@endJunction

endJunction Jun 27, 2018

Member

The current implementation is returning a constant normal vector for each element. This is not correct...

@endJunction endJunction referenced this pull request Jun 25, 2018

Merged

Move BC meshes post refactoring #2153

1 of 1 task complete

@TomFischer TomFischer force-pushed the TomFischer:ConstraintBCs branch from 7db4f7b to ac1a2b0 Jun 26, 2018

@endJunction endJunction merged commit e54815c into ufz:master Jun 27, 2018

2 of 3 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
deploy/netlify Deploy preview ready!
Details

@TomFischer TomFischer deleted the TomFischer:ConstraintBCs branch Jun 28, 2018

bilke added a commit to bilke/ogs that referenced this pull request Jul 2, 2018

Merge pull request ufz#2145 from TomFischer/ConstraintBCs
First version of constraint boundary conditions

@chleh chleh referenced this pull request Aug 13, 2018

Merged

Python BCs #2170

13 of 15 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.