-1

I have a file that contains temperature values for specific coordinates. The format of file is as follows:

X Y Z Temp

The goal is to read this information from a file and apply it, then Abaqus does its magic. I have been given a Python script that builds the model (I suspect this script was generated automatically using the Abaqus GUI). In this file methods such as edges.findAt, faces.findAt and vertices.findAt are used to select the desired location and apply the temperature. Now, I am looking for a way to tell Abaqus to apply temperature at a certain nodal locations. It seems it is possible since when I look at the inp file I see such pattern. Even, if you could give me one example that reads load, temperature, or anything from a file and apply it at specific location it could be really helpful.

--Edit--

The file I have been working with can be found at this link. It contains two files, heat_aba.py and input.txt. My problem is concerned with lines 58-102, to be substituted with a routine in python to read temperatures from input.txt and initialize the model in Abaqus. The coordinates in the input.txt are nodal coordinates.

Matt P
  • 2,287
  • 1
  • 11
  • 26
MO_m
  • 13
  • 4
  • 1
    is there a node at location x,y,z? You can only prescribe temperature at a node. In any case this question is out of scope of this site unless you can show the code you are working on and having trouble with. – agentp Jul 16 '17 at 12:51
  • I updated the question and add the corresponding files. Also, the coordinates are the location of nodes. – MO_m Jul 16 '17 at 13:19
  • Its really not clear where you are having a problem. do you know how to open a file in python?? If no you should put away abaqus and go read a python tutorial. – agentp Jul 16 '17 at 17:00
  • I do know how to open the file . No problem from the python side. My problem is how I can insert the temperature into abaqus. In a very simple term I give you (0,0,1) with a temperature of 20C, how do you code (forget reading a file)? Is there any function in abaqus that accepts a coordinate and temperature at that location? I just don't know the responsible functions in abaqus. All I have seen, users selects the regions by cells.findaAt or similiar method. Is it possible to substitute it with coordination? – MO_m Jul 16 '17 at 17:31
  • if the node is associated with a vertex in the geometry use `vertices.findAt` (this is usually the case otherwise how would you know the mesh generator would put a node where you want.). If the node is not at a geometry feature, you need to loop over all the nodes, getting their coordinates until you find the one you want. – agentp Jul 16 '17 at 18:35
  • Thanks. Just is it possible to tell me after I find the node, how I can set the temperature. Assume result of `vertices.findAt` is stored in a variable called `tmp_node`. How do you set a temperature for `tmp_node`? – MO_m Jul 16 '17 at 19:14

1 Answers1

1

I'll focus my answer on the Abaqus/Python details, since resources for learning how to open/read files with Python are already widely available.

The findAt method is used for geometric features. For example, to return a Face object at a specified location, use:

f = mdb.models[NAME].rootAssembly.instances[NAME].faces.findAt((x,y,z))

The command is similar for Cell, Edge, and Vertex objects. Note that there may be some ambiguity if more than one object could possibly be associated with the specified coordinates. For example, if the point specified lies on the boundary of multiple Faces (say, it's on an edge), you are responsible to ensure the correct face is returned from findAt. (Also, in one of your comments above you mention that you have a node stored in the variable tmp_node, but that is actually a Vertex object).

Now, once you have a geometric object reference, such as f shown above, you may use that to determine the nodes associated with that geometric region:

node_objects = f.getNodes()

Again, similar methods are available for other geometric entities. Note that getNodes returns a list of Node objects, each of which has various attributes. To get the label or coordinates of the ith Node, you can use:

n = node_object[i].label
c = node_object[i].coordinates

Now, if you are familiar with Python, matching this Node to an entry in the external data file should be easy. If not, that should probably be a separate question here on SO.

To apply the desired temperature to the node, you must use a Temperature object (seeing a pattern of object usage here?). You have an example of that in the (auto-generated?) Python script you linked to, in the lines you mentioned. Simply substitute the correct magnitude and region. For example assuming m and a are the model and root assembly:

# ...various module imports.
myregion = a.Set(name=NAME, nodes=(node_objects[100:101],) )
m.Temperature(name=NAME, createStepName=NAME, magnitudes=(NUMBER,), region=myregion)
a.regenerate()

Notice that both myregion.nodes and magnitudes are ordered, so if you are clever you can define the temperatures for all nodes with a single command.

Matt P
  • 2,287
  • 1
  • 11
  • 26