Closed gcapes closed 6 months ago
There's an initial delete because previously I might have run the script then thought to myself I want to change something. Abaqus creates .lck files to prevent you from accidentally overwriting old database files, plus the original output file will get read into the output pickle file if the first run of abaqus has an error (some combinations of parameters cause errors, and I ofthink that's to be expected when you're running large combinations of parameters).
Yes it creates an error, but it doesn't stop the file from running.
The loop runs abaqus which creates a set of files. The output is then read from those files. If they remain there, then they may get read into the wrong line of the pandas data frame in the event that there is an error in abaqus that causes the output file not to be overwritten.
There is a line that gives a 10% chance of renaming the files from sub_script_check. I put that in because if I run the loop 1000 times without deleting files along the way, I end up with a lot of files and get the occasional complaint from research IT!
I suppose the better way to do it would be to have it name the output name slightly differently in the first place i.e. job_name = f"outputno{count}" Run_Abaqus = subprocess.run(['abq2022',f'job=sub_script_check{job_name}', 'input='+original_inp_file, 'interactive'])
Sorry, I meant Run_Abaqus = subprocess.run(['abq2022', f'job={job_name}', 'input='+original_inp_file, 'interactive'])
Actually never mind, the script read_Force_PEEQ_NT11_barrelling_forcemac.py needs to know the name of the .odb file it's looking at, and I'm not sure that sys.argv will work when called within abaqus cae, so it simply looks for sub_script_check.odb (so called because that's the name I gave it when I was testing it early on) and reads the relevant information from the end of the simulation into .rpt files.
It just struck me as easier to keep a few of the .odb files for manual checking by renaming them after the data was extracted, and delete the rest.
rm: cannot remove ‘sub_script_check*’: No such file or directory
I'm not quite sure what the problem is yet. There's an initial delete here: https://github.com/RoryAtBar/Abaqus_bayesian_matflow/blob/main/surrogate_Abaqus_3_800C_1s-1.py#L144C1-L144C43
and then in the loop, the
call_abaqus_with_new_params
function deletes the same set of files, which I guess are recreated during each call to abaqus. https://github.com/RoryAtBar/Abaqus_bayesian_matflow/blob/main/surrogate_Abaqus_3_800C_1s-1.py#L56