seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
Ice/brine fronts

Planar front, rejection coefficient, profile, and pockets. More...

Functions

SEAMS_API seams_status seams_brine_analyse (seams_system *sys, const int *ice, size_t n_ice, int water_type, int ion_type, int n_bins, int axis, seams_brine **out)
 Planar ice/brine front from an ice assignment.
SEAMS_API void seams_brine_destroy (seams_brine *front)
 Free a brine-front handle.
SEAMS_API seams_status seams_brine_fronts (const seams_brine *front, double *z_enter, double *z_exit, double *thickness, int *found)
 The two planar crossings of the ice slab.
SEAMS_API seams_status seams_brine_rejection (const seams_brine *front, double *c_ice, double *c_liquid, double *k, int *defined)
 Molal rejection coefficient k = c_ice / c_liquid.
SEAMS_API seams_status seams_brine_profile (const seams_brine *front, double *z_mid, double *molality, double *ice_fraction, size_t cap, size_t *n_out)
 Concentration profile along the front axis.
SEAMS_API seams_status seams_brine_pockets (const seams_brine *front, int *n_pockets, int *reservoir_waters)
 Brine pockets trapped in the ice, excluding the liquid reservoir.

Detailed Description

Planar front, rejection coefficient, profile, and pockets.

Function Documentation

◆ seams_brine_analyse()

SEAMS_API seams_status seams_brine_analyse ( seams_system * sys,
const int * ice,
size_t n_ice,
int water_type,
int ion_type,
int n_bins,
int axis,
seams_brine ** out )

Planar ice/brine front from an ice assignment.

ice[i] is non-zero when atom i is ice. water_type 0 keeps every atom whose type is not ion_type. ion_type 0 means the frame has no ions. n_bins 0 selects 20 bins. axis is 0, 1, or 2. The ice fraction cut is 0.5, and the bulk ice and liquid cuts are 0.85 and 0.15.

Parameters
sysFrame handle.
icePer-atom ice flags, length n_ice.
n_iceMust equal the frame count.
water_typeSpecies kept as water, or 0.
ion_typeSpecies kept as ions, or 0 for none.
n_binsBin count along axis, or 0 for 20.
axis0, 1, or 2.
outReceives a new handle. On failure *out is NULL.
Returns
SEAMS_OK, or SEAMS_ERR_NULL, SEAMS_ERR_STATE, SEAMS_ERR_RANGE, SEAMS_ERR_ARG, SEAMS_ERR_NOMEM, SEAMS_ERR_INTERNAL.
Handle access
Non-const only because the call clears the handle's error slot on entry, so seams_handle_error() reports this call. It reads the frame and keeps no scratch on the handle.
Ownership
The caller frees *out with seams_brine_destroy().
Thread safety
Exclusive use of sys.
Example
seams_brine *front = NULL;
if (seams_brine_analyse(sys, ice, n, 1, 2, 0, 2, &front) == SEAMS_OK) {
}
SEAMS_API seams_status seams_brine_analyse(seams_system *sys, const int *ice, size_t n_ice, int water_type, int ion_type, int n_bins, int axis, seams_brine **out)
Planar ice/brine front from an ice assignment.
SEAMS_API void seams_brine_destroy(seams_brine *front)
Free a brine-front handle.
struct seams_brine seams_brine
One planar ice/brine front measurement.
Definition seams.h:249
@ SEAMS_OK
The call succeeded.
Definition seams.h:154

◆ seams_brine_destroy()

SEAMS_API void seams_brine_destroy ( seams_brine * front)

Free a brine-front handle.

Parameters
frontHandle from seams_brine_analyse(), or NULL. NULL is ignored.
Ownership
Releases the handle and its profile.
Thread safety
The caller must not use front after this returns.
Example

◆ seams_brine_fronts()

SEAMS_API seams_status seams_brine_fronts ( const seams_brine * front,
double * z_enter,
double * z_exit,
double * thickness,
int * found )

The two planar crossings of the ice slab.

Lengths are Angstrom, in the frame's cell.

Parameters
frontBrine handle.
z_enterWhere the ice fraction crosses the cut on entering the ice along the positive axis, or NULL.
z_exitThe crossing on leaving the ice, or NULL.
thicknessIce run along the axis, or NULL.
foundReceives 1 when both crossings exist, otherwise 0, or NULL.
Returns
SEAMS_OK, or SEAMS_ERR_NULL when front is NULL or every output pointer is NULL.
Ownership
The caller owns front; the call borrows it. z_enter, z_exit, thickness and found are caller storage that the call fills. The library keeps no pointer to any argument.
Thread safety
Read-only: may run alongside other const calls on front, and not alongside a non-const call on front.
Example
double thick = 0;
int found = 0;
seams_brine_fronts(front, NULL, NULL, &thick, &found);
SEAMS_API seams_status seams_brine_fronts(const seams_brine *front, double *z_enter, double *z_exit, double *thickness, int *found)
The two planar crossings of the ice slab.

◆ seams_brine_pockets()

SEAMS_API seams_status seams_brine_pockets ( const seams_brine * front,
int * n_pockets,
int * reservoir_waters )

Brine pockets trapped in the ice, excluding the liquid reservoir.

Parameters
frontBrine handle.
n_pocketsReceives the pocket count, or NULL.
reservoir_watersReceives the water count of the liquid reservoir, or NULL.
Returns
SEAMS_OK, or SEAMS_ERR_NULL when front is NULL or both output pointers are NULL.
Ownership
The caller owns front; the call borrows it. n_pockets and reservoir_waters are caller storage that the call fills. The library keeps no pointer to any argument.
Thread safety
Read-only: may run alongside other const calls on front, and not alongside a non-const call on front.
Example
int pockets = 0;
seams_brine_pockets(front, &pockets, NULL);
SEAMS_API seams_status seams_brine_pockets(const seams_brine *front, int *n_pockets, int *reservoir_waters)
Brine pockets trapped in the ice, excluding the liquid reservoir.

◆ seams_brine_profile()

SEAMS_API seams_status seams_brine_profile ( const seams_brine * front,
double * z_mid,
double * molality,
double * ice_fraction,
size_t cap,
size_t * n_out )

Concentration profile along the front axis.

z_mid is Angstrom. molality is mol/kg. ice_fraction is dimensionless.

Parameters
frontBrine handle.
z_midBin centers, or NULL to skip the column.
molalityBin molalities, or NULL to skip the column.
ice_fractionBin ice fractions, or NULL to skip the column.
capCapacity of each non-NULL column.
n_outReceives the bin count.
Returns
SEAMS_OK when every non-NULL column was filled, or when every column pointer was NULL and n_out was written. SEAMS_ERR_RANGE when a non-NULL column is short. SEAMS_ERR_NULL when front or n_out is NULL.
Ownership
The caller owns the columns.
Thread safety
Read-only: may run alongside other const calls on front, and not alongside a non-const call on front.
Example
size_t bins = 0;
seams_brine_profile(front, NULL, NULL, NULL, 0, &bins);
SEAMS_API seams_status seams_brine_profile(const seams_brine *front, double *z_mid, double *molality, double *ice_fraction, size_t cap, size_t *n_out)
Concentration profile along the front axis.

◆ seams_brine_rejection()

SEAMS_API seams_status seams_brine_rejection ( const seams_brine * front,
double * c_ice,
double * c_liquid,
double * k,
int * defined )

Molal rejection coefficient k = c_ice / c_liquid.

Molality is formula units per kilogram of water.

Parameters
frontBrine handle.
c_iceBulk ice molality, or NULL.
c_liquidBulk liquid molality, or NULL.
kThe ratio, or NULL. Unchanged when the ratio is undefined.
definedReceives 1 when the liquid bulk contains salt or the ice bulk does not, otherwise 0, or NULL.
Returns
SEAMS_OK, or SEAMS_ERR_NULL when front is NULL or every output pointer is NULL.
Ownership
The caller owns front; the call borrows it. c_ice, c_liquid, k and defined are caller storage that the call fills. The library keeps no pointer to any argument.
Thread safety
Read-only: may run alongside other const calls on front, and not alongside a non-const call on front.
Example
double k = 0;
int defined = 0;
seams_brine_rejection(front, NULL, NULL, &k, &defined);
SEAMS_API seams_status seams_brine_rejection(const seams_brine *front, double *c_ice, double *c_liquid, double *k, int *defined)
Molal rejection coefficient k = c_ice / c_liquid.