MASA-0.44.0
|
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
MASA public API.
masa.h is the header file for the MASA library which contains all public objects and member functions for the C/C++ interfaces. To use, be sure to
in any C or C++ programs calling MASA routines. In addition, all C++ functions are encapsulated within a MASA namespace, and thus C++ routines require an additional namespace directive for access:
Several simple examples for using these functions are provided in the examples/ director from a local MASA installation. Note that functions which have an integer return value return "0" upon success. The following sections highlight the available MASA functions.
Functions | |
int | masa_test_default (double input) |
Problem Definition Routines | |
int | masa_init (const char *handle, const char *unique_solution_name) |
int | masa_purge_default_param () |
int | masa_select_mms (const char *handle) |
int | masa_list_mms () |
int | masa_init_param () |
void | masa_set_param (const char *param_name, double new_value) |
double | masa_get_param (const char *param_name) |
void | masa_set_array (const char *vector_name, int *length, double new_array[]) |
int | masa_get_array (const char *param_name, int *length, double *array) |
1D Source Terms | |
double | masa_eval_1d_source_t (double x) |
double | masa_eval_1d_source_u (double x) |
double | masa_eval_1d_source_e (double x) |
double | masa_eval_1d_source_rho (double x) |
double | masa_eval_1d_source_rho_u (double x) |
double | masa_eval_1d_source_rho_e (double x) |
double | masa_eval_1d_source_rho_N (double x, double(*)(double)) |
double | masa_eval_1d_source_rho_N2 (double x, double(*)(double)) |
1D Manufactured Analytical Solution Terms | |
double | masa_eval_1d_exact_t (double x) |
double | masa_eval_1d_exact_u (double x) |
double | masa_eval_1d_exact_p (double x) |
double | masa_eval_1d_exact_rho (double x) |
double | masa_eval_1d_exact_rho_N (double x) |
double | masa_eval_1d_exact_rho_N2 (double x) |
2D Source Terms | |
double | masa_eval_2d_source_t (double x, double y) |
double | masa_eval_2d_source_u (double x, double y) |
double | masa_eval_2d_source_v (double x, double y) |
double | masa_eval_2d_source_e (double x, double y) |
double | masa_eval_2d_source_rho (double x, double y) |
double | masa_eval_2d_source_rho_u (double x, double y) |
double | masa_eval_2d_source_rho_v (double x, double y) |
double | masa_eval_2d_source_rho_w (double x, double y) |
double | masa_eval_2d_source_rho_e (double x, double y) |
double | masa_eval_2d_source_f (double x, double y) |
2D Manufactured Analytical Solution Terms | |
double | masa_eval_2d_exact_t (double x, double y) |
double | masa_eval_2d_exact_u (double x, double y) |
double | masa_eval_2d_exact_v (double x, double y) |
double | masa_eval_2d_exact_p (double x, double y) |
double | masa_eval_2d_exact_rho (double x, double y) |
double | masa_eval_2d_exact_phi (double x, double y) |
3D Source Terms | |
double | masa_eval_3d_source_t (double x, double y, double z) |
double | masa_eval_3d_source_u (double x, double y, double z) |
double | masa_eval_3d_source_v (double x, double y, double z) |
double | masa_eval_3d_source_w (double x, double y, double z) |
double | masa_eval_3d_source_e (double x, double y, double z) |
double | masa_eval_3d_source_rho (double x, double y, double z) |
double | masa_eval_3d_source_rho_u (double x, double y, double z) |
double | masa_eval_3d_source_rho_v (double x, double y, double z) |
double | masa_eval_3d_source_rho_w (double x, double y, double z) |
double | masa_eval_3d_source_rho_e (double x, double y, double z) |
3D Manufactured Analytical Solution Terms | |
double | masa_eval_3d_exact_t (double x, double y, double z) |
double | masa_eval_3d_exact_u (double x, double y, double z) |
double | masa_eval_3d_exact_v (double x, double y, double z) |
double | masa_eval_3d_exact_w (double x, double y, double z) |
double | masa_eval_3d_exact_p (double x, double y, double z) |
double | masa_eval_3d_exact_rho (double x, double y, double z) |
Gradients of Analytical Solutions | |
double | masa_eval_1d_grad_u (double x) |
double | masa_eval_2d_grad_u (double x, double y, int direction) |
double | masa_eval_3d_grad_u (double x, double y, double z, int direction) |
double | masa_eval_2d_grad_v (double x, double y, int direction) |
double | masa_eval_3d_grad_v (double x, double y, double z, int direction) |
double | masa_eval_3d_grad_w (double x, double y, double z, int direction) |
double | masa_eval_1d_grad_p (double x) |
double | masa_eval_2d_grad_p (double x, double y, int direction) |
double | masa_eval_3d_grad_p (double x, double y, double z, int direction) |
double | masa_eval_1d_grad_rho (double x) |
double | masa_eval_2d_grad_rho (double x, double y, int direction) |
double | masa_eval_3d_grad_rho (double x, double y, double z, int direction) |
Utility functions | |
int | masa_get_name (char *name) |
int | masa_get_dimension (int *dimension) |
int | masa_display_param () |
int | masa_display_array () |
int | masa_sanity_check () |
int masa_display_array | ( | ) |
Subroutine will output the currently selected manufactured solution class' vector names and lengths to standard output
int masa_display_param | ( | ) |
Subroutine will output the currently selected manufactured solution class' parameter names and values to standard output
double masa_eval_1d_exact_p | ( | double | x | ) |
This subroutine will return the value of the analytical term for the pressure of the currently selected one dimensional masa function. Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_exact_rho | ( | double | x | ) |
Subroutine that will return the value of the manufactured analytical term for the density of the currently selected one dimensional masa function.
double masa_eval_1d_exact_rho_N | ( | double | x | ) |
Subroutine that will return the value of the manufactured analytical term for concentration of Nitrogen in the currently selected one dimensional masa function.
double masa_eval_1d_exact_rho_N2 | ( | double | x | ) |
Subroutine that will return the value of the manufactured analytical term for the concentration of Nitrogen-two in the currently selected one dimensional masa function.
double masa_eval_1d_exact_t | ( | double | x | ) |
Subroutine that will return the value of the analytical term for the temperature of the currently selected one dimensional masa function.
Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_exact_u | ( | double | x | ) |
Subroutine that will return the value of the analytical term for the u component of velocity of the currently selected one dimensional masa function. Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_grad_p | ( | double | x | ) |
This subroutine returns the gradient of the analytical solution for the pressure. It should be called for solutions with a single dimension.
double masa_eval_1d_grad_rho | ( | double | x | ) |
This subroutine returns the gradient of the analytical solution for the density (rho). It should be called for solutions with a single dimension.
double masa_eval_1d_grad_u | ( | double | x | ) |
This subroutine returns the gradient of the analytical solution for the u-component of velocity. It should be called for solutions with a single dimension.
double masa_eval_1d_source_e | ( | double | x | ) |
Subroutine that will return the value of the source term for the energy of the currently selected one dimensional masa function
double masa_eval_1d_source_rho | ( | double | x | ) |
Subroutine that will return the value of the source term for the density of the currently selected one dimensional masa function
Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_source_rho_e | ( | double | x | ) |
Subroutine that will return the value of the source term for the density*energy of velocity of the currently selected one dimensional masa function Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_source_rho_N | ( | double | x, |
double(*)(double) | |||
) |
Subroutine that will return the value of the source term for the concentration of Nitrogen in the currently selected one dimensional masa function. Note that the 2nd argument is a function pointer, specifying the address of a function that provides the reaction rate constant as a function of temperature.
double masa_eval_1d_source_rho_N2 | ( | double | x, |
double(*)(double) | |||
) |
Subroutine that will return the value of the source term for the concentration of Nitrogen-two in the currently selected one dimensional masa function. Here, the 2nd argument is a function pointer, specifying the address of a function that provides the reaction rate constant as a function of temperature.
double masa_eval_1d_source_rho_u | ( | double | x | ) |
Subroutine that will return the value of the source term for the density*u-component of velocity of the currently selected one dimensional masa function Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_1d_source_t | ( | double | x | ) |
Evaluate the one dimensional source term of the temperature.
[in] | x | Double precision value of the spatial location. |
double masa_eval_1d_source_u | ( | double | x | ) |
Subroutine that will return the value of the source term for the u component of velocity of the currently selected one dimensional masa function
Subroutine returns a double of the currently held value of the specified variable.
double masa_eval_2d_exact_p | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the analytical term for the pressure of the currently selected two dimensional masa function.
double masa_eval_2d_exact_phi | ( | double | x, |
double | y | ||
) |
Subroutine that returns the value of the analytical term for phi of the currently selected two dimensional masa function.
double masa_eval_2d_exact_rho | ( | double | x, |
double | y | ||
) |
A subroutine that will return the value of the analytical term for the density of the currently selected two dimensional masa function.
double masa_eval_2d_exact_t | ( | double | x, |
double | y | ||
) |
subroutine that returns the value of the analytical term for the temperature of the currently selected two dimensional masa function.
double masa_eval_2d_exact_u | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the analytical term for the u component of velocity of the currently selected two dimensional masa function.
double masa_eval_2d_exact_v | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the analytical term for the v component of velocity of the currently selected two dimensional masa function.
double masa_eval_2d_grad_p | ( | double | x, |
double | y, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the pressure. It should be called for solutions with two dimensions.
double masa_eval_2d_grad_rho | ( | double | x, |
double | y, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the density (rho). It should be called for solutions with two dimensions.
double masa_eval_2d_grad_u | ( | double | x, |
double | y, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the u-component of velocity. It should be called for solutions with two dimensions.
double masa_eval_2d_grad_v | ( | double | x, |
double | y, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the v-component of velocity. It should be called for solutions with two dimensions.
double masa_eval_2d_source_e | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the energy of the currently selected two dimensional masa function.
double masa_eval_2d_source_f | ( | double | x, |
double | y | ||
) |
Returns the value of the source term for the laplacian operator.
double masa_eval_2d_source_rho | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the density of the currently selected two dimensional masa function.
double masa_eval_2d_source_rho_e | ( | double | x, |
double | y | ||
) |
Returns the value of the source term for the density*energy for the currently selected two dimensional masa function.
double masa_eval_2d_source_rho_u | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the density*u-component of velocity for the currently selected two dimensional masa function.
double masa_eval_2d_source_rho_v | ( | double | x, |
double | y | ||
) |
Returns the value of the source term for the density*v-component of velocity for the currently selected two dimensional masa function.
double masa_eval_2d_source_rho_w | ( | double | x, |
double | y | ||
) |
Returns the value of the source term for the density*w-component of velocity for the currently selected two dimensional masa function.
double masa_eval_2d_source_t | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the temperature of the currently selected two dimensional masa function.
double masa_eval_2d_source_u | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the u component of velocity for the currently selected two dimensional masa function.
double masa_eval_2d_source_v | ( | double | x, |
double | y | ||
) |
Subroutine that will return the value of the source term for the v component of velocity for the currently selected two dimensional masa function.
double masa_eval_3d_exact_p | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the pressure of the currently selected three dimensional masa function.
double masa_eval_3d_exact_rho | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the density of the currently selected three dimensional masa function.
double masa_eval_3d_exact_t | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the temperature of the currently selected three dimensional masa function.
double masa_eval_3d_exact_u | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the u component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_exact_v | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the v component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_exact_w | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the analytical term for the w component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_grad_p | ( | double | x, |
double | y, | ||
double | z, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the pressure. It should be called for solutions with three dimensions.
double masa_eval_3d_grad_rho | ( | double | x, |
double | y, | ||
double | z, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the density (rho). It should be called for solutions with three dimensions.
double masa_eval_3d_grad_u | ( | double | x, |
double | y, | ||
double | z, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the u-component of velocity. It should be called for solutions with three dimensions.
double masa_eval_3d_grad_v | ( | double | x, |
double | y, | ||
double | z, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the v-component of velocity. It should be called for solutions with three dimensions.
double masa_eval_3d_grad_w | ( | double | x, |
double | y, | ||
double | z, | ||
int | direction | ||
) |
This subroutine returns the gradient of the analytical solution for the w-component of velocity. It should be called for solutions with three dimensions.
double masa_eval_3d_source_e | ( | double | x, |
double | y, | ||
double | z | ||
) |
A subroutine that will return the value of the source term for the energy of the currently selected three dimensional masa function.
double masa_eval_3d_source_rho | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the source term for the density of the currently selected three dimensional masa function.
double masa_eval_3d_source_rho_e | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the source term for the density*energy of the currently selected three dimensional masa function.
double masa_eval_3d_source_rho_u | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the source term for the density*u-component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_source_rho_v | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the source term for the density*v-component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_source_rho_w | ( | double | x, |
double | y, | ||
double | z | ||
) |
This subroutine returns the value of the source term for the density*w-component of velocity of the currently selected three dimensional masa function.
double masa_eval_3d_source_t | ( | double | x, |
double | y, | ||
double | z | ||
) |
A subroutine that will return the value of the source term for the temperature of the currently selected three dimensional masa function
double masa_eval_3d_source_u | ( | double | x, |
double | y, | ||
double | z | ||
) |
A subroutine that will return the value of the source term for the u component of velocity for the currently selected three dimensional masa function.
double masa_eval_3d_source_v | ( | double | x, |
double | y, | ||
double | z | ||
) |
A subroutine that will return the value of the source term for the v component of velocity for the currently selected three dimensional masa function.
double masa_eval_3d_source_w | ( | double | x, |
double | y, | ||
double | z | ||
) |
A subroutine that will return the value of the source term for the w component of velocity for the currently selected three dimensional masa function.
int masa_get_array | ( | const char * | param_name, |
int * | length, | ||
double * | array | ||
) |
Will return a particular registered variables inside the currently selected manufactured solution class.
This routine takes three arguments: a character string for the particular variable value to be returned, an integer passed-by-reference specifying the length of the array, and a pointer returning the address of the array
int masa_get_dimension | ( | int * | dimension | ) |
Subroutine takes an integer pointer, which is returned as the dimension of the currently initialized solution.
int masa_get_name | ( | char * | name | ) |
Subroutine will return a string with the current manufactured solution name.
double masa_get_param | ( | const char * | param_name | ) |
Will return a particular registered variables inside the currently selected manufactured solution class.
This routine takes one argument: a character string for the particular variable value to be returned.
Subroutine returns a double of the currently held value of the specified variable.
int masa_init | ( | const char * | handle, |
const char * | unique_solution_name | ||
) |
Initalizes a masa manufactured solution class.
This routine takes two arguments, both strings of characters. The first character string is a handle for the newly initalized class. (e.g. "nick's mms")
The second character string is the unique masa identifier string for a particular masa class. (e.g. "euler_1d"). See the tutorial for more information on all available solution strings.
The routine returns an integer 0 for success. It will throw an exception and return 1 if no manufactured solutions of the 2nd argument exist.
int masa_init_param | ( | ) |
Subroutine that will initalize all the registered variables to selected defaults for the currently selected manufactured solution class.
Returns integer 0 for success. A return value of n indicates n failures within init_param, generally from calling set_var() with incorrect arguments.
int masa_list_mms | ( | ) |
This will display (to stdout) the number of user initalized solutions.
In addition, it will then display each solutions unique handle and full manufactured class name
Subroutine returns integer 0 for success.
int masa_purge_default_param | ( | ) |
This function sets all masa parameters to uninitalized
int masa_sanity_check | ( | ) |
Subroutine that will check that all parameters for the currently selected masa manufactured class have been initalized to some value.
Subroutine returns an integer 0 on success.
int masa_select_mms | ( | const char * | handle | ) |
masa_select_mms selects an already initalized manufactured solution class.
Thus, if the user had created two manufactured classes (say, nick and bob) using masa_init, he could switch between them by passing the handle to this routine.
ex. masa_select_mms("nick")
Subroutine returns integer 0 for success.
void masa_set_array | ( | const char * | vector_name, |
int * | length, | ||
double | new_array[] | ||
) |
Subroutine that will set a particular registered vector inside the currently selected manufactured solution class.
This routine takes three arguments: a character string for the particular variable to be set, an integer specifying the length of the array, and a double precision pointer to an array.
This routine can be called multiple times, with subsequent calls overwriting the previously held array.
void masa_set_param | ( | const char * | param_name, |
double | new_value | ||
) |
Subroutine that will set a particular registered variables inside the currently selected manufactured solution class.
This routine takes two arguments: a character string for the particular variable to be set, and a double precision number to use as the new value of the variable.
This routine can be called multiple times, with subsequent calls overwriting the previously held variable value.
int masa_test_default | ( | double | input | ) |
This function tests if a value is set to default