Input File

To access a user-defined function in AcuSolve, you must reference it in the input file.

For example, to access the user-defined function usrMyViscosity() in the viscosity model, the following command may be specified in the input file:
VISCOSITY_MODEL( "my viscosity" ) {
   type = user_function
   user_function = "usrMyViscosity"
   user_values = { 1.781e-5, 2, 3 }
   user_strings = { "string1", "string2" }
}

In this example, the viscosity model my viscosity has a user_function type. This type requires, as a minimum, the name of the user-programmed routine, which is usrMyViscosity() for the example above. The value of the user_function parameter is exactly the name of the function (routine) used in the C program written by you. The parameters user_values and user_strings are used to pass parameters to the user function. In this example, three floating-point numbers and two strings are passed to the function. The order of these parameters is preserved, for example, the first user value is 1.781e-5, the second is two, and the third is three.

User-defined functions may be used by any of the following categories of commands:
  1. Multiplier Function: MULTIPLIER_FUNCTION
  2. Mesh Motion: MESH_MOTION, FLEXIBLE_BODY
  3. Body Force: GRAVITY, MASS_HEAT_SOURCE, VOLUME_HEAT_SOURCE, MASS_SPECIES_SOURCE, VOLUME_SPECIES_SOURCE
  4. Material Model: DENSITY_MODEL, SPECIFIC_HEAT_MODEL, VISCOSITY_MODEL, CONDUCTIVITY_MODEL, DIFFUSIVITY_MODEL, POROSITY_MODEL, EMISSIVITY_MODEL, SURFACE_TENSION_MODEL, SOLAR_RADIATION_MODEL
  5. Component Model: FAN_COMPONENT, HEAT_EXCHANGER_COMPONENT
  6. Element Output ELEMENT_OUTPUT
  7. Element Boundary Condition: ELEMENT_BOUNDARY_CONDITION
  8. Nodal Boundary Condition: NODAL_BOUNDARY_CONDITION
  9. Periodic Boundary Condition: PERIODIC_BOUNDARY_CONDITION

See the AcuSolve Command Reference Manual for examples of user-defined functions for each of the above commands.