! Simple case for testing the line element in 3D simulation.
! Original date: March 2020
! eelis.takala@gmail.com

$ B0 = 1
$ freq = 50
$ omega = 2 * pi * freq
$ nstep = 5
$ periodnstep = 1

Check Keywords "Warn"
INCLUDE wires_and_core/mesh.names
Header 1
   Mesh DB "." "wires_and_core"
End
Constants 1
   Permittivity of Vacuum = 8.8542e-12
End
Initial Condition 1
   A {e} = Real 0
   A  = Real 0
End
Simulation 1
   Max Output Level = 12
   Coordinate System = Cartesian 3D
   Coordinate Mapping(3) = 1 2 3
   Coordinate Scaling = 0.001
   Simulation Type = Transient
   Timestepping Method = BDF
   BDF Order = 1
   Timestep intervals = $ nstep * periodnstep
   Timestep Sizes = $ 1/(freq*nstep*periodnstep)
   Steady State Max Iterations = 1
   Output Intervals = 1
End
Solver 1  !---- MagnetoDynamics, WhitneyAVSolver
   Exec Solver = Always
   Equation = "MGDynamics"
   Variable = "A"
   Procedure = "MagnetoDynamics" "WhitneyAVSolver"
   NonLinear System Relaxation Factor=1
   Export Lagrange Multiplier = Logical True
   Linear System Solver = Iterative
   Linear System Iterative Method = BicgstabL
   Linear System preconditioning = none
   Linear System Convergence Tolerance = 1.e-8
   Linear System Max Iterations = 3000
   Linear System Residual Output = 1000
   Linear System ILUT Tolerance=1e-5
   BicgstabL polynomial degree = 6
   Steady State Convergence Tolerance = 1e-08
End
Solver 2  !---- MagnetoDynamics, MagnetoDynamicsCalcFields
   Exec Solver = Always
   Equation = "MGDynamicsCalc"
   Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
   Linear System Symmetric = True
   Potential Variable = String "A"
   Calculate Current Density = Logical True
   Steady State Convergence Tolerance = 0
   Linear System Solver = "Iterative"
   Linear System Preconditioning = None
   Linear System Residual Output = 1000
   Linear System Max Iterations = 5000
   Linear System Iterative Method = CG
   Steady State Convergence Tolerance = 1e-6
   Linear System Convergence Tolerance = 1.0e-8
End
Solver 3  !---- ResultOutputSolve, ResultOutputSolver
   !Exec Solver = After timestep
   Exec Solver = Never 
   Equation = "ResultOutput"
   Procedure = "ResultOutputSolve" "ResultOutputSolver"
   Output File Name = wires_and_core
   Vtu format = Logical True
   Save Geometry Ids = Logical True
End
Solver 4  !---- SaveData, SaveScalars
   Exec Solver = After timestep
!   Exec Solver = Never
   Equation = "sv"
   Procedure = "SaveData" "SaveScalars"
   Filename = wires_and_core/dat/wires_and_core.dat
End
Equation 1
   Active Solvers(3) = 1 2 3
End
Material 1  !---- air: generic
   Name = air
   Electric Conductivity = 1
   Relative Permeability = 1
End
Material 2  !---- Core
   Name = iron
   Electric Conductivity = 1
   Relative Permeability = 2000
End
Body 1  !---- Air
   Name = air
   Target Bodies(1) = $ air
   Equation = 1
   Material = 1
   Initial Condition = 1
End
Body 2  !---- Core
   Name = core
   Target Bodies(1) = $ core
   Equation = 1
   Material = 2
   Initial Condition = 1
End
Boundary Condition 1  !---- BCn Flux Parallel
   Name = BCn Flux Parallel
   Target Boundaries(1) = $ parallel_flux
   A {e} = Real 0
   Electric Current Density = 0
End
Boundary Condition 2 !---- wire1
   Name = wire1
   Target Boundaries(1) = $ wire1
   Thin Line Conductivity = Real 1e20
   Thin Line Crossection Area = Real 1e-6
End
Boundary Condition 3 !---- wire2
   Name = wire2
   Target Boundaries(1) = $ wire2
   Thin Line Conductivity = Real 1e20
   Thin Line Crossection Area = Real 1e-6
End
Boundary Condition 4 ! ---- wire1_t1
   Name = wire1_t1
   Target Boundaries(1) = $ wire1_t1
!   A = Real 0
End
Boundary Condition 5 ! ---- wire1_t2
   Name = wire1_t2
   Target Boundaries(1) = $ wire1_t2
   A = Variable time
      Real MATC "B0 * sin(omega*tx)"
End
!Boundary Condition 6 ! ---- wire2_t2
!   Name = wire2_t2
!   Target Boundaries(1) = $ wire2_t2
!!   A = Real 0
!   Current Density = 0
!End
!Boundary Condition 7 ! ---- wire12_t1
!   Name = wire12_t1
!   Target Boundaries(1) = $ wire2_t1 
!!   A = Real 0
!   Current Density = 0
!End




Solver 2 :: Reference Norm = Real 1.48373402E-01
Solver 2 :: Reference Norm Tolerance = Real 1E-03
$fprintf( stderr, "TEST CASE 1\n");
RUN
