Hello,
I am wondering what is the best way to access the values of state variables in the WKSLP-subroutine in MSC Marc? Common blocks?
//M
To access state variables in the WKSLP subroutine in MSC Marc, there are a few approaches, but using common blocks is indeed one of the most common and efficient methods. Here's a brief overview:
1. Common blocks: This is typically the recommended way to access state variables in MSC Marc user subroutines. Common blocks allow you to share data between different parts of your Fortran program, including subroutines.
2. Subroutine arguments: Some state variables are passed directly as arguments to the WKSLP subroutine.
3. Using the "statev" array: This array is often used to store and access user-defined state variables.
Let me elaborate on using common blocks, as you specifically asked about this method:
Common blocks in MSC Marc are predefined and contain various state variables and other important data. For the WKSLP subroutine, you would typically use the "KOMSTR" common block. Here's an example of how you might use it:
fortran
subroutine wkslp(...) include 'concom' include 'creeps' ... common/komstr/strains(6),stresses(6),dstres(6),statev(nstatv) ... end subroutine wkslp
By including these common blocks, you gain access to various state variables. For example:
- `strains` array contains the strain components
- `stresses` array contains the stress components
- `statev` array allows access to user-defined state variables
This method is efficient because it doesn't require passing large amounts of data as subroutine arguments, and it allows easy access to a wide range of program variables.