Skip to content

Commit

Permalink
initial build
Browse files Browse the repository at this point in the history
  • Loading branch information
bthornton191 committed Nov 10, 2020
0 parents commit 6c22521
Show file tree
Hide file tree
Showing 20 changed files with 9,035 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config.json
*.pyc
*.log
downloaded_results/*
.vscode/*
*.bin
**aview.cmd
43 changes: 43 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import time
import json

from rescalesim.rescalesim import Session

# Get the authorization token key
with open('config.json') as fid:
config = json.load(fid)

acf_file = os.path.join('rescale_analysis.acf')
adm_file = os.path.join('rescale_analysis.adm')

# Create a rescale session
session = Session(config['api_token'], config['licensing'])

job_results = session.get_job_details('CjmxEc')
core_types = session.get_core_types()

# job_id = 'xbMTEc'
# Create the job
job_id = session.create_adams_solver_job('api_test_job', acf_file=acf_file, adm_file=adm_file)

# Submit the job
response = session.submit_job(job_id)

# Monitor job status
while True:
status = session.get_job_status(job_id)[0]['status']
print(status)
if status == 'Completed':
break
time.sleep(5)

# List the results
results = session.list_job_results(job_id)

# Download the results files
os.makedirs(os.path.join('downloaded_results', job_id))
for file in session.list_job_results_files(job_id):
(filename, file_id) = [(k, v) for k,v in file.items()][0]
dst = os.path.join('downloaded_results', job_id, filename)
session.download_file(file_id, dst)
3 changes: 3 additions & 0 deletions models/load_and_run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file command read file_name=rescale_model.cmd
file adams_data_set write model_name=.rescale_model file_name=rescale_analysis_from_batch
simulation script write_acf sim_script_name=.rescale_model.SIM_SCRIPT_1 file_name=rescale_analysis_from_batch
6 changes: 6 additions & 0 deletions models/rescale_analysis.acf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

file/model=rescale_analysis
! Insert ACF commands here:
SIMULATE/STATIC
SIMULATE/DYNAMIC, END=5.0, DTOUT=1.0E-02
stop
121 changes: 121 additions & 0 deletions models/rescale_analysis.adm
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Adams View model name: rescale_analysis
!
!-------------------------------- SYSTEM UNITS ---------------------------------
!
UNITS/
, FORCE = POUND_FORCE
, MASS = POUND_MASS
, LENGTH = INCH
, TIME = SECOND
!
!----------------------------------- PARTS -------------------------------------
!
!----------------------------------- Ground ------------------------------------
!
! adams_view_name='ground'
PART/1
, GROUND
!
! adams_view_name='MARKER_4'
MARKER/4
, PART = 1
, QP = 0, 12, 0
!
!------------------------------------ Part -------------------------------------
!
! adams_view_name='PART_2'
PART/2
, MASS = 40.60564164
, CM = 7
, IP = 726.1959478, 726.1959478, 65.03247294
!
! adams_view_name='MARKER_1'
MARKER/1
, PART = 2
, QP = 0, 12, 0
, REULER = 24.77514057D, 90D, 0D
!
! adams_view_name='MARKER_3'
MARKER/3
, PART = 2
, QP = 0, 12, 0
!
! adams_view_name='MARKER_6'
MARKER/6
, PART = 2
, QP = 6, -1, 0
!
! adams_view_name='cm'
MARKER/7
, PART = 2
, QP = 3, 5.5, 0
, REULER = 24.77514057D, 90D, 0D
!
! adams_view_name='CYLINDER_1'
GRAPHICS/1
, CYLINDER
, CM = 1
, LENGTH = 14.31782106
, RADIUS = 1.789727633
!
!------------------------------------ Part -------------------------------------
!
! adams_view_name='PART_3'
PART/3
, MASS = 26.71217658
, CM = 8
, IP = 85.47896506, 85.47896506, 85.47896506
!
! adams_view_name='MARKER_2'
MARKER/2
, PART = 3
, QP = 6, -1, 0
!
! adams_view_name='MARKER_5'
MARKER/5
, PART = 3
, QP = 6, -1, 0
!
! adams_view_name='cm'
MARKER/8
, PART = 3
, QP = 6, -1, 0
, REULER = 180D, 90D, 90D
!
! adams_view_name='ELLIPSOID_2'
GRAPHICS/2
, ELLIPSOID
, CM = 2
, XSCALE = 5.656854249
, YSCALE = 5.656854249
, ZSCALE = 5.656854249
!
!-------------------------------- CONSTRAINTS ----------------------------------
!
! adams_view_name='JOINT_1'
JOINT/1
, REVOLUTE
, I = 3
, J = 4
!
! adams_view_name='JOINT_2'
JOINT/2
, FIXED
, I = 5
, J = 6
!
!------------------------- GRAVITATIONAL ACCELERATION --------------------------
!
ACCGRAV/
, JGRAV = -386.0885827
!
!----------------------------- ANALYSIS SETTINGS -------------------------------
!
OUTPUT/
, REQSAVE
, GRSAVE
!
RESULTS/
, XRF
!
END
Loading

0 comments on commit 6c22521

Please sign in to comment.