3.2.9. User-Accessible Functions

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:

For more information, see the following sections:

3.2.9.1. Compiling the Customized Battery Source Code

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.

3.2.9.1.1. Compiling the Customized Source Code Under Linux
  1. 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.


  2. Change directories to the msmdbatt/src directory.

  3. Make changes to the cae_user.c file.

  4. 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.

  5. Define the FLUENT_ADDONS environment variable to correspond to your customized version of the Battery module.

  6. Change directories to the msmdbatt/ directory.

  7. 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:

  1. Make a directory (for example, mkdir-p /home/sample).

  2. Copy the default addon library to this location.

     cp -RH [ansys_inc/v182/fluent]/fluent18.2.0/addons/msmdbatt
     /home/sample/msmdbatt 
    
  3. Using a text editor, make the appropriate changes to the cae_user.c file located in /home/sample/msmdbatt/src/cae_user.c

  4. 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.

  5. Build the library.

    cd /home/sample/msmdbatt 
    make FLUENT_INC=[ansys_inc/v182/fluent] FLUENT_ARCH=[arch]
     -f Makefile-client 
    
  6. Set the FLUENT_ADDONS environment variable (using CSH, other shells will differ).

     setenv FLUENT_ADDONS /home/sample 
    
  7. Start ANSYS Fluent and load the customized module using the text interface command.

3.2.9.1.2. Compiling the Customized Source Code Under Windows
  1. Open Visual Studio.NET at the DOS prompt.

  2. Make sure that the FLUENT_INC environment variable is correctly set to the current ANSYS Fluent installation directory (for example, ANSYS Inc\v182\fluent).

  3. Make a local copy of the msmdbatt folder. Do not create a shortcut.

  4. Enter the msmdbatt\src folder.

  5. Make changes to the cae_user.c file.

  6. Define the FLUENT_ADDONS environment variable to correspond to your customized version of the Battery module.

  7. Return to the msmdbatt folder.

  8. Issue the following command in the command window:

    nmake /f makefile_client.nt

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