Hello,
I’m currently trying to convert Abaqus additive manufacturing simulations into CalculiX. Everything worked out great except for the dynamic addition and removal of elements. I looked in the CCX manual and tried implementing *Model Change but it didn’t work.
To give more details on the problem I’m trying to solve, here is a small example scenario.
As outlined in the above example, I want to remove layers (elements) in the first step and subsequently add each layer in the following steps. When I implemented this in CalculiX, element removal in Step 1 functions correctly but the addition of elements does not occur from Step 2 onward.
My question here is, Can *Model Change effectively handle both the addition and removal of elements as described in my example? Any insights or suggestions would be greatly appreciated!"
Thank you @jbr for your quick response. The analysis did complete without any issues but when I open the result in PrePoMax, all I can visualize are the results of bottomplate elements that are not removed in step-1. I’m not sure if this is a visualization issue in PrePoMax.
Please advice other ways of visualizing the results and I will verify if this is an issue with solver or visualization.
@jbr, Thank you for suggesting CalculiX Advanced Environment GUI. It offers all the keywords I’m looking for. It opens my input file without any issues but can not open the FRD results file. FRD file I’m trying to open is a small file but the GUI doesn’t respond and just loads forever. I will try testing with a smaller model.
you have to do a first, static dummy step, so that all nodes and element information are wrote to
the result file. Then proceed with the removal of the layers.
@febing, This did the trick. Finally, I’m able to visualize the results. Thank you!
One last question, which I have a good understanding of based on the discussion but want to confirm is: can cgx or prepomax be able to show/hide the elements based on steps with ADD and REMOVE Model Change?
For example, in abaqus, if we have add or remove (*model change) elements in a step, abaqus CAE visualization automatically shows or hides elements according to the steps.
The new model with a dummy initial step shows the results in cgx or prepomax but all the removed elements in the second step are still shown in the visualization with no results. This is not a killer, but it would be nice to have this functionality.
Interested to hear all your thoughts on this. Thank you all!
Hi Arjun,
Cgx and Prepomax are not able to disable/enable elements according to model change. I suggested that in the Prepomax discourse group, but sure there are more important topics as new features.
i have added a new option for the result converter in the calculix component for cubit. the missing nodes in the result blocks gets added with zero values and the elements to which them belong will be marked with a cell value 1 for the partial component.
with the treshold filter in paraview you can filter those elements. i’ve have used your dogbone.inp and added the dummy step and a view more steps to add all element layers.
running .inp files is quite easy. just a few lines
ccx create job name "Dogbone" filepath "/home/user/Downloads/Dogbone.inp"
ccx run job 1
ccx wait job 1
ccx result load job 1
ccx result convert job 1 partial
if you already have the .frd for the .inp you can skip the run and wait command and directly load them.
i am currently creating some examples and now i got one that fits here. the example shows how you can make use of python, custom key words and the partial option for the conversion.
#!python
from numpy import cos,sin,arccos
import numpy as np
import cubit
cubit.init()
cubit.cmd("reset")
cubit.cmd("undo off")
def check_if_enclosed(vid1,vid2):
v1 = cubit.volume(vid1)
v2 = cubit.volume(vid2)
b_box1 = v1.bounding_box()
b_box2 = v2.bounding_box()
for i in range(3):
if b_box1[i] > b_box2[i]:
return False
if b_box1[i+3] < b_box2[i+3]:
return False
return True
def split_bodies():
body_list = cubit.get_entities("body")
for b in body_list:
if cubit.is_multi_volume(b):
cubit.cmd(f"split body {b}")
return True
def parametric_circle(t,xc,yc,R):
x = xc + R*cos(t)
y = yc + R*sin(t)
return x,y
plate_x = 200
plate_y = 100
plate_z = 5
cube_x = 5
cube_y = 5
cube_z = 5
cubit.cmd("create brick x " + str(plate_x) + " y " + str(plate_y) + " z " + str(plate_z))
cubit.cmd("create brick x " + str(cube_x) + " y " + str(cube_y) + " z " + str(cube_z))
cubit.cmd("move Volume 1 location " + str(plate_x/2) + " " + str(plate_y/2) + " " + str(plate_z/2))
cubit.cmd("move Volume 2 location " + str(cube_x/2 + plate_x/3 - plate_x/8) + " " + str(plate_y/2) + " " + str(plate_z + cube_z/2))
N = 25
R = plate_y*1/3
xc = 0
yc = 0
arc_T = np.linspace(3.14159265359/2, 3.14159265359*3/2, N)
X,Y = parametric_circle(arc_T, xc, yc, R)
vid = 0
for i in range(N):
cubit.cmd("Volume 2 copy move x " + str(X[i]) + " y " + str(Y[i]) + " z " + str(0))
vid_last = vid
vid = cubit.get_last_id( "volume")
if i!=0:
cubit.cmd(f"subtract volume {vid} from volume {vid_last} keep_tool")
cubit.cmd("move Volume 2 location " + str(cube_x/2 + plate_x*2/3 - plate_x/8) + " " + str(plate_y/2) + " " + str(plate_z + cube_z/2))
vid=0
for i in range(N):
cubit.cmd("Volume 2 copy move x " + str(X[i]) + " y " + str(Y[i]) + " z " + str(0))
vid_last = vid
vid = cubit.get_last_id( "volume")
if i!=0:
cubit.cmd(f"subtract volume {vid} from volume {vid_last} keep_tool")
vid=0
cubit.cmd("move Volume 2 location " + str(cube_x/2 + plate_x*4/5) + " " + str(plate_y/2) + " " + str(plate_z + cube_z/2))
X = np.linspace(-plate_y*1/5, plate_y*1/5, N)
Y = np.linspace(-plate_y*1/3, plate_y*1/3, N)
for i in range(N):
cubit.cmd("Volume 2 copy move x " + str(X[i]) + " y " + str(Y[i]) + " z " + str(0))
vid_last = vid
vid = cubit.get_last_id( "volume")
if i!=0:
cubit.cmd(f"subtract volume {vid} from volume {vid_last} keep_tool")
X = np.linspace(-plate_y*1/5, plate_y*1/5, N)
Y = np.linspace(plate_y*1/3, -plate_y*1/3, N)
for i in range(N):
cubit.cmd("Volume 2 copy move x " + str(X[i]) + " y " + str(Y[i]) + " z " + str(0))
vid = cubit.get_last_id("volume")
if i!=0:
overlapping_volumes = cubit.get_overlapping_volumes_at_volume(vid,cubit.get_entities("volume"))
for ov in overlapping_volumes:
if ov!=1 and ov!=2:
split_bodies()
if check_if_enclosed(vid,ov):
cubit.cmd(f"delete volume {ov}")
else:
cubit.cmd(f"subtract volume {vid} from volume {ov} keep_tool")
cubit.cmd("delete vol 2")
cubit.cmd("imprint vol all")
cubit.cmd("merge vol all")
cubit.cmd("vol all except 1 size 2.5")
cubit.cmd("vol 1 size 10")
cubit.cmd("surface all with z_coord = "+str(plate_z + cube_z)+" scheme pave")
cubit.cmd("mesh surface all with z_coord = "+ str(plate_z + cube_z))
cubit.cmd("mesh vol all except 1")
cubit.cmd("surface all in volume 1 with z_coord >= " + str(plate_z) +" scheme pave")
cubit.cmd("mesh surface all with z_coord >= "+str(plate_z))
cubit.cmd("mesh vol 1")
cubit.cmd("compress")
volume_list = cubit.get_entities("volume")
for v in volume_list:
cubit.cmd(f"block {v} add vol {v}")
cubit.cmd(f"nodeset {v} add vol {v}")
cubit.cmd(f"sideset {v} add surface all in vol 1 to {v} with is_merged = 0")
#material
cubit.cmd('create material "solid" property_group "CalculiX-FEA"')
cubit.cmd('modify material "solid" scalar_properties "CCX_ELASTIC_ISO_USE_CARD" 1')
cubit.cmd('modify material "solid" scalar_properties "CCX_PLASTIC_ISO_USE_CARD" 1')
cubit.cmd('modify material "solid" scalar_properties "CCX_DENSITY_USE_CARD" 1')
cubit.cmd('modify material "solid" matrix_property "CCX_DENSITY_DENSITY" 8 0 ')
cubit.cmd('modify material "solid" scalar_properties "CCX_SPECIFIC_HEAT_USE_CARD" 1')
cubit.cmd('modify material "solid" matrix_property "CCX_SPECIFIC_HEAT_SPECIFIC_HEAT" 420 0 ')
cubit.cmd('modify material "solid" scalar_properties "CCX_EXPANSION_ISO_USE_CARD" 1')
cubit.cmd('modify material "solid" scalar_properties "CCX_CONDUCTIVITY_USE_CARD" 1')
cubit.cmd('modify material "solid" scalar_properties "CCX_CONDUCTIVITY_ISO_USE_CARD" 1')
cubit.cmd('modify material "solid" matrix_property "CCX_CONDUCTIVITY_ISO_K_TEMPERATURE" 50 0 ')
cubit.cmd('modify material "solid" scalar_properties "CCX_ELASTIC_USE_CARD" 1')
cubit.cmd('modify material "solid" matrix_property "CCX_ELASTIC_ISO_MODULUS_VS_POISSON_VS_TEMPERATURE" 210000 0.3 0')
#section
cubit.cmd('ccx create section solid block all material 1')
#heatflux and initial temperature
volume_list = cubit.get_entities("volume")
for v in volume_list:
cubit.cmd(f"create heatflux on sideset {v} value -7.5")
#cubit.cmd(f"ccx modify heatflux {v} op new")
cubit.cmd(f"create temperature on volume {v} value 2000")
cubit.cmd(f"ccx modify temperature {v} op new")
cubit.cmd("modify temperature 1 value 100")
# field outputs
cubit.cmd('ccx create fieldoutput name "fo_node" node')
cubit.cmd('ccx modify fieldoutput 1 node frequency 1')
cubit.cmd('ccx modify fieldoutput 1 node key_on NT')
cubit.cmd('ccx modify fieldoutput 1 node key_off CP U DEPF DEPT DTF HCRI KEQ MACH MAXU MF PNT POT PRF PS PSF PT PTF PU RF RFL SEN TS TSF TT TTF TURB V VF ')
cubit.cmd('ccx create fieldoutput name "fo_element" element')
cubit.cmd('ccx modify fieldoutput 2 element frequency 1')
cubit.cmd('ccx modify fieldoutput 2 element key_on HFL')
cubit.cmd('ccx modify fieldoutput 2 element key_off CEEQ S E ECD EMFB EMFE ENER ERR HER HFLF MAXE MAXS ME PEEQ PHS SF SMID SNEG SPOS SVF SDV THE ZZS ')
# initial conditions
cubit.cmd("ccx create initialcondition temperature")
cubit.cmd(f"ccx modify initialcondition {1} temperature bc_id {1}")
cubit.cmd("ccx create step name 'dummy_step' static")
cubit.cmd("ccx step 1 add fieldoutput 1 2")
cubit.cmd("ccx create step name 'deacivate_step' static")
cubit.cmd("ccx step 2 add fieldoutput 1 2")
cubit.cmd("ccx modify step 2 parameter nlgeom_yes")
cubit.cmd("ccx create customline name 'step_2_top' after step_begin item_id 2 cline '*MODEL CHANGE,TYPE=ELEMENT,REMOVE'")
volume_list = cubit.get_entities("volume")
for v in volume_list:
if v >1:
cubit.cmd(f"ccx create customline name '{v}' after step_begin item_id 2 cline 'Block_{v}'")
cs = 2
volume_list = cubit.get_entities("volume")
for v in volume_list:
# if v > 1 and v < 3:
if v > 1:
cs = cs + 1
cubit.cmd(f"ccx create step name 'heat_{cs}' heattransfer")
cubit.cmd(f"ccx modify step {cs} heattransfer initialtimeincrement 10 timeperiodofstep 10 minimumtimeincrement 1e-5 maximumtimeincrement 10")
cubit.cmd(f"ccx step {cs} add load heatflux {v}")
cubit.cmd(f"ccx step {cs} add bc temperature {v}")
cubit.cmd(f"ccx step {cs} add fieldoutput 1 2")
cubit.cmd(f"ccx create customline name 'step_{cs}_top' after step_begin item_id {cs} cline '*MODEL CHANGE,TYPE=ELEMENT,ADD'")
cubit.cmd(f"ccx create customline name '{v}' after step_begin item_id {cs} cline 'Block_{v}'")
cs = cs + 1
cubit.cmd(f"ccx create step name 'heat_{cs}' heattransfer")
cubit.cmd(f"ccx modify step {cs} heattransfer initialtimeincrement 10 timeperiodofstep 20 minimumtimeincrement 1e-5 maximumtimeincrement 10")
cubit.cmd(f"ccx step {cs} add load heatflux {v}")
cubit.cmd(f"ccx step {cs} add fieldoutput 1 2")
cubit.cmd("ccx create job name 'model_change'")
print("ccx run job 1 no_conversion")
command = ("ccx result convert job 1 block ")
for v in volume_list:
command = command + str(v) + " "
command = command + " partial"
print(command)
PS: it is also now possible to run a job without an auto conversion after the run. and also to convert only defined blocks, nodesets and sidesets.
to be able to define sidesets for every layer i needed to create the layers with volumes. expensive. but it works.
here is a heat transfer example. Every layer will get activated with a initial temperature and with the sidesets i can define convection for each layer.
#!cubit
reset
# create volume or import one
create frustum height 80 radius 20 top 0
move volume 1 z -20
Volume 1 copy rotate 180 about x
unite volume 1 2
compress
#!python
layers = 50
mesh_size = 2.5
# volume id for imported stl
vid = 1
# bounding box volume ids and blocks
cube_vids = []
vector_list = cubit.get_bounding_box("volume" , vid)
cubit.cmd(f"move volume {vid} x {-vector_list[0]} y {-vector_list[3]} z {-vector_list[6]}")
cubit.cmd(f"view bottom")
# from https://forum.coreform.com/t/python-showcase-find-hexes-whose-centroids-are-inside-a-body/1265
import time
def list_to_str(input_val):
return " ".join([str(val) for val in input_val])
def boundary_cube(volume_id,size,number_of_layers):
#cubit.cmd(f"create brick bounding box Volume {volume_id} tight")
bb_list = cubit.get_bounding_box("volume" , volume_id)
cubit.cmd(f"create brick x {bb_list[2]} y {bb_list[5]} z {bb_list[8]}")
cubit.cmd(f"move volume {cubit.get_last_id('volume')} x {bb_list[2]/2} y {bb_list[5]/2} z {bb_list[8]/2}")
#cut into layers
bb_vid = cubit.get_last_id('volume')
for i in range(number_of_layers):
if i!=0:
cubit.cmd(f"webcut volume {bb_vid} with plane zplane offset {bb_list[8]/(number_of_layers)*i}")
cube_vids.append(cubit.get_last_id('volume'))
if i==number_of_layers-1:
cube_vids.append(bb_vid)
#cubit.cmd(f"merge vol {' '.join(str(id) for id in cube_vids)}")
for i in range(len(cube_vids)):
cubit.cmd(f"Volume {cube_vids[i]} size {size}")
cubit.cmd(f"mesh Volume {cube_vids[i]}")
#if refine_level > 0:
# cubit.cmd(f'refine hex all numsplit {refine_level} bias 1.0 depth 1 ')
#cubit.cmd("compress")
def create_nodal_coordinates_array():
nCoord = []
node_ids = cubit.get_entities("node")
for id in node_ids:
nCoord.append(cubit.get_nodal_coordinates(id))
return nCoord
def get_hex_centroid(hex_id, global_node_coords):
hex_nodes = cubit.get_connectivity("hex", hex_id)
cx=cy=cz=0
count = 0
for node_id in hex_nodes:
cx += global_node_coords[node_id-1][0]
cy += global_node_coords[node_id-1][1]
cz += global_node_coords[node_id-1][2]
count += 1
cx = cx/count
cy = cy/count
cz = cz/count
return cx, cy, cz
def vol_hexes_in_body(source_volume_id, target_body_id, block_id):
BODY = cubit.body(target_body_id)
vol_hexes = cubit.get_volume_hexes(source_volume_id)
block_hexes = []
nCoord = create_nodal_coordinates_array()
for hex_id in vol_hexes:
cx, cy, cz = get_hex_centroid(hex_id, nCoord)
if BODY.point_containment([cx, cy, cz]):
block_hexes.append(hex_id)
if len(block_hexes)>0:
cubit.silent_cmd(f"block {block_id} hex {list_to_str(block_hexes)}")
def create_vol_from_hexes():
block_ids = cubit.parse_cubit_list("block","all")
for bid in block_ids:
t0 = time.perf_counter()
block_hexes = cubit.parse_cubit_list("hex",f"all in block {bid}")
for i in range(len(block_hexes)):
cubit.silent_cmd(f"create brick bounding box hex {block_hexes[i]} tight")
new_vid = cubit.get_last_id('volume')
cubit.silent_cmd(f"block {bid} add volume {new_vid}")
cubit.silent_cmd(f"block {bid} name 'layer_{bid}'")
status = cubit.silent_cmd(f"block {bid} remove hex all")
t1 = time.perf_counter()
print(f"Time to create volumes for hexes in block {bid}: {t1 - t0} seconds")
def create_sidesets_from_blocks():
block_ids = cubit.parse_cubit_list("block","all")
for bid in block_ids:
t0 = time.perf_counter()
block_volumes = cubit.parse_cubit_list("volume",f"all in block {bid}")
if len(block_volumes)>0:
bb_list = cubit.get_total_bounding_box("volume" , block_volumes)
#bottom
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()+1} add surface all in volume all in block {bid} with z_coord>={bb_list[6]-1e-6} and z_coord<={bb_list[6]+1e-6}")
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()} name 'layer_{bid}_bottom'")
#middle
block_surfaces = cubit.parse_cubit_list("surface",f"all in volume all in block {bid} with z_coord>{bb_list[6]} and z_coord<{bb_list[7]}")
block_surfaces_not_merged = []
for sid in block_surfaces:
if not cubit.is_merged("surface",sid):
block_surfaces_not_merged.append(sid)
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()+1} add surface {list_to_str(block_surfaces_not_merged)}")
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()} name 'layer_{bid}_middle'")
#bottom
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()+1} add surface all in volume all in block {bid} with z_coord>={bb_list[7]-1e-6} and z_coord<={bb_list[7]+1e-6}")
status = cubit.silent_cmd(f"sideset {cubit.get_sideset_count()} name 'layer_{bid}_top'")
t1 = time.perf_counter()
print(f"Time to create sidesets for block {bid}: {t1 - t0} seconds")
## Script body
boundary_cube(vid,mesh_size,layers)
for i in range(len(cube_vids)):
t0 = time.perf_counter()
vol_hexes_in_body(cube_vids[i], vid, i+1)
t1 = time.perf_counter()
print(f"Time to search for hexes in layer {i+1}: {t1 - t0} seconds")
cubit.cmd(f"graphics off")
create_vol_from_hexes()
cubit.silent_cmd(f"delete volume {list_to_str(cube_vids)}")
block_ids = cubit.parse_cubit_list("block","all")
for i in range(len(block_ids)-1):
print(f"merge volumes in blocks {block_ids[i]} and {block_ids[i+1]}")
status = cubit.cmd(f"merge surface all in vol all in block {block_ids[i+1]} {block_ids[i]}")
for i in range(len(block_ids)):
print(f"mesh volumes in block {block_ids[i]}")
status = cubit.silent_cmd(f"vol all in block {block_ids[i]} size {mesh_size}")
status = cubit.silent_cmd(f"vol all in block {block_ids[i]} scheme map")
status = cubit.cmd(f"mesh vol all in block {block_ids[i]}")
print("finished preparing layers")
print("updating gui")
cubit.cmd(f"graphics on")
## creating sidesets for blocks
create_sidesets_from_blocks()
#!cubit
#draw vol all in block all
draw block all
#draw vol 1 add
#material
create material "solid" property_group "CalculiX-FEA"
modify material "solid" scalar_properties "CCX_ELASTIC_ISO_USE_CARD" 1
modify material "solid" scalar_properties "CCX_PLASTIC_ISO_USE_CARD" 1
modify material "solid" scalar_properties "CCX_DENSITY_USE_CARD" 1
modify material "solid" matrix_property "CCX_DENSITY_DENSITY" 1.1 0
modify material "solid" scalar_properties "CCX_SPECIFIC_HEAT_USE_CARD" 1
modify material "solid" matrix_property "CCX_SPECIFIC_HEAT_SPECIFIC_HEAT" 2.13 0
modify material "solid" scalar_properties "CCX_EXPANSION_ISO_USE_CARD" 1
modify material "solid" scalar_properties "CCX_CONDUCTIVITY_USE_CARD" 1
modify material "solid" scalar_properties "CCX_CONDUCTIVITY_ISO_USE_CARD" 1
modify material "solid" matrix_property "CCX_CONDUCTIVITY_ISO_K_TEMPERATURE" 0.18 0
modify material "solid" scalar_properties "CCX_ELASTIC_USE_CARD" 1
modify material "solid" matrix_property "CCX_ELASTIC_ISO_MODULUS_VS_POISSON_VS_TEMPERATURE" 210000 0.3 0
#section
ccx create section solid block all material 1
# field outputs
ccx create fieldoutput name "fo_node" node
ccx modify fieldoutput 1 node frequency 1
ccx modify fieldoutput 1 node key_on NT
ccx modify fieldoutput 1 node key_off CP U DEPF DEPT DTF HCRI KEQ MACH MAXU MF PNT POT PRF PS PSF PT PTF PU RF RFL SEN TS TSF TT TTF TURB V VF
ccx create fieldoutput name "fo_element" element
ccx modify fieldoutput 2 element frequency 1
ccx modify fieldoutput 2 element key_on HFL
ccx modify fieldoutput 2 element key_off CEEQ S E ECD EMFB EMFE ENER ERR HER HFLF MAXE MAXS ME PEEQ PHS SF SMID SNEG SPOS SVF SDV THE ZZS
# initial conditions
create temperature on volume all value 240
ccx modify temperature 1 op new
ccx create initialcondition temperature
ccx modify initialcondition 1 temperature bc_id 1
#!python
block_ids = cubit.parse_cubit_list("block","all")
for i in range(len(block_ids)):
status = cubit.cmd(f"ccx create film sideset {(i+1)*3-1} temperature 20 coefficient 0.025 name 'layer_{block_ids[i]}'")
status = cubit.cmd(f"create temperature on volume all in block {block_ids[i]} value 240")
status = cubit.cmd(f"ccx modify temperature {i+2} op new")
#!python
#create dummy steps
status = cubit.cmd("ccx create step name 'dummy_step' heattransfer")
status = cubit.cmd("ccx step 1 add fieldoutput 1 2")
status = cubit.cmd("ccx step 1 add bc temperature 1")
#status = cubit.cmd("ccx create step name 'add_layer_{block_ids[0]}' static")
status = cubit.cmd("ccx create step name 'add_layer_1' heattransfer")
status = cubit.cmd(f"ccx modify step 2 parameter inc 100000")
status = cubit.cmd(f"ccx modify step 2 heattransfer initialtimeincrement 10 timeperiodofstep 10 minimumtimeincrement 1e-5 maximumtimeincrement 10")
status = cubit.cmd(f"ccx step 2 add bc temperature 2")
status = cubit.cmd("ccx step 2 add fieldoutput 1 2")
status = cubit.cmd("ccx create customline name 'step_2_top' after step_begin item_id 2 cline '*MODEL CHANGE,TYPE=ELEMENT,REMOVE'")
block_ids = cubit.parse_cubit_list("block","all")
for i in range(len(block_ids)):
if i > 0:
status = cubit.cmd(f"ccx create customline name 'remove_layer_{block_ids[i]}' after step_begin item_id 2 cline 'layer_{block_ids[i]}'")
status = cubit.cmd(f"ccx create step name 'cool_layer_{block_ids[0]}' heattransfer")
status = cubit.cmd(f"ccx modify step 3 parameter inc 100000")
status = cubit.cmd(f"ccx modify step 3 heattransfer initialtimeincrement 10 timeperiodofstep 20 minimumtimeincrement 1e-5 maximumtimeincrement 10")
status = cubit.cmd(f"ccx step 3 add load film 1")
status = cubit.cmd(f"ccx step 3 add fieldoutput 1 2")
#create a step for every layer
cs = 3
for i in range(len(block_ids)):
# if i > 0 and i < 2:
if i > 0:
cs = cs + 1
status = cubit.cmd(f"ccx create step name 'add_layer_{block_ids[i]}' heattransfer")
status = cubit.cmd(f"ccx modify step {cs} heattransfer initialtimeincrement 10 timeperiodofstep 10 minimumtimeincrement 1e-5 maximumtimeincrement 10")
status = cubit.cmd(f"ccx modify step {cs} parameter inc 100000")
status = cubit.cmd(f"ccx step {cs} add load film {i+1}")
status = cubit.cmd(f"ccx step {cs} add bc temperature {i+2}")
status = cubit.cmd(f"ccx step {cs} add fieldoutput 1 2")
status = cubit.cmd(f"ccx create customline name 'step_{cs}_top' after step_begin item_id {cs} cline '*MODEL CHANGE,TYPE=ELEMENT,ADD'")
status = cubit.cmd(f"ccx create customline name 'add_layer_{block_ids[i]}' after step_begin item_id {cs} cline 'layer_{block_ids[i]}'")
cs = cs + 1
status = cubit.cmd(f"ccx create step name 'cool_layer_{block_ids[i]}' heattransfer")
status = cubit.cmd(f"ccx modify step {cs} parameter inc 100000")
if i == len(block_ids)-1:
status = cubit.cmd(f"ccx modify step {cs} heattransfer initialtimeincrement 10 timeperiodofstep 250 minimumtimeincrement 1e-5 maximumtimeincrement 10")
status = cubit.cmd(f"ccx create customline name 'remove_temp_bc' after step_begin item_id {cs} cline '*BOUNDARY,OP=NEW'")
else:
status = cubit.cmd(f"ccx modify step {cs} heattransfer initialtimeincrement 10 timeperiodofstep 20 minimumtimeincrement 1e-5 maximumtimeincrement 10")
status = cubit.cmd(f"ccx step {cs} add load film {i+1}")
status = cubit.cmd(f"ccx step {cs} add fieldoutput 1 2")
cubit.cmd("ccx create job name 'model_change'")
#!cubit
delete volume 1
ccx run job 1 no_conversion
draw block all
ccx wait job 1
ccx result convert job 1 partial
#!python
print("ccx run job 1 no_conversion")
command = ("ccx result convert job 1 block ")
for bid in block_ids:
command = command + str(bid) + " "
command = command + " partial"
cubit.cmd(command)
#!cubit