carbonfly.boundary module

Data models for OpenFOAM boundary condition definitions.

This module defines lightweight Python data structures used to describe physical boundary conditions (e.g. inlet, outlet, wall) in a solver-agnostic way.

The boundary objects are later consumed by writer modules to generate OpenFOAM-compatible field dictionaries.

class carbonfly.boundary.Boundary(region_name: str, patch_name: str | None = None, btype: ~typing.Literal['inletVelocity', 'outletPressure', 'wall', 'symmetry', 'custom'] = 'inletVelocity', fields: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Patch-level boundary-condition container

boundary_field_block() Dict[str, Dict][source]

Generate the dictionary snippet for this boundary to be written into the 0/ field files. Each entry in fields should be an instance of FieldFV, FieldZG, FieldInletOutlet, etc.

btype: Literal['inletVelocity', 'outletPressure', 'wall', 'symmetry', 'custom'] = 'inletVelocity'
fields: Dict[str, Any]
patch_name: str | None = None
region_name: str
resolved_patch() str[source]

Return the effective patch name to be written in OpenFOAM (patch_name if set, else region_name).

class carbonfly.boundary.FieldAlphatJayatillekeWF(value: Any, Prt: float = 0.85)[source]

Bases: object

compressible::alphatJayatillekeWallFunction

Prt: float = 0.85
to_dict()[source]
value: Any
class carbonfly.boundary.FieldCO2FromPatchAverage(source_patch: str, name: str = 'co2FromPatchAvg')[source]

Bases: object

Set CO2 at this patch to the area-weighted average CO2 on another patch. Typical use: AC outlet recirculation -> sample from AC inlet.

Parameters:
  • source_patch (str) – Patch to sample CO2 from.

  • name (str) – Name of the codedFixedValue block.

name: str = 'co2FromPatchAvg'
source_patch: str
to_dict() Dict[str, Any][source]
class carbonfly.boundary.FieldCalculated(value: Any)[source]

Bases: object

calculated

to_dict()[source]
value: Any
class carbonfly.boundary.FieldDynamicRespiration(freq: float = 12.0, minute_vent_L_min: float = 7.2, name: str = 'breathingSine')[source]

Bases: object

Dynamic respiration velocity boundary using codedFixedValue.

Parameters:
  • freq (float) – Breathing frequency in breaths per minute.

  • minute_vent_L_min (float) – Minute ventilation in L/min.

  • name (str) – Name of the codedFixedValue block.

freq: float = 12.0
minute_vent_L_min: float = 7.2
name: str = 'breathingSine'
to_dict() Dict[str, Any][source]
class carbonfly.boundary.FieldEpsilonWallFunction(value: Any)[source]

Bases: object

epsilonWallFunction

to_dict()[source]
value: Any
class carbonfly.boundary.FieldExternalWallHeatFluxTemperature(mode: str = 'coefficient', h: Any = 0.0, Ta: Any = 300.0, value: Any = 300.0)[source]

Bases: object

externalWallHeatFluxTemperature

Ta: Any = 300.0
h: Any = 0.0
mode: str = 'coefficient'
to_dict()[source]
value: Any = 300.0
class carbonfly.boundary.FieldFV(value: Any)[source]

Bases: object

Fixed value boundary condition (fixedValue).

to_dict()[source]
value: Any
class carbonfly.boundary.FieldFixedFluxPressure(value: Any | None = None)[source]

Bases: object

fixedFluxPressure

to_dict()[source]
value: Any | None = None
class carbonfly.boundary.FieldInletOutlet(inletValue: Any, value: Any)[source]

Bases: object

inletOutlet boundary condition.

inletValue: Any
to_dict()[source]
value: Any
class carbonfly.boundary.FieldIntensityKInlet(intensity: Any = 0.14, value: Any = 0.0)[source]

Bases: object

turbulentIntensityKineticEnergyInlet

intensity: Any = 0.14
to_dict()[source]
value: Any = 0.0
class carbonfly.boundary.FieldKqRWallFunction(value: Any)[source]

Bases: object

kqRWallFunction

to_dict()[source]
value: Any
class carbonfly.boundary.FieldMarshakRadiation(emissivityMode: str = 'lookup', emissivity: Any = 0.98, value: Any = 0.0)[source]

Bases: object

MarshakRadiation

emissivity: Any = 0.98
emissivityMode: str = 'lookup'
to_dict()[source]
value: Any = 0.0
class carbonfly.boundary.FieldMixingLengthEpsilonInlet(value: Any, mixingLength: Any = 0.0168)[source]

Bases: object

turbulentMixingLengthDissipationRateInlet

mixingLength: Any = 0.0168
to_dict()[source]
value: Any
class carbonfly.boundary.FieldNoSlip[source]

Bases: object

No-slip boundary condition for velocity U (vector): U = 0.

to_dict()[source]
class carbonfly.boundary.FieldNutkWallFunction(value: Any)[source]

Bases: object

nutkWallFunction

to_dict()[source]
value: Any
class carbonfly.boundary.FieldPressureInletOutletVelocity(inletValue: Any, value: Any)[source]

Bases: object

pressureInletOutletVelocity

inletValue: Any
to_dict()[source]
value: Any
class carbonfly.boundary.FieldTotalPressure(p0: Any = '$internalField', value: Any = '$internalField')[source]

Bases: object

totalPressure

p0: Any = '$internalField'
to_dict()[source]
value: Any = '$internalField'
class carbonfly.boundary.FieldZG[source]

Bases: object

Zero gradient boundary condition (zeroGradient).

to_dict()[source]