Batch processing (local)¶
If several model scripts are to be processed (model generation, solving and result extraction), it makes sense to automate the process (batch processing). The GUWlib package provides some wrapper functions for this purpose, which accept a list of model files and work through the required steps in sequence. For a local pipeline, this mainly includes calling ABAQUS/CAE and ABAQUS/Explicit with the respective input files or scripts.
Using the batch processing script (local)¶
The script ...\GUW\python\batch_local.py
provides a customizable outline of how you may use the batch functions to build and solve a list of models as well as to extract the results as .NPZ files in an automated manner. Below is an example where the script is set up to
build the model files
models\examples\example_01.py
,models\examples\example_02.py
andmodels\examples\tutorial.py
in ABAQUS/CAE,solve the simulations one after the other with ABAQUS/Explicit on 10 cores in parallel each,
export the history output data to NumPy binaries.
from guwlib.functions_batch.local import *
# define your GUWlib model files (.PY) here -------------------------------------------------+
model_file_paths = ['models/examples/example_01.py',
'models/examples/example_02.py',
'models/examples/tutorial.py', ]
# (preprocessing and submitting) call the batch function for automated building and solving -+
# of the models
build_and_solve(model_file_paths=model_file_paths,
n_threads=10)
# (postprocessing) call the batch function for automated result export ----------------------+
extract_results(directories_to_scan=('results',),
data_to_extract='history')
All files (.PY, .INP, .ODB, .NPZ and other files written by ABAQUS) will be stored in directories, named after the model files and the respective load cases, inside the results\
folder.
Batch wrapper functions (local)¶
- guwlib.functions_batch.local.build_and_solve(model_file_paths, n_threads)¶
Wrapper to automize the process of building ABAQUS FE model (.INP) files from guwlib model files (.PY) and submitting them to the ABAQUS solver on this machine. Results are written to the ‘results’ directory.
Subprocess is used to call ABAQUS/CAE and ABAQUS analysis via CLI. Make sure ABAQUS is available (check with abaqus information=release).
- Parameters:
model_file_paths (list[str]) – File paths to the guwlib model files (.PY).
n_threads (int) – Number of CPUs (physical / virtual) to use for parallel solving in ABAQUS.
- guwlib.functions_batch.local.extract_results(directories_to_scan=('results',), data_to_extract='history')¶
Handles automatic batch postprocessing of .ODB files, i.e. extraction of history or field output to NumPy binary files (.NPZ) or Pickle files (.PKL, only fallback). The function scans the specified directories for unprocessed .ODB files and calls the field / history export helper in ABAQUS/CAE to process the file.
- Parameters:
directories_to_scan (tuple[str]) – directories (including subdirectories) to browse for unprocessed .ODB files
data_to_extract (str) – type of data to extract (‘field’ or ‘history’)