Relative permeability tensor in WhitneyAVSolver

Numerical methods and mathematical models of Elmer
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Relative permeability tensor in WhitneyAVSolver

Post by szewro »

Dear all,

I have problem with relative permeability tensor in WhitneyAVSolver.

When I define anisotropic material as:

Code: Select all

Material 2
    Name = "ferro"
    Electric Conductivity = 1.0e7
    Relative Permeability(3,3) = Real \
                50000.1 0 0 \
                0 20.0 0 \
                0 0 20.0
End
it causes NaN error in the solver.

Form

Code: Select all

Material 2
    Name = "ferro"
    Electric Conductivity = 1.0e7
    Relative Permeability = Real \
                50000.1 0 0 \
                0 20.0 0 \
                0 0 20.0
End
causes it solve, however, there is no anisotropy in the model (it seems that relative permeability is just equal 50000)

Do you know, if it possible to model anisotropic relative permeability wit ELMER FEM?

In the attachment please find simple example with anisotropic plate in uniform magnetic field.

With best regards,

Roman Szewczyk
Attachments
aniso_test.zip
simple test with NETGEN 6.2 mesh in .geo format
(1.71 KiB) Downloaded 222 times
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Relative permeability tensor in WhitneyAVSolver

Post by mzenker »

Hmmm, looking into the models manual it seems that only anisotropic conductivity can be used.

To be sure, one would have to look into the code...

Matthias
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Re: Relative permeability tensor in WhitneyAVSolver

Post by szewro »

Hi!

Thank you for your answer!

I am not enough experienced in Fortran. It is difficult for me. Do you have an idea, where I should look for it?

With best regards,

Roman
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Re: Relative permeability tensor in WhitneyAVSolver

Post by szewro »

There is also example with anisotropic reluctance: mgdyn_anisotropic_rel
It is promising, but I can't build it.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Relative permeability tensor in WhitneyAVSolver

Post by mzenker »

Hi,

that one is simple. :)
Just type

elmerf90 reluctivity.F90 -o reluctivity.dll

on the command line (I assume you are under Windows?).
Then type

elmersolver

and the case will run.

HTH,
Matthias
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Re: Relative permeability tensor in WhitneyAVSolver

Post by szewro »

Hi Matthias!

thank you for your help!

I work under Linux Mint. I tried to build it, and it works!
Previously, I have got an error, probably I used wrong command.

This time I tried:
elmerf90 reluctivity.F90 -o reluctivity.so

There is declaration in the code, which I don't understand:

Code: Select all

  REAL(KIND=dp) :: X(*)
  REAL(KIND=dp), POINTER CONTIG :: Y(:,:)
It is also SUBROUTINE reluct(Model, n, X, Y), not a function. However, it is not a problem.
I will do exactly the same and we will see the result. I will keep you informed.

Thank you very much again for your kind help!

With best regards,

Roman
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Re: Relative permeability tensor in WhitneyAVSolver

Post by szewro »

Hi!

unfortunately it is not working. :(

I prepared file permefile.F90:

Code: Select all

SUBROUTINE permf(Model, n, X, Y)
!-------------------------------------------------------------------------------
  USE DefUtils
  IMPLICIT NONE
  TYPE(Model_t) :: Model
  INTEGER :: n
  REAL(KIND=dp) :: X(*)
  REAL(KIND=dp), POINTER CONTIG :: Y(:,:)
!-------------------------------------------------------------------------------
  
  Y = 0._dp
  Y(1,1) = 50000.1_dp
  Y(2,2) = 1000.1_dp
  Y(3,3) = 20.1_dp
!-------------------------------------------------------------------------------
END SUBROUTINE permf
!-------------------------------------------------------------------------------
I built it with:
elmerf90 permefile.F90 -o permefile.so

and I defined material in .sif as:

Code: Select all

Material 2
	Name = "ferro"
	Electric Conductivity = 1.0e7 ! 104.058
  	Relative permeability(3,3) = variable coordinate
    		real procedure "permefile" "permf"
End
Unfortunately, I again got NaN error from the solver:

Code: Select all

OptimizeBandwidth: ---------------------------------------------------------
OptimizeBandwidth: Computing matrix structure for: mgdynamics...done.
OptimizeBandwidth: Half bandwidth without optimization: 20687
OptimizeBandwidth:
OptimizeBandwidth: Bandwidth Optimization ...done.
OptimizeBandwidth: Half bandwidth after optimization: 2878
OptimizeBandwidth: ---------------------------------------------------------
DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
SolveSystem: Solution trivially zero!
MGDynAssembly: Elapsed REAL time:     2.1585 (s)
DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
WhitneyAVSolver::  Boundary tree edges: 94 of total: 279
       1        NaN
ERROR:: IterSolve: Numerical Error: System diverged over maximum tolerance.
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO
I still have no idea how to overcome this problem... :cry:

With best regards,

Roman
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Relative permeability tensor in WhitneyAVSolver

Post by mzenker »

Hi,

I have no experience with the WhitneyAV solver, and not enough time to look deeper into the case right now, sorry.
Someone else with more knowledge has to take over here...

Matthias
szewro
Posts: 28
Joined: 01 Feb 2014, 18:57
Antispam: Yes
Location: Warsaw, Poland

Re: Relative permeability tensor in WhitneyAVSolver

Post by szewro »

Hi Matthias!

I have made some experiments during the night.
I used working example: mgdyn_anisotropic_rel , I substituted .F90 file by permfile.F90:

Code: Select all

!-------------------------------------------------------------------------------
SUBROUTINE permf(Model, n, X, Y)
!-------------------------------------------------------------------------------
  USE DefUtils
  IMPLICIT NONE
  TYPE(Model_t) :: Model
  INTEGER :: n
  REAL(KIND=dp) :: X(*)
  REAL(KIND=dp), POINTER CONTIG :: Y(:,:)
!-------------------------------------------------------------------------------
  
  Y = 0._dp
  Y(1,1) = 50000.1_dp
  Y(2,2) = 2.1_dp
  Y(3,3) = 2.1_dp
!-------------------------------------------------------------------------------
END SUBROUTINE permf
!-------------------------------------------------------------------------------
and I made simple magnet-anisotropic plate test case in NETGEN:

Code: Select all

#
## aniso test
#
#  Netgen 6.2 required 
#

algebraic3d

solid core = cylinder  (0, 0, -1.5; 0, 0, 1.5; 3)
	     and plane (0, 0, -1; 0, 0, -1)
	     and plane (0, 0, 0; 0, 0, 1) -maxh = 0.3;

solid magnet = cylinder  (0, 0, 0.1; 0, 0, 3.9; 1)
	       and plane (0, 0, 0.2; 0, 0, -1)
	       and plane (0, 0, 3.5; 0, 0, 1) -maxh = 0.3;

solid range = sphere (0, 0, 0; 25)
              and not magnet
	      and not core;

tlo core  -col=[0,0,1];
tlo magnet -col=[0,1,0];
tlo range -col=[1,0,0] -transparent;
aniso_test.sif is in the attachment.

Please see the results:
aniso_test.jpg
(176.75 KiB) Not downloaded yet
It works, solves, but unfortunately, there is NO ANISOTROPY. :cry: :cry: :cry:

I agree, we need help. Fortran sources are to sophisticated for me. I give up for this moment.

Thank you for your help and discussion!

With best regards,

Roman
Attachments
permefile.F90
(669 Bytes) Downloaded 226 times
aniso_test.sif
(3.97 KiB) Downloaded 221 times
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Relative permeability tensor in WhitneyAVSolver

Post by mzenker »

Hi,

you should read the section 18.3 "writing a user function" in the Elmer Solver Manual. I think the problem is that you have declared a subroutine without return value(s).

HTH,
Matthias
Post Reply