|
svMultiPhysics
|
Object-oriented Coupled boundary condition. More...
#include <CoupledBoundaryCondition.h>
Classes | |
| struct | State |
| State struct for saving/restoring Qn and pressure. More... | |
Public Member Functions | |
| CoupledBoundaryCondition ()=default | |
| Default constructor - creates an uninitialized object. | |
| ~CoupledBoundaryCondition ()=default | |
| Destructor. | |
| CoupledBoundaryCondition (const CoupledBoundaryCondition &other) | |
| Copy constructor. | |
| CoupledBoundaryCondition & | operator= (const CoupledBoundaryCondition &other) |
| Copy assignment operator. | |
| CoupledBoundaryCondition (CoupledBoundaryCondition &&other) noexcept | |
| Move constructor. | |
| CoupledBoundaryCondition & | operator= (CoupledBoundaryCondition &&other) noexcept |
| Move assignment operator. | |
| CoupledBoundaryCondition (consts::BoundaryConditionType bc_type, const faceType &face, const std::string &face_name, const std::string &block_name, consts::EquationType phys, bool follower_pressure_load) | |
| Construct with a face association (no VTP data loaded) | |
| CoupledBoundaryCondition (consts::BoundaryConditionType bc_type, const faceType &face, const std::string &face_name, const std::string &block_name, const std::string &cap_face_vtp_file, consts::EquationType phys, bool follower_pressure_load) | |
| Construct and optionally point to a cap face VTP file. | |
| consts::BoundaryConditionType | get_bc_type () const |
| Get the 3D BC type for this Coupled boundary condition. | |
| const std::string & | get_block_name () const |
| Get the svZeroD block name. | |
| const std::string & | get_oned_input_file () const |
| Get the svOneD input file path. | |
| void | set_oned_input_file (const std::string &path) |
| Set the svOneD input file path. | |
| bool | is_svOneD_face () const |
| int | get_oned_ramp_steps () const |
| Get the pressure ramp step count (0 = disabled). | |
| void | set_oned_ramp (int steps, double P_ref) |
| Set the pressure ramp parameters for 1D coupling initialization. | |
| double | get_oned_ramp_ref_pressure () const |
| Get the ramp reference pressure. | |
| double | get_oned_relax_factor () const |
| Get the under-relaxation factor for DIR coupling pressure (1.0 = no relaxation). | |
| void | set_oned_relax_factor (double omega) |
| Set the under-relaxation factor for DIR coupling pressure. | |
| int | get_ramp_step_count () const |
| Get the number of committed time steps (used for ramp fraction). | |
| void | increment_ramp_step_count () |
| Increment the committed step counter (call once per 'L' step). | |
| double | get_P_prev_sent_old () const |
| Get the under-relaxed pressure sent at t_old on the last 'L' step (DIR input). | |
| double | get_P_prev_sent_new () const |
| Get the under-relaxed pressure sent at t_new on the last 'L' step (DIR input). | |
| void | set_P_prev_sent (double old_val, double new_val) |
| Set the DIR input pressure history (call on 'L' steps). | |
| double | get_Q_prev_sent () const |
| Get the under-relaxed flow output on the last 'L' step (DIR output). | |
| void | set_Q_prev_sent (double Q) |
| Set the DIR output flow history (call on 'L' steps). | |
| double | get_P_neu_prev () const |
| Get the under-relaxed pressure output on the last 'L' step (NEU output). | |
| void | set_P_neu_prev (double P) |
| Set the NEU output pressure history (call on 'L' steps). | |
| double | get_Q_input_prev_old () const |
| Get the under-relaxed flow sent at t_old on the last 'L' step (NEU input). | |
| double | get_Q_input_prev_new () const |
| Get the under-relaxed flow sent at t_new on the last 'L' step (NEU input). | |
| void | set_Q_input_prev (double old_val, double new_val) |
| Set the NEU input flow history (call on 'L' steps). | |
| void | set_solution_ids (int flow_id, int pressure_id, double in_out_sign) |
| Set the svZeroD solution IDs for flow and pressure. | |
| int | get_flow_sol_id () const |
| Get the flow solution ID. | |
| int | get_pressure_sol_id () const |
| Get the pressure solution ID. | |
| double | get_in_out_sign () const |
| Get the inlet/outlet sign. | |
| void | set_flowrate_mechanical_configurations (consts::EquationType phys, bool follower_pressure_load) |
| Set follower load flag and mechanical configs used for flowrate integration (also run from the face constructors). | |
| void | compute_flowrates (ComMod &com_mod, const CmMod &cm_mod, const SolutionStates &solutions) |
| Compute flowrates at the boundary face at old and new timesteps. | |
| void | initialize_cap (ComMod &com_mod) |
Initialize cap quadrature on the master (call from baf_ini after partition). | |
| void | copy_cap_surface_to_linear_solver_face (ComMod &com_mod, fsi_linear_solver::FSILS_faceType &lhs_face, consts::MechanicalConfigurationType cfg, const SolutionStates &solutions) const |
| Compute cap valM from current cap mesh state on owner and copy/broadcast cap data to FSILS face. | |
| std::pair< double, double > | calculate_cap_contribution (ComMod &com_mod, const CmMod &cm_mod, const SolutionStates &solutions, consts::MechanicalConfigurationType cfg_o, consts::MechanicalConfigurationType cfg_n) |
| Extra volumetric flux through the cap (old/new timestep); {0,0} if no cap; MPI-safe on all ranks. | |
| void | compute_pressures (ComMod &com_mod, const CmMod &cm_mod, const SolutionStates &solutions) |
| Compute average pressures at the boundary face at old and new timesteps (for Dirichlet BCs) | |
| double | get_Qo () const |
| Get the flowrate at old timestep. | |
| double | get_Qn () const |
| Get the flowrate at new timestep. | |
| void | set_flowrates (double Qo, double Qn) |
| Set the flowrates directly. | |
| void | perturb_flowrate (double diff) |
| Perturb the new timestep flowrate by a given amount. | |
| void | set_pressure (double pressure) |
| Set the pressure value from 0D solver. | |
| double | get_pressure () const |
| Get the current pressure value. | |
| double | get_Po () const |
| Get the pressure at old timestep. | |
| double | get_Pn () const |
| Get the pressure at new timestep. | |
| State | save_state () const |
| Save current state (Qn and pressure) | |
| void | restore_state (const State &state) |
| Restore state from a saved state. | |
| void | distribute (const ComMod &com_mod, const CmMod &cm_mod, const cmType &cm, const faceType &face) |
| Distribute BC metadata from master to slave processes. | |
| void | load_cap_face_vtp (const std::string &vtp_file_path) |
| Load the cap face VTP file and associate it with this boundary condition. | |
| bool | has_cap () const |
| Check if this BC has a cap (broadcast in distribute so all ranks agree). | |
| bool | owns_cap () const |
| True if this rank stores the cap mesh / quadrature in cap_. | |
| void | bcast_coupled_neumann_pressure (const CmMod &cm_mod, cmType &cm) |
Master reads Neumann pressure, one scalar MPI_Bcast, all ranks set pressure (svZeroD sync). | |
| void | bcast_coupled_dir_flowrate (const CmMod &cm_mod, cmType &cm) |
Master reads DIR flowrates (Qo, Qn), two scalar MPI_Bcast, all ranks set flowrates (svZeroD sync). | |
Object-oriented Coupled boundary condition.
This class provides an interface for:
The class manages its own coupling data. svZeroD interface code accesses coupled boundary conditions by iterating through com_mod.eq[].bc[].
|
default |
Default constructor - creates an uninitialized object.
|
default |
Destructor.
| CoupledBoundaryCondition::CoupledBoundaryCondition | ( | const CoupledBoundaryCondition & | other | ) |
Copy constructor.
|
noexcept |
Move constructor.
| CoupledBoundaryCondition::CoupledBoundaryCondition | ( | consts::BoundaryConditionType | bc_type, |
| const faceType & | face, | ||
| const std::string & | face_name, | ||
| const std::string & | block_name, | ||
| consts::EquationType | phys, | ||
| bool | follower_pressure_load | ||
| ) |
Construct with a face association (no VTP data loaded)
Constructor for a coupled boundary condition.
| bc_type | The 3D boundary condition type (must be bType_Dir or bType_Neu) |
| face | Face associated with this BC |
| face_name | Face name from the mesh |
| block_name | Block name in svZeroDSolver configuration |
| phys | Equation physics for this boundary (struct, fluid, FSI, etc.) |
| follower_pressure_load | Follower pressure load flag (struct/ustruct); false for fluid-like physics |
| CoupledBoundaryCondition::CoupledBoundaryCondition | ( | consts::BoundaryConditionType | bc_type, |
| const faceType & | face, | ||
| const std::string & | face_name, | ||
| const std::string & | block_name, | ||
| const std::string & | cap_face_vtp_file, | ||
| consts::EquationType | phys, | ||
| bool | follower_pressure_load | ||
| ) |
Construct and optionally point to a cap face VTP file.
Constructor for a coupled boundary condition with a cap.
| bc_type | The 3D boundary condition type (must be bType_Dir or bType_Neu) |
| face | Face associated with this BC |
| face_name | Face name from the mesh |
| block_name | Block name in svZeroDSolver configuration |
| cap_face_vtp_file | Path to the cap face VTP file |
| phys | Equation physics for this boundary (struct, fluid, FSI, etc.) |
| follower_pressure_load | Follower pressure load flag (struct/ustruct); false for fluid-like physics |
Master reads DIR flowrates (Qo, Qn), two scalar MPI_Bcast, all ranks set flowrates (svZeroD sync).
Master reads Neumann pressure, one scalar MPI_Bcast, all ranks set pressure (svZeroD sync).
Broadcasts the coupled Neumann pressure to all ranks.
| cm_mod | The cm_mod object. |
| cm | The cm object. |
| std::pair< double, double > CoupledBoundaryCondition::calculate_cap_contribution | ( | ComMod & | com_mod, |
| const CmMod & | cm_mod, | ||
| const SolutionStates & | solutions, | ||
| consts::MechanicalConfigurationType | cfg_o, | ||
| consts::MechanicalConfigurationType | cfg_n | ||
| ) |
Extra volumetric flux through the cap (old/new timestep); {0,0} if no cap; MPI-safe on all ranks.
Calculates the cap contribution to the linear solver face.
| com_mod | The com_mod object. |
| cm_mod | The cm_mod object. |
| cfg_o | The old mechanical configuration type. |
| cfg_n | The new mechanical configuration type. |
| void CoupledBoundaryCondition::compute_flowrates | ( | ComMod & | com_mod, |
| const CmMod & | cm_mod, | ||
| const SolutionStates & | solutions | ||
| ) |
Compute flowrates at the boundary face at old and new timesteps.
| com_mod | ComMod reference containing simulation data |
| cm_mod | CmMod reference for communication |
This replicates the flowrate computation done in set_bc::calc_der_cpl_bc and set_bc::set_bc_cpl for coupled Neumann boundary conditions.
The flowrate is computed as the integral of velocity dotted with the face normal. For struct/ustruct physics, the integral is computed on the deformed configuration. For fluid/FSI/CMM physics, the integral is computed on the reference configuration.
| void CoupledBoundaryCondition::compute_pressures | ( | ComMod & | com_mod, |
| const CmMod & | cm_mod, | ||
| const SolutionStates & | solutions | ||
| ) |
Compute average pressures at the boundary face at old and new timesteps (for Dirichlet BCs)
Compute average pressures at the boundary face at old and new timesteps.
| com_mod | ComMod reference containing simulation data |
| cm_mod | CmMod reference for communication |
This replicates the pressure computation done in set_bc::calc_der_cpl_bc and set_bc::set_bc_cpl for coupled Dirichlet boundary conditions.
The pressure is computed as the average pressure over the face by integrating pressure (at index nsd in the solution vector) and dividing by the face area.
| void CoupledBoundaryCondition::copy_cap_surface_to_linear_solver_face | ( | ComMod & | com_mod, |
| fsi_linear_solver::FSILS_faceType & | lhs_face, | ||
| consts::MechanicalConfigurationType | cfg, | ||
| const SolutionStates & | solutions | ||
| ) | const |
Compute cap valM from current cap mesh state on owner and copy/broadcast cap data to FSILS face.
Calculates the cap contribution to the linear solver face and broadcasts it to all ranks.
| com_mod | The com_mod object. |
| lhs_face | The linear solver face. |
| cfg | The mechanical configuration type. |
| void CoupledBoundaryCondition::distribute | ( | const ComMod & | com_mod, |
| const CmMod & | cm_mod, | ||
| const cmType & | cm, | ||
| const faceType & | face | ||
| ) |
Distribute BC metadata from master to slave processes.
Distribute the boundary condition metadata to all processes.
| com_mod | Reference to ComMod object |
| cm_mod | Reference to CmMod object for MPI communication |
| cm | Reference to cmType object for MPI communication |
| face | Face associated with the BC (after distribution) |
| com_mod | The com_mod object. |
| cm_mod | The cm_mod object. |
| cm | The cmType object. |
| face | The faceType object. |
|
inline |
Get the 3D BC type for this Coupled boundary condition.
| const std::string & CoupledBoundaryCondition::get_block_name | ( | ) | const |
Get the svZeroD block name.
| int CoupledBoundaryCondition::get_flow_sol_id | ( | ) | const |
Get the flow solution ID.
| double CoupledBoundaryCondition::get_in_out_sign | ( | ) | const |
Get the inlet/outlet sign.
| const std::string & CoupledBoundaryCondition::get_oned_input_file | ( | ) | const |
Get the svOneD input file path.
|
inline |
Get the ramp reference pressure.
|
inline |
Get the pressure ramp step count (0 = disabled).
|
inline |
Get the under-relaxation factor for DIR coupling pressure (1.0 = no relaxation).
|
inline |
Get the under-relaxed pressure output on the last 'L' step (NEU output).
|
inline |
Get the under-relaxed pressure sent at t_new on the last 'L' step (DIR input).
|
inline |
Get the under-relaxed pressure sent at t_old on the last 'L' step (DIR input).
| double CoupledBoundaryCondition::get_Pn | ( | ) | const |
Get the pressure at new timestep.
| double CoupledBoundaryCondition::get_Po | ( | ) | const |
Get the pressure at old timestep.
| double CoupledBoundaryCondition::get_pressure | ( | ) | const |
Get the current pressure value.
| int CoupledBoundaryCondition::get_pressure_sol_id | ( | ) | const |
Get the pressure solution ID.
|
inline |
Get the under-relaxed flow sent at t_new on the last 'L' step (NEU input).
|
inline |
Get the under-relaxed flow sent at t_old on the last 'L' step (NEU input).
|
inline |
Get the under-relaxed flow output on the last 'L' step (DIR output).
| double CoupledBoundaryCondition::get_Qn | ( | ) | const |
Get the flowrate at new timestep.
| double CoupledBoundaryCondition::get_Qo | ( | ) | const |
Get the flowrate at old timestep.
|
inline |
Get the number of committed time steps (used for ramp fraction).
|
inline |
Check if this BC has a cap (broadcast in distribute so all ranks agree).
|
inline |
Increment the committed step counter (call once per 'L' step).
| void CoupledBoundaryCondition::initialize_cap | ( | ComMod & | com_mod | ) |
Initialize cap quadrature on the master (call from baf_ini after partition).
Initialize the cap quadrature.
| com_mod | The com_mod object. |
| void CoupledBoundaryCondition::load_cap_face_vtp | ( | const std::string & | vtp_file_path | ) |
Load the cap face VTP file and associate it with this boundary condition.
| vtp_file_path | Path to the cap face VTP file |
| CoupledBoundaryCondition & CoupledBoundaryCondition::operator= | ( | const CoupledBoundaryCondition & | other | ) |
Copy assignment operator.
|
noexcept |
Move assignment operator.
|
inline |
True if this rank stores the cap mesh / quadrature in cap_.
| void CoupledBoundaryCondition::perturb_flowrate | ( | double | diff | ) |
Perturb the new timestep flowrate by a given amount.
| diff | Perturbation to add to Qn |
| void CoupledBoundaryCondition::restore_state | ( | const State & | state | ) |
Restore state from a saved state.
| state | State to restore |
| CoupledBoundaryCondition::State CoupledBoundaryCondition::save_state | ( | ) | const |
Save current state (Qn and pressure)
| void CoupledBoundaryCondition::set_flowrate_mechanical_configurations | ( | consts::EquationType | phys, |
| bool | follower_pressure_load | ||
| ) |
Set follower load flag and mechanical configs used for flowrate integration (also run from the face constructors).
Set the flowrate mechanical configurations.
| phys | The equation type. |
| follower_pressure_load | The follower pressure load flag. |
| void CoupledBoundaryCondition::set_flowrates | ( | double | Qo, |
| double | Qn | ||
| ) |
Set the flowrates directly.
| Qo | Flowrate at old timestep |
| Qn | Flowrate at new timestep |
| void CoupledBoundaryCondition::set_oned_input_file | ( | const std::string & | path | ) |
Set the svOneD input file path.
|
inline |
Set the pressure ramp parameters for 1D coupling initialization.
| steps | Number of time steps over which to ramp (0 = disabled). |
| P_ref | Reference pressure at step 0 (typically the 1D initial pressure). |
|
inline |
Set the under-relaxation factor for DIR coupling pressure.
| omega | Relaxation factor in (0, 1]. 1.0 disables relaxation. |
|
inline |
Set the NEU output pressure history (call on 'L' steps).
|
inline |
Set the DIR input pressure history (call on 'L' steps).
| void CoupledBoundaryCondition::set_pressure | ( | double | pressure | ) |
Set the pressure value from 0D solver.
| pressure | Pressure value to be applied as Neumann BC |
|
inline |
Set the NEU input flow history (call on 'L' steps).
|
inline |
Set the DIR output flow history (call on 'L' steps).
| void CoupledBoundaryCondition::set_solution_ids | ( | int | flow_id, |
| int | pressure_id, | ||
| double | in_out_sign | ||
| ) |
Set the svZeroD solution IDs for flow and pressure.
| flow_id | Flow solution ID |
| pressure_id | Pressure solution ID |
| in_out_sign | Sign for inlet/outlet |