You can incorporate your own correlations and data for the properties
of the battery using the cae_user.c source
code file.
The following listing represents a description of the contents
of the cae_user.c source code file:
real CONDUCTIVITY_CELL(cell_t c, Thread
*t, int i): Returns values for the electrical conductivity
for cells inside passive conductive zones, overwriting the values
set in the Create/Edit Materials dialog box.
real CONTACT_RESIST_FACE(cell_t f, Thread
*t): Returns values for the electrical contact resistance,
overwriting the values set in the Electric Field tab of the MSMD Battery Model dialog box.
real Compute_U (face_t f, Thread *t, real
DOD, real dUdJ, real a[], real *dUdJ): Returns values
for both U and the derivative of U with respect to J (dUdJ). Note that DOD represents
the depth of discharge and a[] is the set
of U coefficients.
real Compute_Y (face_t f, Thread *t, real
DOD, real b[]): Returns values for Y. Note that DOD represents the depth of discharge and b[] is the set of Y coefficients.
void Compute_ECM_VOC_and_CR(real soc,
real T, int mode, real *Voc, real *RRs, real *RR1, real *RR2, real
*CC1, real *CC2): Returns values for ECM model-related
parameters. You can use this function to implement ECM parameters
in any function form.
real Compute_OCP_NE(real x, real T): Returns a value for open circuit potential at negative electrode ( in Equation 3–2). By default, it is computed using functions in [4].
real Compute_OCP_PE(real x, real T): Returns a value for open circuit potential at positive electrode ( in Equation 3–2). By default, it is computed using functions in [4].
real Compute_kappa(real ce, real T): Returns a value for (Equation 3–19).
By default, it is computed using functions in [4].
real Compute_Diff0_ce(real ce, real T): Returns a value for (Equation 3–19). By default, it is computed
using functions in [4].
real Compute_tplus(real ce, real T): Returns a value for (Equation 3–19).
By default, it is computed using functions in [4].
real Compute_Ds_PE(real cs, real T): Returns a value for the positive electrode diffusion coefficient (Equation 3–12). By default, a constant value from GUI input is used.
real Compute_Ds_NE(real cs, real T): Returns a value for the negative electrode diffusion coefficient (Equation 3–12). By default, a constant value from GUI input is used.
real Compute_dlnfdlnce(real ce, real T): Returns a value for the term from Equation 3–19. By default, this term is not considered.
real Compute_entropy_heat(real soc): Returns the entropic heat. By default, it is not considered in
all MSMD submodels. You can include it by defining in this UDF.
void user_defined_echem_model(int zero_start,
int mode, real temperature, real voltage, real current, real dtime,
real *j_tmp, real *Qe_tmp, real *voltage_end): Defines
the user-defined electrochemical model. A template for the user implementation
of the NTGK model is provided as an example.
For more information, see the following sections:
This section includes instructions on how to compile a customized
Battery user-defined module. Note that you can also refer to the file INSTRUCTIONS-CLIENT that comes with your distribution
(see addons/msmdbatt).
Important: It is assumed that you have a basic familiarity with compiling user-defined functions (UDFs). For an introduction on how to compile UDFs, refer to the separate Fluent Customization Manual.
You will first want to use a local copy of the msmdbatt directory in the addons directory before
you recompile the Battery module.
Make a local copy of the msmdbatt directory. Do not create a symbolic link.
Important: The custom version of the library must be named according to
the convention used by ANSYS Fluent: for example, msmdbatt.
Change directories to the msmdbatt/src directory.
Make changes to the cae_user.c file.
Edit the makefile located
in the src/ directory and make sure that
the FLUENT_INC variable correctly refers
to the current ANSYS Fluent installation directory. Be careful not to
leave any trailing spaces when you make your changes.
Define the FLUENT_ADDONS environment
variable to correspond to your customized version of the Battery module.
Change directories to the msmdbatt/ directory.
Issue the following make command:
make FLUENT_INC=[ansys_inc/v182/fluent] FLUENT_ARCH=[arch] -f Makefile-client
where your_arch is lnamd64 on LINUX.
The following example demonstrates the steps required to set
up and run a customized version of the Battery module that is located
in a folder call home/sample:
Make a directory (for example, mkdir-p /home/sample).
Copy the default addon library to this location.
cp -RH [ansys_inc/v182/fluent]/fluent18.2.0/addons/msmdbatt /home/sample/msmdbatt
Using a text editor, make the appropriate changes to the cae_user.c file located in /home/sample/msmdbatt/src/cae_user.c
Edit the makefile located in the src/ directory and make sure that the FLUENT_INC variable correctly refers to the current ANSYS Fluent installation directory. Be careful not to leave any trailing spaces when you make your changes.
Build the library.
cd /home/sample/msmdbatt make FLUENT_INC=[ansys_inc/v182/fluent] FLUENT_ARCH=[arch] -f Makefile-client
Set the FLUENT_ADDONS environment variable (using CSH, other shells will differ).
setenv FLUENT_ADDONS /home/sample
Start ANSYS Fluent and load the customized module using the text interface command.
Open Visual Studio.NET at the DOS prompt.
Make sure that the FLUENT_INC environment variable is correctly set to the current ANSYS Fluent installation
directory (for example, ANSYS Inc\v182\fluent).
Make a local copy of the msmdbatt folder. Do not create a shortcut.
Enter the msmdbatt\src folder.
Make changes to the cae_user.c file.
Define the FLUENT_ADDONS environment
variable to correspond to your customized version of the Battery module.
Return to the msmdbatt folder.
Issue the following command in the command window:
nmake /f makefile_client.nt