svMultiPhysics
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
CoupledBoundaryCondition Class Reference

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.
 
CoupledBoundaryConditionoperator= (const CoupledBoundaryCondition &other)
 Copy assignment operator.
 
 CoupledBoundaryCondition (CoupledBoundaryCondition &&other) noexcept
 Move constructor.
 
CoupledBoundaryConditionoperator= (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.
 
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).
 

Detailed Description

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

Constructor & Destructor Documentation

◆ CoupledBoundaryCondition() [1/5]

CoupledBoundaryCondition::CoupledBoundaryCondition ( )
default

Default constructor - creates an uninitialized object.

◆ ~CoupledBoundaryCondition()

CoupledBoundaryCondition::~CoupledBoundaryCondition ( )
default

Destructor.

◆ CoupledBoundaryCondition() [2/5]

CoupledBoundaryCondition::CoupledBoundaryCondition ( const CoupledBoundaryCondition other)

Copy constructor.

◆ CoupledBoundaryCondition() [3/5]

CoupledBoundaryCondition::CoupledBoundaryCondition ( CoupledBoundaryCondition &&  other)
noexcept

Move constructor.

◆ CoupledBoundaryCondition() [4/5]

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.

Parameters
bc_typeThe 3D boundary condition type (must be bType_Dir or bType_Neu)
faceFace associated with this BC
face_nameFace name from the mesh
block_nameBlock name in svZeroDSolver configuration
physEquation physics for this boundary (struct, fluid, FSI, etc.)
follower_pressure_loadFollower pressure load flag (struct/ustruct); false for fluid-like physics

◆ CoupledBoundaryCondition() [5/5]

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.

Parameters
bc_typeThe 3D boundary condition type (must be bType_Dir or bType_Neu)
faceFace associated with this BC
face_nameFace name from the mesh
block_nameBlock name in svZeroDSolver configuration
cap_face_vtp_filePath to the cap face VTP file
physEquation physics for this boundary (struct, fluid, FSI, etc.)
follower_pressure_loadFollower pressure load flag (struct/ustruct); false for fluid-like physics

Member Function Documentation

◆ bcast_coupled_neumann_pressure()

void CoupledBoundaryCondition::bcast_coupled_neumann_pressure ( const CmMod cm_mod,
cmType cm 
)

Master reads Neumann pressure, one scalar MPI_Bcast, all ranks set pressure (svZeroD sync).

Broadcasts the coupled Neumann pressure to all ranks.

Parameters
cm_modThe cm_mod object.
cmThe cm object.

◆ calculate_cap_contribution()

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.

Parameters
com_modThe com_mod object.
cm_modThe cm_mod object.
cfg_oThe old mechanical configuration type.
cfg_nThe new mechanical configuration type.
Returns
The cap contribution.

◆ compute_flowrates()

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.

Parameters
com_modComMod reference containing simulation data
cm_modCmMod 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.

◆ compute_pressures()

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.

Parameters
com_modComMod reference containing simulation data
cm_modCmMod 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.

◆ copy_cap_surface_to_linear_solver_face()

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.

Parameters
com_modThe com_mod object.
lhs_faceThe linear solver face.
cfgThe mechanical configuration type.

◆ distribute()

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.

Parameters
com_modReference to ComMod object
cm_modReference to CmMod object for MPI communication
cmReference to cmType object for MPI communication
faceFace associated with the BC (after distribution)
com_modThe com_mod object.
cm_modThe cm_mod object.
cmThe cmType object.
faceThe faceType object.

◆ get_bc_type()

consts::BoundaryConditionType CoupledBoundaryCondition::get_bc_type ( ) const
inline

Get the 3D BC type for this Coupled boundary condition.

◆ get_block_name()

const std::string & CoupledBoundaryCondition::get_block_name ( ) const

Get the svZeroD block name.

Returns
Block name

◆ get_flow_sol_id()

int CoupledBoundaryCondition::get_flow_sol_id ( ) const

Get the flow solution ID.

◆ get_in_out_sign()

double CoupledBoundaryCondition::get_in_out_sign ( ) const

Get the inlet/outlet sign.

◆ get_Pn()

double CoupledBoundaryCondition::get_Pn ( ) const

Get the pressure at new timestep.

Returns
Pressure at t_{n+1}

◆ get_Po()

double CoupledBoundaryCondition::get_Po ( ) const

Get the pressure at old timestep.

Returns
Pressure at t_n

◆ get_pressure()

double CoupledBoundaryCondition::get_pressure ( ) const

Get the current pressure value.

Returns
Current pressure value from 0D solver

◆ get_pressure_sol_id()

int CoupledBoundaryCondition::get_pressure_sol_id ( ) const

Get the pressure solution ID.

◆ get_Qn()

double CoupledBoundaryCondition::get_Qn ( ) const

Get the flowrate at new timestep.

Returns
Flowrate at t_{n+1}

◆ get_Qo()

double CoupledBoundaryCondition::get_Qo ( ) const

Get the flowrate at old timestep.

Returns
Flowrate at t_n

◆ has_cap()

bool CoupledBoundaryCondition::has_cap ( ) const
inline

Check if this BC has a cap (broadcast in distribute so all ranks agree).

◆ initialize_cap()

void CoupledBoundaryCondition::initialize_cap ( ComMod com_mod)

Initialize cap quadrature on the master (call from baf_ini after partition).

Initialize the cap quadrature.

Parameters
com_modThe com_mod object.

◆ load_cap_face_vtp()

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.

Parameters
vtp_file_pathPath to the cap face VTP file

◆ operator=() [1/2]

CoupledBoundaryCondition & CoupledBoundaryCondition::operator= ( const CoupledBoundaryCondition other)

Copy assignment operator.

◆ operator=() [2/2]

CoupledBoundaryCondition & CoupledBoundaryCondition::operator= ( CoupledBoundaryCondition &&  other)
noexcept

Move assignment operator.

◆ owns_cap()

bool CoupledBoundaryCondition::owns_cap ( ) const
inline

True if this rank stores the cap mesh / quadrature in cap_.

◆ perturb_flowrate()

void CoupledBoundaryCondition::perturb_flowrate ( double  diff)

Perturb the new timestep flowrate by a given amount.

Parameters
diffPerturbation to add to Qn

◆ restore_state()

void CoupledBoundaryCondition::restore_state ( const State state)

Restore state from a saved state.

Parameters
stateState to restore

◆ save_state()

CoupledBoundaryCondition::State CoupledBoundaryCondition::save_state ( ) const

Save current state (Qn and pressure)

Returns
Current state

◆ set_flowrate_mechanical_configurations()

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.

Parameters
physThe equation type.
follower_pressure_loadThe follower pressure load flag.

◆ set_flowrates()

void CoupledBoundaryCondition::set_flowrates ( double  Qo,
double  Qn 
)

Set the flowrates directly.

Parameters
QoFlowrate at old timestep
QnFlowrate at new timestep

◆ set_pressure()

void CoupledBoundaryCondition::set_pressure ( double  pressure)

Set the pressure value from 0D solver.

Parameters
pressurePressure value to be applied as Neumann BC

◆ set_solution_ids()

void CoupledBoundaryCondition::set_solution_ids ( int  flow_id,
int  pressure_id,
double  in_out_sign 
)

Set the svZeroD solution IDs for flow and pressure.

Parameters
flow_idFlow solution ID
pressure_idPressure solution ID
in_out_signSign for inlet/outlet

The documentation for this class was generated from the following files: