Thank you! The DG type of elemental field is necessary. And I still encounter the problem that I cannot define the similar variable Phys of Peddy for elemetal field.

I checked the source code "CalcFields .F90" and "FourierLoss.F90", I found I should define another dummy solver in an initialization subroutine? And maybe I should also define these variables in this dummy solver? As:

Code: Select all

```
! Create DG solver structures on-the-fly without actually solving the matrix equations.
ALLOCATE(Solvers(n+1))
Solvers(1:n) = Model % Solvers
Solvers(n+1) % Values => ListAllocate()
DGSolverParams => Solvers(n+1) % Values
CALL ListAddLogical( DGSolverParams, 'Discontinuous Galerkin', .TRUE. )
Solvers(n+1) % DG = .TRUE.
Solvers(n+1) % PROCEDURE = 0
Solvers(n+1) % ActiveElements => NULL()
CALL ListAddString( DGSolverParams, 'Exec Solver', 'never' )
CALL ListAddLogical( DGSolverParams, 'No Matrix',.TRUE.)
CALL ListAddLogical( DGSolverParams, 'Optimize Bandwidth',.FALSE.)
CALL ListAddString( DGSolverParams, 'Equation', 'CoreLoss_Dummy' )
CALL ListAddString( DGSolverParams, 'Procedure', &
'CoreLoss CoreLossSolver_Dummy',.FALSE. )
CALL ListAddString( DGSolverParams, "Exported Variable 1 =", "Core Loss Phys e" )
CALL ListAddString( DGSolverParams, "Exported Variable 2 =", "Core Loss Peddy e")
CALL ListAddString( DGSolverParams, "Exported Variable 3 =", "CoreLoss_e" )
!PRINT *, "Initial Done", i
DEALLOCATE(Model % Solvers)
Model % Solvers => Solvers
Model % NumberOfSolvers = n+1
END SUBROUTINE CoreLossSolver_init0
```

Code: Select all

```
!------------------------------------------------------------------------------
SUBROUTINE CoreLossSolver_Dummy(Model,Solver,dt,Transient)
!------------------------------------------------------------------------------
USE MagnetoDynamicsUtils
IMPLICIT NONE
!------------------------------------------------------------------------------
TYPE(Solver_t) :: Solver
TYPE(Model_t) :: Model
REAL(KIND=dp) :: dt
LOGICAL :: Transient
!------------------------------------------------------------------------------
END SUBROUTINE CoreLossSolver_Dummy
!------------------------------------------------------------------------------
```

Code: Select all

```
Ph_E => VariableGet( Mesh % Variables,'Core Loss Phys e' )
IF(.NOT. ASSOCIATED( Ph_E ))THEN
CALL Fatal('CoreLossSolver','Variable Core Loss Phys e does not exist')
END IF
```

Code: Select all

```
Model Input: Unlisted keyword: [keddy] in section: [constants]
Model Input: Unlisted keyword: [axiall] in section: [constants]
WARNING:: CheckTimer: Requesting time from non-existing timer: LoadMesh
WARNING:: CheckTimer: Requesting time from non-existing timer: MeshStabParams
MAIN:
MAIN: -------------------------------------
MAIN: Time: 1/5 1.0000003999999999E-004
MAIN: -------------------------------------
MAIN:
WARNING:: CheckTimer: Requesting time from non-existing timer: PeriodicProjector
20 0.1011E+00
40 0.1733E-01
60 0.2544E-02
80 0.1113E-04
100 0.6558E-05
ComputeChange: NS (ITER=1) (NRM,RELC): ( 2543.3687 1.0000000 ) :: mgdyn2d
20 0.7383E-03
40 0.2947E-03
60 0.2052E-03
80 0.1853E-04
100 0.1077E-06
ComputeChange: NS (ITER=2) (NRM,RELC): ( 2556.8740 0.69178087E-01 ) :: mgdyn2d
20 0.6419E-05
40 0.5531E-05
60 0.4932E-05
80 0.9396E-07
ComputeChange: NS (ITER=3) (NRM,RELC): ( 2550.2542 0.97899601E-02 ) :: mgdyn2d
ComputeChange: NS (ITER=4) (NRM,RELC): ( 2550.8919 0.21344349E-03 ) :: mgdyn2d
ComputeChange: NS (ITER=5) (NRM,RELC): ( 2550.8838 0.29937164E-05 ) :: mgdyn2d
ComputeChange: NS (ITER=6) (NRM,RELC): ( 2550.8838 0.99764275E-07 ) :: mgdyn2d
WARNING:: GetPermittivity: Permittivity not defined in material, defaulting to that of vacuum
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.79328062E-01 2.0000000 ) :: calcfields
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.88136685E-01 0.10519973 ) :: calcfields
ComputeChange: NS (ITER=6) (NRM,RELC): ( 0.50781544E-03 2.0000000 ) :: calcfields
ComputeChange: NS (ITER=9) (NRM,RELC): ( 545766.69 2.0000000 ) :: calcfields
Nsize = 12704
Nelem = 76602
CurrentTimeStep = 1
Ph % Values(1) = 0.0000000000000000
Nelem = 11362
ERROR:: CoreLossSolver: Variable Core Loss Phys e does not exist
```

The source code is uploaded. I do not know why did this problem occur?