Skip to content

Conversation

bangerth
Copy link
Contributor

Catch the error reported in https://community.geodynamics.org/t/error-when-robin-boundary-condition-is-applied/4302 at an earlier stage so we can give a useful error message. As shown there, right now we simply access an invalid array element.

Related to #6686

Copy link
Contributor

@jdannberg jdannberg left a comment

Choose a reason for hiding this comment

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

Thank you for addressing this!
If the code crashes in the case of no plugin being selected, wouldn't it make sense to change the assert here to checking that the number of plugins is exactly 1 rather than <= 1?

scratch.face_material_model_inputs,
scratch.face_material_model_outputs);
Assert (heat_flux.size() == n_face_q_points,
ExcMessage("The boundary heat flux plugins have not returned information "
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ExcMessage("The boundary heat flux plugins have not returned information "
ExcMessage("The boundary heat transfer coefficients have not returned information "

@bangerth
Copy link
Contributor Author

I fixed the wording of the error message. As for this:

If the code crashes in the case of no plugin being selected, wouldn't it make sense to change the assert here to checking that the number of plugins is exactly 1 rather than <= 1?

We can't. If you don't select heat transfer boundaries, you still read these parameters (even though we don't use them) and the default is a list of size zero. So that has to be allowed as part of regular operations -- it just needs to be a list of size one when these plugins are actually used.

So my proposition would be to not touch these lines, leave the assertion in that we have here, and require that there is at least one plugin in the way discussed in #6686. Does that sound good?

Copy link
Contributor

@jdannberg jdannberg left a comment

Choose a reason for hiding this comment

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

So my proposition would be to not touch these lines, leave the assertion in that we have here, and require that there is at least one plugin in the way discussed in #6686. Does that sound good?

Yes, that makes sense to me!

scratch.face_material_model_outputs,
scratch.face_finite_element_values->get_normal_vectors());
Assert (heat_flux.size() == n_face_q_points,
ExcMessage("The boundary heat transfer coefficient plugins have not returned information "
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you misunderstood my previous comment. This was the correct wording of the error message (we're checking heat flux)

Suggested change
ExcMessage("The boundary heat transfer coefficient plugins have not returned information "
ExcMessage("The boundary heat flux plugins have not returned information "

Only the message below is for the heat transfer coefficient.

Comment on lines 564 to 565
Assert (heat_flux.size() == n_face_q_points,
ExcMessage("The boundary heat transfer coefficient plugins have not returned information "
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct as boundary heat transfer coefficient, but

Suggested change
Assert (heat_flux.size() == n_face_q_points,
ExcMessage("The boundary heat transfer coefficient plugins have not returned information "
Assert (heat_transfer_coefficients.size() == n_face_q_points,
ExcMessage("The boundary heat transfer coefficient plugins have not returned information "

@bangerth
Copy link
Contributor Author

Good points, thanks for looking over it again! I fixed as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants