4.11. User-Accessible Functions

As noted in Properties, you can directly incorporate your own formulations and data for the properties of the fuel cell membrane using the pem_user.c source code file.

The following listing represents a description of the contents of the pem_user.c source code file:

real Get_P_sat(real T, cell_t c, Thread *t)

Returns the value of the water vapor saturation pressure as a function of temperature (Equation 3–41) or other user-specified values.

real Water_Activity(realP, realT, cell_t c, Thread *t)

Returns the value of water activity (Equation 3–39).

real Water_Content(real act)

Returns the value of the membrane water content at the membrane catalyst interface (Equation 3–38).

real Osmotic_Drag_Coefficient(real P, real T, cell_t c, Thread *t)

Returns the value of the osmotic drag coefficient (Equation 3–35).

real Membrane_Conductivity(real lam, cell_t c, Thread *t)

Returns the value of the membrane’s protonic conductivity (Equation 3–34).

real Electrolyte_Conductivity(cell_t c, Thread *t)

Returns the value of the ionic conductivity in the electrolyte (Equation 3–33). (SOFC and Electrolysis only)

real Water_Content_Diffusivity(real lam, real T, real mem_mol_density,cell_tc,Thread*t)

Returns the value of the water content diffusivity in the membrane (Equation 3–37).

real Gas_Diffusivity(cell_tc, Thread *t, int j_spe)

Returns the value of the gaseous species diffusivities in the channels, gas diffusion layers and catalysts (Equation 3–30).

real MCD_Gas_Diffusivity(cell_t c, Thread *t, int i)

Returns the tortuosity-corrected value of the gas species diffusion coefficients computed with the multicomponent diffusion option (Equation 3–32).

real Saturation_Diffusivity(real sat, real cos_theta, real porosity, cell_t c, Thread *t)

Returns the value of diffusivity of the liquid saturation. It computes the term from Equation 3–26.

real Anode_AV_Ratio(cell_t c, Thread *t)

Returns the value of the specific active surface area ( in Equation 3–9) for the anode catalyst.

real Cathode_AV_Ratio(cell_t c, Thread *t)

Returns the value of the specific active surface area ( in Equation 3–10) for the cathode catalyst.

real Anode_J_TransCoef(cell_t c, Thread *t)

Returns the value of the anode reaction reference current density used in Equation 3–9.

real Cathode_J_TransCoef(cell_t c, Thread *t)

Returns the value of the cathode reaction reference current density used in Equation 3–10.

real Open_Cell_Voltage(cell_t c, Thread *t)

Returns the value of the open-circuit voltage used in Equation 3–14.

real Leakage_Current(cell_t c, Thread *t)

Returns the value of the leakage current ( in Equation 3–42 through Equation 3–47).

void Set_UDS_Names(char uds[n_uds_required][STRING_SIZE])

Used to rename user defined scalars (UDSs). Note that the units of the user defined scalars cannot be changed.

void Set_UDS_Names(char uds[n_uds_required][STRING_SIZE])
 {
      strncpy(uds[0], "Electric Potential", STRING_SIZE-1);
      strncpy(uds[1], "Protonic Potential", STRING_SIZE-1);
      strncpy(uds[2], "Water Saturation",  STRING_SIZE-1);
      strncpy(uds[3], "Water Content", STRING_SIZE-1);
 } 

If you want to change the names of UDSs, change the second argument of the strncpy functions, recompile and link the module as with any modification to pem_user.c. Note that STRING_SIZE is fixed in pem.h and should not be changed.


Important:  When you load older Fuel Cell and Electrolysis cases into ANSYS Fluent, and you are monitoring a UDS using volume or surface monitors, make sure you re-visit the corresponding monitors dialog box (for example, the Volume Monitor or the Surface Monitor dialog box) to make sure that the correct UDS name is used for the appropriate monitor.


void Set_UDM_Names(char udm[n_udm_required][STRING_SIZE])

Used to rename user defined memory (UDMs). Note that the units of user defined memory cannot be changed.

void Set_UDM_Names(char udm[n_udm_required][STRING_SIZE])
 {
     strncpy(udm[0], "X Current Flux Density",  STRING_SIZE-1);
     strncpy(udm[1], "Y Current Flux Density",  STRING_SIZE-1);
     strncpy(udm[2], "Z Current Flux Density",  STRING_SIZE-1);
     strncpy(udm[3], "Current Flux Density Magnitude", STRING_SIZE-1);
     strncpy(udm[4], "Ohmic Heat Source", STRING_SIZE-1);
     strncpy(udm[5], "Reaction Heat Source",  STRING_SIZE-1);
     strncpy(udm[6], "Overpotential", STRING_SIZE-1);
     strncpy(udm[7], "Phase Change Source (PEM)", STRING_SIZE-1);
     strncpy(udm[8], "Osmotic Drag Coefficient (PEM)", STRING_SIZE-1);
     strncpy(udm[9], "Liquid Water Activity (PEM)", STRING_SIZE-1);
     strncpy(udm[10], "Membrane Water Content (PEM)",  STRING_SIZE-1);
     strncpy(udm[11], "Protonic Conductivity", STRING_SIZE-1);
     strncpy(udm[12], "Back Diffusion Source (PEM)", STRING_SIZE-1);
     strncpy(udm[13], "Transfer Current",  STRING_SIZE-1);
     strncpy(udm[14], "Osmotic Drag Source (PEM)", STRING_SIZE-1);
 } 

If you want to change the names of UDMs, change the second argument of the strncpy functions, recompile and link the module as with any modification to pem_user.c. Note that STRING_SIZE is fixed in pem.h and should not be changed.


Important:  When you load older Fuel Cell and Electrolysis cases into ANSYS Fluent, and you are monitoring a UDM using volume or surface monitors, make sure you re-visit the corresponding monitors dialog box (for example, the Volume Monitor or the Surface Monitor dialog box) to make sure that the correct UDM name is used for the appropriate monitor.


real electric_contact_resistance(face_t f, Thread *t, int ns)

Returns the value for the electrical contact resistance.

real Transfer_Current(real i_ref, real gamma, int species_i, real alpha_a, real alpha_c, real *dRade, real *dRcde, Thread *t, cell_t c)

Computes the transfer current (), corresponding to in Equation 3–9 and in Equation 3–10.

Inputs for this function include:

i_ref effective transfer current coefficient, computed by Cathode_J_TransCoef(c,t) or Anode_J_TransCoef(c,t)
gamma cathode or anode concentration exponent
species_i species index used in fuel cells (for example i_o2, i_h2, i_h2o)
alpha_a product of anode exchange coefficient and
alpha_c product of cathode exchange coefficient and
t current thread
c current cell

Outputs for this function include:

source anode or cathode volumetric transfer current ( in Equation 3–9 or in Equation 3–10)
*dRade partial derivative of with respect to activation loss
*dRcde partial derivative of with respect to activation loss
Thermal_ctk_pemfc(face_t f, Thread *t)

Used to change the constant value of Thermal Contact Resistance for the porous zone set in the Porous Jump dialog box to a locally variable value.

For more information, see the following sections:


Release 18.2 - © ANSYS, Inc. All rights reserved.