Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Code/Source/solver/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ BoundaryConditionParameters::BoundaryConditionParameters()
set_parameter("Spatial_profile_file_path", "", !required, spatial_profile_file_path);
set_parameter("Spatial_values_file_path", "", !required, spatial_values_file_path);
set_parameter("Stiffness", 1.0, !required, stiffness);
set_parameter("Robin_vtp_file_path", "", !required, robin_vtp_file_path);
set_parameter("svZeroDSolver_block", "", !required, svzerod_solver_block);

set_parameter("Temporal_and_spatial_values_file_path", "", !required, temporal_and_spatial_values_file_path);
Expand Down
1 change: 0 additions & 1 deletion Code/Source/solver/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ class BoundaryConditionParameters : public ParameterLists
Parameter<std::string> spatial_profile_file_path;
Parameter<std::string> spatial_values_file_path;
Parameter<double> stiffness;
Parameter<std::string> robin_vtp_file_path;
Parameter<std::string> svzerod_solver_block;

Parameter<std::string> temporal_and_spatial_values_file_path;
Expand Down
11 changes: 11 additions & 0 deletions Code/Source/solver/RobinBoundaryCondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
*/

#include "RobinBoundaryCondition.h"
#include <iostream>
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Using std::cout directly is not recommended for library code. Consider using a proper logging framework or at minimum std::cerr for warnings to avoid mixing output streams.

Copilot uses AI. Check for mistakes.

#define n_debug_robin_bc

RobinBoundaryCondition::RobinBoundaryCondition(double uniform_stiffness, double uniform_damping, bool normal_only, const faceType& face)
: BoundaryCondition({{"Stiffness", uniform_stiffness}, {"Damping", uniform_damping}}, StringBoolMap{{"normal_direction_only", normal_only}}, face)
{
// Warning if both stiffness and damping are zero
if (uniform_stiffness == 0.0 && uniform_damping == 0.0) {
std::cout << "WARNING: Robin boundary condition has both stiffness and damping values set to zero. "
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Warning messages should be written to std::cerr instead of std::cout to properly separate error/warning output from regular program output.

Suggested change
std::cout << "WARNING: Robin boundary condition has both stiffness and damping values set to zero. "
std::cerr << "WARNING: Robin boundary condition has both stiffness and damping values set to zero. "

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no difference between the cout and cerr output message, just that cerr does not buffer data.

Warning messages should be written using simulation->logger so they will appear in the histor.dat file.

Should we throw when the both the stiffness and damping values are zero ?

<< "This will result in effectively no boundary condition being applied." << std::endl;
}
}

3 changes: 1 addition & 2 deletions Code/Source/solver/RobinBoundaryCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ class RobinBoundaryCondition : public BoundaryCondition {
/// @param normal_only Flag to apply only along normal direction
/// @param face Face associated with the Robin BC
/// @throws BoundaryConditionValidationException if values are invalid
RobinBoundaryCondition(double uniform_stiffness, double uniform_damping, bool normal_only, const faceType& face)
: BoundaryCondition({{"Stiffness", uniform_stiffness}, {"Damping", uniform_damping}}, StringBoolMap{{"normal_direction_only", normal_only}}, face) {}
RobinBoundaryCondition(double uniform_stiffness, double uniform_damping, bool normal_only, const faceType& face);

/// @brief Apply only along normal direction (getter)
/// @return true if BC should be applied only along normal direction
Expand Down
4 changes: 2 additions & 2 deletions Code/Source/solver/read_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ void read_bc(Simulation* simulation, EquationParameters* eq_params, eqType& lEq,
if (utils::btest(lBc.bType, enum_int(BoundaryConditionType::bType_Robin))) {

// Read VTP file path for per-node stiffness and damping (optional)
if (bc_params->robin_vtp_file_path.defined()) {
lBc.robin_bc = RobinBoundaryCondition(bc_params->robin_vtp_file_path.value(),
if (bc_params->spatial_values_file_path.defined()) {
lBc.robin_bc = RobinBoundaryCondition(bc_params->spatial_values_file_path.value(),
bc_params->apply_along_normal_direction.value(),
com_mod.msh[lBc.iM].fa[lBc.iFa]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/struct/spatially_variable_robin/solver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

<Add_BC name="Y0" >
<Type> Robin </Type>
<Robin_vtp_file_path> Y0_spatially_varying_robin.vtp </Robin_vtp_file_path>
<Spatial_values_file_path> Y0_spatially_varying_robin.vtp </Spatial_values_file_path>
<Apply_along_normal_direction> false </Apply_along_normal_direction>
</Add_BC>

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/ustruct/spatially_variable_robin/solver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

<Add_BC name="Y0" >
<Type> Robin </Type>
<Robin_vtp_file_path> Y0_spatially_varying_robin.vtp </Robin_vtp_file_path>
<Spatial_values_file_path> Y0_spatially_varying_robin.vtp </Spatial_values_file_path>
</Add_BC>

<Add_BC name="Y1" >
Expand Down
Loading