zoomy_foam.vof

zoomy_foam.vof#

The resolved participant of an SME | VOF coupling: OpenFOAM 13 incompressibleVoF in a rectangular tank, with the swePreciceCoupling function object (this package’s swePreciceCoupling/) imposing the reduced arm’s column on the coupled patches.

The function object compiles the reduced model’s kernels in (its Model.H / NumericsKernels.H, emitted here from the model’s SystemModel), so coupling_library(sm) builds it per model, cached by the hash of its sources, the emitted headers and the image.

tank = Tank(h0=0.04)
write_config(run / "precice-config.xml", arms=[Arm("Swe", "SweMesh", "VofInletMesh")],
             t_end=2.5, window=2e-3, exchange=run)
case = write_case(run / "vof_case", tank, arms=..., config=..., t_end=2.5, window=2e-3)
lib = coupling_library(sm)
proc = start(case, lib)                    # blockMesh, setFields, foamRun

The column contract: six fields [b, h, u, v, w, p] (<field>_S written by the reduced arm, <field>_V by this participant), the reduced arm’s vertices (x, y, sigma) at the cell-centre heights of nz = the tank’s cells over its height (ny), the model’s project_nz.

Module Contents#

Classes#

Arm

A reduced participant coupled to the tank: its preCICE name, its mesh, the tank’s mesh of the shared patch, and which tank side it sits on (left: the inlet at x = 0, right: the outlet at x = lx).

Tank

The VOF tank [0, lx] x [0, ly] (thin in z), nx x ny cells, still water h0; the sides an Arm does not take are walls.

Functions#

write_config

The preCICE configuration of the tank (participant Vof) and its reduced arms: one parallel-explicit scheme for one arm, a multi scheme with the tank as controller (max-iterations 1: the explicit-equivalent single pass) for several; m2n sockets through the directory exchange (both containers must see it at that path).

write_case

The tank case in dest: mesh (blockMeshDict), still water h0 (setFieldsDict), 0/ fields with the coupled patches fixedValue (the function object imposes them), controlDict with the function object on config. Returns dest.

coupling_library

The directory holding libswePreciceCoupling.so built against the reduced model sm (its SystemModel: Model.H / NumericsKernels.H / MarchConstants.H emitted with the Foam printers next to a copy of this package’s C++ sources), built once per hash of the sources, the headers and the image.

start

blockMesh, setFields, then foamRun of the tank case with the function object from lib, in the background; returns the process (its output in log, default <case>/../log.vof).

to_hdf5

The tank’s written time directories (foamToVTK) as a zoomy HDF5 store out.

Data#

API#

zoomy_foam.vof.FIELDS#

(‘b’, ‘h’, ‘u’, ‘v’, ‘w’, ‘p’)

zoomy_foam.vof.FO_STARSTATE#

None

class zoomy_foam.vof.Arm#

A reduced participant coupled to the tank: its preCICE name, its mesh, the tank’s mesh of the shared patch, and which tank side it sits on (left: the inlet at x = 0, right: the outlet at x = lx).

participant: str#

None

mesh: str#

None

vof_mesh: str#

None

side: str#

‘left’

class zoomy_foam.vof.Tank#

The VOF tank [0, lx] x [0, ly] (thin in z), nx x ny cells, still water h0; the sides an Arm does not take are walls.

lx: float#

1.5

ly: float#

0.4

nx: int#

120

ny: int#

40

lz: float#

0.02

h0: float#

0.04

fo: dict#

‘field(…)’

zoomy_foam.vof.write_config(path, *, arms, t_end, window, exchange)#

The preCICE configuration of the tank (participant Vof) and its reduced arms: one parallel-explicit scheme for one arm, a multi scheme with the tank as controller (max-iterations 1: the explicit-equivalent single pass) for several; m2n sockets through the directory exchange (both containers must see it at that path).

zoomy_foam.vof.write_case(dest, tank, *, arms, config, t_end, window, write_interval=0.05)#

The tank case in dest: mesh (blockMeshDict), still water h0 (setFieldsDict), 0/ fields with the coupled patches fixedValue (the function object imposes them), controlDict with the function object on config. Returns dest.

zoomy_foam.vof.coupling_library(sm, *, cache=None)#

The directory holding libswePreciceCoupling.so built against the reduced model sm (its SystemModel: Model.H / NumericsKernels.H / MarchConstants.H emitted with the Foam printers next to a copy of this package’s C++ sources), built once per hash of the sources, the headers and the image.

zoomy_foam.vof.start(case, lib, *, log=None)#

blockMesh, setFields, then foamRun of the tank case with the function object from lib, in the background; returns the process (its output in log, default <case>/../log.vof).

zoomy_foam.vof.to_hdf5(case, out)#

The tank’s written time directories (foamToVTK) as a zoomy HDF5 store out.