# Tutorial

In this tutorial, we will model the mechanical behavior of the round wire considered in the previous tutorials subject to electromagnetic constraints and thermal dilatation due to Joules losses

The geometry is the same as in the magnetostic tutorial; ie splitted into 2 parts:

• the wire, represented by a cylinder,

• the air region also represented by a cylinder.

The geometry will be designed in `Salome`.

We will distinct:

• the plane circles (V0 and V1) on which will be applied some electric potential

• the cylindrical surface (Bord) on which we will apply some cooling boundary conditions.

and for the air:

• the plane circles (Sym0 and Sym1) on which will be applied some symmetry boundary condition for the magnetostatic problem,

• the cylindrical surface of the air region (Inf) on which we will apply infinity boundary condition for the magnetostatic problem.

The elasticity model will be used to model the displacements and the constraints; the temperature field $T$ and the Lorentz forces distribution $\mathbf j \times b$ will be computed using respectively the thermoelectric and magnetostatic model. This is transparent for the user.

## 1. Data

The "wire" cylinder is defined by its radius $R$, its height $H$. The "air" cylinder is defined by its outer radius $R_{inf}$ and its inner radius $R$, its height $H$. The cylinders symmetry axis are $Oz$.

 $R_{inf}$ [ $m$ ] R [ $m$ ] H [ $m$ ] 32e-3 8.e-3 16.e3
 Boundary $V$ V0 0 V1 0.05

As a reminder, we recall the boundary conditions for the thermoelectric and magnetostatic problem:

 Boundary $h$ [ $K/W/m^2$ ] $T_w$ [ $K$ ] Bord 8.e+4 293
 Inf $\mathbf{A}=\mathbf{0}$ Sym0 $\mathbf{A}_X =0$, $\mathbf{A}_Y =0$ V0 $\mathbf{A}_X =0$, $\mathbf{A}_Y =0$ Sym1 $\mathbf{A}_X =0$, $\mathbf{A}_Y =0$ V1 $\mathbf{A}_X =0$, $\mathbf{A}_Y =0$

To these boundary conditions, we have to add the specific boundary conditions for the elasticity problem. Namely:

 V0 $\mathbf{u} = \mathbf{0}$ V1 $\mathbf{u}_Z = 0$

The wire is assumed to be clamped in V0 and we block the displacement along the $Z$ axis on V1.

## 2. Prerequisites

• Linux OS,

• Basic knowledge of Unix commands,

• `NVIDIA` Graphic video card,

• `singularity`

• Thermoelectric model tutorial

## 3. Setup study

• Start a terminal

• Create a directory to hold the study

• Move to the created directory

• Create an `STORAGE` environment variable pointing to the directory holding singularity images:

``export STORAGE=/home/singularity``

## 4. Create Geometry and a Mesh

See previous magnetostatic tutorial for generating the geometry and mesh.

## 5. Prepare Cfg and Json files

As before we have to define a ```cfg ` configuration file for the simulation and add a `json``` model file for specifying the elasticity problem. For the other physics we can use the previous `json` model files.

### 5.1. `cfg` file definition

Compared to the previous magnetostatic tutorial, we can use the same `cfg` file except that we have to:

• set the compute_elasticty flag to true,

• add a section (namely [elasticity]) for the Elasticity model definition.

``````dim=3
geofile=cylindre.msh
geofile-path=$cfgdir conductor_volume=Cylinder_1 compute_magnetism=true compute_bg_magfield=false compute_bg_magfield_bmap=false compute_elasticity=true [thermoelectric] model_json=$cfgdir/thermoelec.json
weakdir=false
resolution=linear

[electro]
pc-type=boomeramg #gamg
#ksp-monitor=true
ksp-rtol=1e-7
ksp-atol=1e-5
ksp-maxit=2000
ksp-use-initial-guess-nonzero=1

[thermal]
pc-type=boomeramg #gamg
#ksp-monitor=true
ksp-rtol=1e-8
ksp-atol=1e-6
ksp-use-initial-guess-nonzero=1

[magnetostatic]
model_json=$cfgdir/magnetostatic.json weakdir=false [ms] pc-type=boomeramg #gamg ksp-monitor=true ksp-rtol=1e-7 ksp-atol=1e-5 ksp-use-initial-guess-nonzero=1 [elasticity] filename=$cfgdir/elasticity.json
on.type=elimination_symmetric
thermal_dilatation=true
lorentz_forces=true
pc-type=gamg
ksp-monitor=true
ksp-converged-reason=1``````

### 5.2. `json` model for Elasticity model

For the considered elasticity boundary conditions, the model file will be:

``````{
"Name": "CoupledCart",
"ShortName":"MSC",
"Models":
{
"equations":"Elasticity"
},
"Materials":
{
"Cylinder_1":
{
"name":"Copper",
"filename":"$cfgdir/Cu.json" } }, "BoundaryConditions": { { "displacement": { "Dirichlet": { "V0": { "expr":"{0,0,0}" } } }, "displacement_z": { "Dirichlet": { "V1": { "expr":"0" } } } }, "PostProcess": { "Fields":["displacement","Von-Mises","tresca","principal-stresses"] } }``````  Do not forget to verify that the `json` file are correct. To do so use for instance: ``jsonlint-php thermoelec.json`` ## 6. Run the Simulation • Create a directory for storing the results ``mkdir Coupled`` • Run the simulation ``````singularity exec -B${PWD}/Coupled:/feel \
${STORAGE}/hifimagnet-hifimagnet_v0.105.img \ feelpp_hfm_coupledcartmodel_3DP1N1 --config-file cylinder.cfg``````  Checkout the output of the above command for any errors. You can save the output to a file `log` using the redirection: ``````singularity exec -B${PWD}/Coupled:/feel \ \${STORAGE}/hifimagnet-hifimagnet_v0.105.img \ feelpp_hfm_coupledcartmodel_3DP1N1 --config-file cylinder.cfg > log 2>&1``````

## 7. Post-processing

• Move to the directory where the results are stored

``cd Coupled/.../exports/ensightgold``
• Start `ensight102`