# Apply known temperature distribution along axis to use temp. based material properties

**URL:** <https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058>\
**Category:** Uncategorized\
**Created:** [February 3, 2024, 6:16pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058 "2024-02-03T18:16:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![suleymanmuti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@suleymanmuti](https://calculix.discourse.group/u/suleymanmuti)\
**Post date:** [February 3, 2024, 6:16pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/1 "2024-02-03T18:16:39Z")

</div>

I want to use temperature-based material properties in a 2D analysis. If the temperature distribution is known to vary along a direction (for instance linear temperature distribution along y-axis), is it possible to apply this temperature field with CalculiX?

![image](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/0/05fba3f3f5a0dbe772f469d042ae408faa4f02fc.png)

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 3, 2024, 7:58pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/2 "2024-02-03T19:58:42Z")

</div>

If it’s a static analysis, you can use the `*TEMPERATURE` keyword but it has to be specified per node or read from .frd file with results of a previous (thermal) analysis.

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [February 3, 2024, 10:47pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/3 "2024-02-03T22:47:25Z")

</div>

You can try a user subroutine, I think `utemp.f` , that provides a way to do this for `*BOUNDARY, USER` and degree of freedom 11.

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 4, 2024, 8:24am UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/4 "2024-02-04T08:24:43Z")

</div>

The utemp.f subroutine can also be used with the `*TEMPERATURE` keyword in purely mechanical analyses. But subroutines are usually used as a last resort. It’s often possible to avoid them with some more or less tedious workarounds. Here you could obtain such a temperature field in a heat transfer analysis or partition the model and apply spatially varying temperatures manually.

---

<div class="post-metadata">

**Author:** ![suleymanmuti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@suleymanmuti](https://calculix.discourse.group/u/suleymanmuti)\
**Post date:** [February 5, 2024, 5:16pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/5 "2024-02-05T17:16:35Z")

</div>

@Calc_em and @jbr thank you for the suggestions. Unfortunately, I am not familiar with utemp.f. Since this is an f file, would one need to recompile CalculiX? Or you can just write the file and submit it along within the .inp file. With \*TEMPERATURE keyword, I understand that it is possible to define a single temperature value for a node, or a node set. In my case, however, I want to apply a temperature to each node based on one of its coordinates, its y-coordinate for instance.

As a possible workaround using \*TEMPERATURE keyword: I can export all nodes and their coordinates to a file (nodes.msh). With a Python code, I can grab each node’s ID, and its y coordinate from this file (nodes.msh) and write another file containing the temperatures:

temperatures.txt

```auto
1, 25
2,26
.
.
.
300, 473

```

But I am not sure if can I use this file in the .inp file like \*TEMPERATURE,FILE=temperatures.txt.  
I can try and see.

If you have any further suggestions, I would be more than happy to have them. Thank you again.

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 5, 2024, 5:47pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/6 "2024-02-05T17:47:50Z")

</div>

> [@suleymanmuti](#):
>
> Since this is an f file, would one need to recompile CalculiX?

Unfortunately, recompilation is necessary:

> To use a user subroutine, replace the dummy routine in the CalculiX distribution by yours (e.g. dflux.f from the distribution by the dflux.f you wrote yourself) and recompile.

> [@suleymanmuti](#):
>
> But I am not sure if can I use this file in the .inp file like \*TEMPERATURE,FILE=temperatures.txt.

The `FILE` parameter is for reading from .frd file from a previous analysis. But you can just paste the generated data (node number, temperature at a node) in lines under this keyword.

---

<div class="post-metadata">

**Author:** ![suleymanmuti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@suleymanmuti](https://calculix.discourse.group/u/suleymanmuti)\
**Post date:** [February 5, 2024, 6:52pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/7 "2024-02-05T18:52:41Z")

</div>

Thank you @Calc_em . I believe I can do this. For larger models, though, this would make the .inp somewhat unreadable 😃 I guess maybe, \*INCLUDE keyword can be useful in this case, for clarity.

\*INCLUDE, INPUT = temperatures.txt

```auto
*TEMPERATURE
1, 25
2,26
.
.
.
300, 473

```

I appreciate the help. Thanks!

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 5, 2024, 6:58pm UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/8 "2024-02-05T18:58:42Z")

</div>

Sure, you can always use the `*INCLUDE` keyword in such cases. I prefer to have everything in one place and just fold the large portions with many lines when reading the file but many people use includes. Especially when working with preprocessors like GraphiX.

---

<div class="post-metadata">

**Author:** ![suleymanmuti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@suleymanmuti](https://calculix.discourse.group/u/suleymanmuti)\
**Post date:** [February 6, 2024, 9:28am UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/9 "2024-02-06T09:28:52Z")

</div>

Hello again. I tried this and get the following error:

```auto
*ERROR reading *TEMPERATURE: a *TEMPERATURE
   card is detected but no thermal
   *INITIAL CONDITIONS are given

```

Following is my input file:

```auto
*INCLUDE, INPUT = nodes.msh
*INCLUDE, INPUT = axi.msh
*INCLUDE, INPUT = symm_BC.nam 
*INCLUDE, INPUT = press.sur

*BOUNDARY
Nsymm_BC,2,2

*ELSET,ELSET=Eall
Eaxi

** Temperature based material data.
*INCLUDE, INPUT = MAT_DEMO_1.nam 

*SOLID SECTION,ELSET=Eaxi,MATERIAL=MatAxi

*STEP, NLGEOM
*STATIC
** Node temperatures read from a file within a *STATIC step.
*INCLUDE, INPUT = temperatures.nam
*DSLOAD
Spress, P, -20
*DLOAD
Eall,CENTRIF,3000000,0.,0.,0.,0.,1.,0.
*NODE PRINT,NSET=Nall
U
*EL PRINT,ELSET=Eall
S
*EL FILE
U,S
*END STEP

```

The manual states that

> \*TEMPERATURE should not be used within a pure thermal or combined thermome-  
> chanical analysis.

But in my case it is a static step. Any suggestions?

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 6, 2024, 9:31am UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/10 "2024-02-06T09:31:32Z")

</div>

Just add `*INITIAL CONDITIONS` to define the initial temperature, as the error message suggests.

---

<div class="post-metadata">

**Author:** ![suleymanmuti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@suleymanmuti](https://calculix.discourse.group/u/suleymanmuti)\
**Post date:** [February 6, 2024, 9:37am UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/11 "2024-02-06T09:37:43Z")

</div>

Thank you @Calc_em, for the prompt insight! I think I implicitly assumed initial temp. wouldn’t be needed since I am not interested in thermal stresses (for this case, but later I will most likely need this). I added room temp. as initial cond. and it works.

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [February 6, 2024, 9:46am UTC](https://calculix.discourse.group/t/apply-known-temperature-distribution-along-axis-to-use-temp-based-material-properties/2058/12 "2024-02-06T09:46:43Z")

</div>

CalculiX requires initial temperature definition whenever temperatures are involved so in steady-state and transient heat transfer and coupled temperature-displacement analyses but also when temperatures are applied in a static step. It doesn’t just assume T\_0=0 like Abaqus.
