ENVIRONMENT

Using the ENVIRONMENT command 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 command instead.
One feature of the ENVIRONMENT command is the following, the execution of this command 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 command 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.
LIST
Lists all Adams Solver (C++) runtime environment variables found.

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 you define the following environment variable from a Linux shell:
% setenv MSC_ADAMS_SOLVER_BEAM_MODEL=LINEAR
 
Let's assume the ADM dataset file has no ENVIRONMENT statements and that the ACF command file has the following commands:
ENV/NAME=MSC_ADAMS_SOLVER_BEAM_MODEL, VALUE=NONLINEAR
FILE/MODEL=beam_model
ENV/NAME=MSC_ADAMS_STATICS_NO_RESTORE_VELOCITIES
SIM/STA
Running the model, Adams Solver (C++) will print the following messages:
OS-environment variable
MSC_ADAMS_SOLVER_BEAM_MODEL=LINEAR
Enforces Adams Solver C++ to use a different beam model.
Options are LINEAR, STRING, NONLINEAR.
 
command: FILE/COMMAND=beam_model
command:
command: ENVIRONMENT/NAME=MSC_ADAMS_SOLVER_BEAM_MODEL, VALUE=STRING
 
User-environment variable
MSC_ADAMS_SOLVER_BEAM_MODEL=STRING
Enforces Adams Solver C++ to use a different beam model.
Options are LINEAR, STRING, NONLINEAR.
* Overwrites a previous definition.
 
command:
command: file/model=beam_model
 
---------------------------------------------------------------
| Model Title                         |
|==============================================================|
|                                                              |
| Beam model                           |
|                                                              |
----------------------------------------------------------------
 
command:
command: env/name = MSC_ADAMS_STATICS_NO_RESTORE_VELOCITIES
 
User-environment variable
MSC_ADAMS_STATICS_NO_RESTORE_VELOCITIES
Enforces Adams Solver C++ not to restore initial velocities after a STATIC analysis at time t=0.
 
Observe Adams Solver prints two messages regarding the MSC_ADAMS_SOLVER_BEAM_MODEL variable. The first one is printed when processing the operating system environment. The second one is printed when processing the ENVIRONMENT command. Notice the message "Overwrites a previous definition" indicating that the ENVIRONMENT command overwrote the value of the environment variable set in the operating system.
2. In this example the ENVIRONMENT command generates an error message. Let's assume the ACF command file is the following:
FILE/MODEL=beam_model
 
ENVIRONMENT/NAME=MSC_ADAMS_SOLVER_BEAM_MODEL, VALUE=NONLINEAR
 
SIM/STA
 
Running the above ACF command file, the following message is printed:
 
command: environment/name=MSC_ADAMS_SOLVER_BEAM_MODEL, value=STRING
 
 
---- START: ERROR ----
Environment variable MSC_ADAMS_SOLVER_BEAM_MODEL must be set before the model is constructed.
Command will be ignored.
 
To avoid this problems do one of these:
(1) Set the env variable in the operating system.
(2) Set the env variable in the *.adm file.
(3) Issue the ENV/ command before the FILE/MODEL command.
 
---- END: ERROR ----
Adams Solver (C++) prints an error message and ignores the setting of the the MSC_ADAMS_SOLVER_BEAM_MODEL because the model has already been constructed.
 
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 Simulation command available.