ENVIRONMENT

Using the ENVIRONMENT statement is an alternative way of setting an Adams Solver (C++) runtime environment variable. For example, rather than using the setenv command when working with the Linux operating system, one may use the ENVIRONMENT statement instead.
One feature of the ENVIRONMENT statement is the following, the execution of this statement does not modify the operating system environment; it only affects the Adams Solver (C++) runtime environment for the model being run. When the simulations are finished, the original operating system environment is left intact.
A second feature is related to the collection of environment variables one may set. Only environment variables related to the Adams Solver (C++) may be set. For example, you may not use this statement to set an environment variable used by other products.

Format

Arguments
 
NAME=c
Specifies a character string for the name of the Adams Solver (C++) runtime environment variable being set.
VALUE=c
Specifies a character string for the value of the Adams Solver (C++) runtime environment variable being set. Some variables do not need a value to be specified.
The character string may be enclosed between double quotes.
UNSET
Specifies the removal of the variable from the Adams Solver (C++) runtime environment.

Extended Definition

The operating system environment stands for a set of environment variables. Each of these environment variables has a name, and it may have an associated value. Both name and value are character strings set by the user using tools provided by the operating system.
The use of environment variables provides a simple mechanism to let users communicate preferences to a running computer program. The use of environment variables is a practical way to trigger the execution of undocumented features, workarounds, experimental methods, etc. without the need to modify the AMD/ACF language layers of the Adams Solver (C++).
When the execution of Adams Solver (C++) starts, all the environment variables are scanned and the Adams Solver (C++) runtime environment is created. The Adams Solver (C++) runtime environment is initialized with all the environment variables that the Adams Solver (C++) recognizes. Environment variables used by vertical applications or other products are not included in the Adams Solver (C++) runtime environment.
Next, when the model is being read, all of the ENVIRONMENT statements are processed one by one in the same order they are found in the ADM dataset file. The ENVIRONMENT statements will update or modify the Adams Solver (C++) runtime environment. If there is at least one ENVIRONMENT statement in the dataset file, Adams Solver (C++) prints a report of all the Adams Solver (C++) runtime environment variables and their corresponding values (if any) along with a description of the feature the variable is used for.
You may change the value of an Adams Solver (C++) runtime environment variable using the ENVIRONMENT command.
The advantages of having the ENVIRONMENT statement and command are:
It allows setting preferences at the model level rather than at the operating system level.
It helps reduce the pollution in the operating system environment and better manage the settings.

Examples

1. Let's assume the operating system has no definition for the environment variable by the name MSC_ADAMS_SOLVER_BEAM_MODEL. Also, let's assume you run a model defined by an ADM dataset including the following statement:
ENV/
, NAME=MSC_ADAMS_SOLVER_BEAM_MODEL,
, VALUE=NONLINEAR
Running the model, Adams Solver (C++) will print the following message:
 
List of User-environment variables defined in data/command files
---------------------------------------------------------------
 
MSC_ADAMS_SOLVER_BEAM_MODEL=NONLINEAR
Enforces Adams Solver C++ to use a different beam model.
Options are LINEAR, STRING, NONLINEAR.
 
Observe Adams Solver prints a brief description of the environment variable. Notice you do not need to modify the operating system environment.
2. Let's assume you define the following environment variable from a Linux shell:
% setenv MSC_ADAMS_SOLVER_BEAM_MODEL=LINEAR
This environment variable specifies using a linear model for the BEAM formulation. Next, you run a model defined by an ADM dataset including the following statement:
ENV/
, NAME=MSC_ADAMS_SOLVER_BEAM_MODEL,
, VALUE=NONLINEAR
Notice the intent is to overwrite any previous definition of the variable. Running the model, Adams Solver (C++) will print the following message:
 
List of User-environment variables defined in data/command files
----------------------------------------------------------------
 
MSC_ADAMS_SOLVER_BEAM_MODEL=NONLINEAR
Enforces Adams Solver C++ to use a different beam model.
Options are LINEAR, STRING, NONLINEAR.
* Overwrites a previous definition.
 
Observe Adams Solver prints the note "Overwrites a previous definition" indicating that the ENVIRONMENT statement overwrote the value of the environment variable set in the operating system.
3. In this example we use the ENVIRONMENT statement to unset any previous definition of an environment variable.
ENV/
, NAME=MSC_ADAMS_SOLVER_BEAM_MODEL, UNSET
 
If the environment variable was not defined, the statement is ignored with a warning message.
 
Caution:  
Environment variables are typically intended for experimentation and testing of undocumented features. They may be removed in a future release without notice. Please bear this in mind when using the ENVIRONMENT statement and command.
See other Analysis parameters available.