Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ABAQUS-Python : cyclic application of 3 static steps 2

Status
Not open for further replies.

VMSam

Bioengineer
Jan 20, 2018
14
plain and simple: I have 3 seperate Static steps (each with their own loading conditions) and I want ABAQUS to run them in a loop for 50 times. how can I get this done?! i.e. step1,step2,step3,step1,step2,step3,...

more info: each step should be run for 1 increment, so the whole analysis should be done in 150 increments. this seems irrelevant but I am running urdfil and usdfld subroutines on this model.

to solve this problem for 5 loops (15 increments) , i have written a python script that creates 15 seperate steps. but for 150 steps, that approach does not seem optimized and will lead to big file size (150steps, 150loadings) so i am looking for a better approach.

my previous approach:
this python script (1) creates 15 static steps (2) copies the 3 seperate loadings into desires step (3) deactivates the load in the next step

Python:
for i in range(15):
	mdb.models['Model-1'].StaticStep(amplitude=STEP, maxNumInc=1, name='Steps-%d'%(i+1), 
		noStop=OFF, previous='Steps-%d'%(i), timeIncrementationMethod=FIXED)

for i in range(5):
	mdb.models['Model-1'].Load(name='Load-1-%d'%(i+1), objectToCopy=
		mdb.models['Model-1'].loads['Load-1'], toStepName='Steps-%d'%(3*i+1))
	mdb.models['Model-1'].loads['Load-1-%d'%(i+1)].deactivate('Steps-%d'%(3*i+2))
	mdb.models['Model-1'].Load(name='Load-2-%d'%(i+1), objectToCopy=
		mdb.models['Model-1'].loads['Load-2'], toStepName='Steps-%d'%(3*i+2))
	mdb.models['Model-1'].loads['Load-2-%d'%(i+1)].deactivate('Steps-%d'%(3*i+3))
	mdb.models['Model-1'].Load(name='Load-3-%d'%(i+1), objectToCopy=
		mdb.models['Model-1'].loads['Load-3'], toStepName='Steps-%d'%(3*i+3))
	mdb.models['Model-1'].loads['Load-3-%d'%(i+1)].deactivate('Steps-%d'%(3*i+4))

result:
loads_nzzlh1.jpg


this approach works but it is not practical for 150 steps. so i am looking for a way to creat 3 steps and run them in a loop.
any help is appreciated.
 
Replies continue below

Recommended for you

If it is really necessary to have those 50*3 steps, then I would define the first 3 steps in A/CAE, write out the input file and create the 49 cycles on ASCII level with Python. You could write them in a extra file and use *Include to link them together.
 
IceBreakerSours said:
Can you not use *Amplitude with your loads? I rarely use Abaqus anymore so I am not certain.

IceBreaker,
I don't think I can, cuz I need the subroutines to do their thing after each loading, so having several steps is unavoidable as subroutines only run after each step.
btw i saw you were wondering why does usdfld run twice after each step. could you find the answer? it is really annoying and leads to a number of complications.

Mustaine3 said:
If it is really necessary to have those 50*3 steps, then I would define the first 3 steps in A/CAE, write out the input file and create the 49 cycles on ASCII level with Python. You could write them in a extra file and use *Include to link them together.

Mustaine3,
could you please explain more about "creating the 49 cycles on ASCII level with Python" ?
I am not very experienced with python, do you mean what I did above? or something else?
thanks
 
Correct. In the first iteration of an increment all user subroutines are called twice (except, may be, UEXTERNALDB?). Initial stiffness matrix is formed in the first call and a new stiffness matrix is created in the next call. It was a hassle when I first started playing with USDFLD a while ago.

I am not sure what having steps has to do with *Amplitude. Back when I was a power user of Abaqus, I ran some models with hundreds of steps in them with/without subroutines.

*********************************************************
Are you new to this forum? If so, please read these FAQs:

 

No, I mean something else.

When you write out the Input File from A/CAE to you hard disk, then you can open that file with an ASCII-editor to see the Abaqus keyword. Then you could modify the file and submit it with a command line to the solver.
Python has nice capabilities to modify ASCII files, so this is an option. Every Python tutorial explains how to read text from a file, work with that and write it back or in a new ASCII file.
 
IceBreaker,
IceBreaker said:
I am not sure what having steps has to do with *Amplitude
what I meant was: even though the *amplitude may help with the high number of loadings, it still won't help me get rid of 150 time steps! I am trying to find a way to cycle through those 3 step; if so, then no need to define 150loads or use *amplitude.
I have to add: But if I don't find a way and I am forced to define 150 steps, then using the *amplitude is a better idea than what I did above, I will surely use it, thanks.

IceBreaker said:
Correct. In the first iteration of an increment all user subroutines are called twice (except, may be, UEXTERNALDB?). Initial stiffness matrix is formed in the first call and a new stiffness matrix is created in the next call. It was a hassle when I first started playing with USDFLD a while ago.
yes it is really annoying, given the fact that I am using 100s of increments and each for 1 iteration, then every increment calls usdfld twice literally! (but not urdfil)
if you have something like i=i+1 in your routine (and "i" is defined in a seperate module), it will be increased by 2 every increment! and this will cause convergence issues. I have worked my way around this problem, but this may a pitfall to many users. tnx for your comment.

Mustaine,
Mustaine3 said:
When you write out the Input File from A/CAE to you hard disk, then you can open that file with an ASCII-editor to see the Abaqus keyword. Then you could modify the file and submit it with a command line to the solver
I think this is the solution I am looking for.
I tried to add a few python commands to the *.inp file (adding a "for" loop before "step") but abaqus didn't run it, so i guess this is not as simple as it looks.
Just to get me started, would you please tell me which one of the input files (if not *.inp) is the one I have to edit? (file format?)
Does abaqus help documentation hold any section about this approach and the python commands we can use?
tnx
 
I think this is the solution I am looking for.
I tried to add a few python commands to the *.inp file (adding a "for" loop before "step") but abaqus didn't run it, so i guess this is not as simple as it looks.
Just to get me started, would you please tell me which one of the input files (if not *.inp) is the one I have to edit? (file format?)
Does abaqus help documentation hold any section about this approach and the python commands we can use?

Noooo! An Abaqus input file is no python script. It has it's own format and commands, that have nothing to do with python.
I mean you can use a python script to manipulate this file or create a second file with Abaqus commands and link it to the first one.

The Abaqus Users Manual and Keyword Reference Manual have information about the Abaqus commands and format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor