AcuConsole is based on a python framework … (Tips & Tricks)

Did You Know that AcuConsole is based on a python framework and you have access to some very useful python modules.
For example, say you have a really large mesh and you are working on the cluster. Say, you need to create a nodal initial condition file such that all the elements in element set 1 have a temperature of 300 K and all the elements in element set 2 have a temperature of 350 K. This can be done very easily using our python modules. Create a file called and add the lines below and then run acuPython in the folder that has the mesh data ( MESH.DIR) that has the required cnn files ( element1.cnn and element2.cnn in this case ).
import numpy
import acupu
( elemIds1, cnn1 ) = acupu.readArrays( ‘element1.cnn’, (
(‘i’,1),(‘i’,’*’) ) )
( elemIds2, cnn2 ) = acupu.readArrays( ‘element2.cnn’, (
(‘i’,1),(‘i’,’*’) ) )
cnn1Nodes = acupu.getCnnNodes( cnn1 )
cnn2Nodes = acupu.getCnnNodes( cnn2 )
nCnn1 = len( cnn1Nodes )
nCnn2 = len( cnn2Nodes )
values1 = numpy.zeros( dtype=’d’,shape=(nCnn1,) ) + 300.0
values2 = numpy.zeros( dtype=’d’,shape=(nCnn2,) ) + 350.0
acupu.writeArrays( ‘element1.nic’, ( cnnNodes1, values1 ) )
acupu.writeArrays( ‘element1.nic’, ( cnnNodes2, values2 ), mode =’a’ ) (December 3, 2012)

Have a question or comment?

Post your comment/question on our user forum.