SFEMaNS  version 4.1 (work in progress) Reference documentation for SFEMaNS
The subroutine init_maxwell

It is used to initialize the magnetic field $$\bH$$ and the scalar potential $$\phi$$.

### Inputs and outputs

The inputs of this function are the following:

1. H_mesh is the finite element mesh used to approximate the magnetic field.
2. phi_mesh is the finite element mesh used to approximate the scalar potential.
3. dt is the time step.
4. mu_H_field is a list of real. It contains the magnetic permeability of each conducting domains.
5. mu_phi is the magnetic permeability in the insulating domain where $$\phi$$ is approximated.
6. list_mode is a list of integers which contains the Fourier modes approximated.

As the mesh can be subdivised, we note that H_mesh and phi_mesh depend of the processor considered when doing parallel computing. Same goes for the list of Fourier mode list_mode.

The outputs of this function are the following:

1. time is the time when the computations starts.
2. Hn_m1 is the magnetic at the time time-dt.
3. Hn is the magnetic field at the time time.
4. phin_m1 is the scalar potential at the time time-dt.
5. phin is the scalar potential at the time time.

Remarks:

1. The magnetic field is a vector so its format is a real valued tabular of three columns with dimension (H_mesh%np,6,SIZE(list_mode)). We remind that H_mesh%np is the number of nodes of the finite element mesh H_mesh.
2. The scalar potential is a scalar so its format is a real valued tabular of three columns of dimension (phi_mesh%np,2,SIZE(list_mode)). We remind that phi_mesh%np is the number of nodes of the finite element mesh phi_mesh.

### Exemple

Here is an exemple where we use the function Hexact and Phiexact (so initial conditions satisfy the boundary conditions).

time = -dt
DO k=1,6
DO i=1, SIZE(list_mode)
Hn1(:,k,i) = Hexact(H_mesh,k, H_mesh%rr, list_mode(i), mu_H_field, time)
IF (inputs%nb_dom_phi>0) THEN
IF (k<3) THEN
phin1(:,k,i) = Phiexact(k, phi_mesh%rr, list_mode(i) , mu_phi, time)
ENDIF
END IF
ENDDO
ENDDO
time = time + dt
DO k=1,6
DO i=1, SIZE(list_mode)
Hn(:,k,i) = Hexact(H_mesh,k, H_mesh%rr, list_mode(i), mu_H_field, time)
IF (inputs%nb_dom_phi>0) THEN
IF (k<3) THEN
phin(:,k,i) = Phiexact(k, phi_mesh%rr, list_mode(i), mu_phi, time)
ENDIF
END IF
ENDDO
ENDDO
RETURN

We note that the integers i and k have to be declared. It is done by adding the two following lines in the declaration of the function init_maxwell:

INTEGER :: i, k

We refer to the sections Examples with manufactured solutions and Examples on physical problems for more examples.