## max number of variables in scalar solver section

Post processing utility for Elmer
ea_Marc
Posts: 7
Joined: 18 Nov 2022, 14:48
Antispam: Yes

### max number of variables in scalar solver section

Hi All,

I try to calculate the flux linkage in an electrical machine in every stator slot. That means, I need to integrate the magnetic vector potential in every slot.

My idea was, to use the scalar solver, which already writes out the torque etc. However, I realized, that in the moment, I have more than 20 variables in the scalar solver, I get an error, complaining about the 21th variable.

Here is an example of the scalar solver:

Code: Select all

``````! scalar_solver
Solver 6
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = scalars.dat
Exec Solver = After Timestep
Variable 1 = Time
Variable 2 = Position
Operator 3 = cpu time
Variable 4 = Magnetic Vector Potential 3
Operator 4 = Body Int
Variable 5 = Magnetic Vector Potential 3
Operator 5 = Body Int
Variable 6 = Magnetic Vector Potential 3
Operator 6 = Body Int
Variable 7 = Magnetic Vector Potential 3
Operator 7 = Body Int
Variable 8 = Magnetic Vector Potential 3
Operator 8 = Body Int
Variable 9 = Magnetic Vector Potential 3
Operator 9 = Body Int
End
``````
This example works, because I have "only" 9 variables defined. But in the moment, I have a bigger machine with a lot of stator slots and over 20 variables, I get an error:

Code: Select all

``````ERROR:: LoadInputFile:
ERROR:: LoadInputFile:  Unknown specifier: [magnetic vector potential 3]
ERROR:: LoadInputFile:  In section: [solver 6]
ERROR:: LoadInputFile:  For property name:[variable 21]
STOP 1
``````
It complains about the 21st variable, but it does no matter, which variable is the 21st.

So, now I think about creating multiple scalar solver sections to not exceed 20 variables per section. However, perhaps I am just totally wrong on how I try to get my integration results. Does anyone have a better idea?
Thx!
raback
Posts: 4821
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: max number of variables in scalar solver section

Hi

This seems to be a problem when reading in the keyword. Probably it helps if you say

Code: Select all

``````Variable 21 = String "..."
``````
Now this also suggest that your code is old since currently the keyword checker has no upper bound.

-Peter
ea_Marc
Posts: 7
Joined: 18 Nov 2022, 14:48
Antispam: Yes

### Re: max number of variables in scalar solver section

Changing the code like this:

Code: Select all

``````Variable 18 = String "Magnetic Vector Potential 3"
Operator 18 = Body Int
Variable 19 = String "Magnetic Vector Potential 3"
Operator 19 = Body Int
Variable 20 = String "Magnetic Vector Potential 3"
Operator 20 = Body Int
Variable 21 = String "Magnetic Vector Potential 3"
Operator 21 = Body Int
Variable 22 = String "Magnetic Vector Potential 3"
Operator 22 = Body Int
``````
It starts complaining

Code: Select all

``````ERROR:: LoadInputFile:
ERROR:: LoadInputFile:  In section: [solver 6]
``````
If you say, that my code is old, that is probably correct, I am learning from "old" examples, what is the modern way to write out the results?
Rich_B
Posts: 422
Joined: 24 Aug 2009, 20:18

### Re: max number of variables in scalar solver section

Hello,

I think the reference to 'old code', means that you might be running an older version of Elmer. What is the Compile date listed in the ElmerSolver output to console?

Posting a minimal working example may be the fastest way for you to get an answer.

Rich.
ea_Marc
Posts: 7
Joined: 18 Nov 2022, 14:48
Antispam: Yes

### Re: max number of variables in scalar solver section

It's version 9:

Code: Select all

``````ELMER SOLVER (v 9.0) STARTED AT: 2023/08/08 08:23:03
ParCommInit:  Initialize #PEs:            1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Version: 9.0 (Rev: b0f5c763e, Compiled: 2023-02-09)
MAIN:  Running one task without MPI parallelization.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
ERROR:: LoadInputFile:  In section: [solver 6]
``````
I attached the example. The file ending is bz2, but it is an xz, which I was not allowed to upload. xz was necessary due to file size restriction. Thx for your support!
Attachments
example.tar.xz.bz2
raback
Posts: 4821
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: max number of variables in scalar solver section

Hi

As said, the keyword checker has been enhanced. If you have an old version you can manipulate the SOLVER.KEYWORDS file or just add types for all keywords with index >20.

Code: Select all

``````  Variable 21 = String "Magnetic Vector Potential 3"
Mask Name 21 = String "s_slot_30_B+"
Operator 21 = String "body int"
``````
Generally it is not very fruitful to chase problems in old code that may have been addressed in the current version.

-Peter
Rich_B
Posts: 422
Joined: 24 Aug 2009, 20:18

### Re: max number of variables in scalar solver section

Hello,

From your post, the Elmer Compiled date is 2023-02-09, so the version is about 6 months old.

Running your example using Elmer with Compiled date of 2023-08-03 ran to completion with the attached solver log.

Rich.
Attachments
log-solver.7z
ea_Marc
Posts: 7
Joined: 18 Nov 2022, 14:48
Antispam: Yes

### Re: max number of variables in scalar solver section

Thanky you very much Rich. I compiled ELMER in release branch and ELMER release-9.0 tag. Version from release branch throw the same error than before, version from release-9 tag throws: "elements.def not found".

I can not compile the actual develop branch, due to:

Code: Select all

``````/home/scma/devel/elmer/elmerfem/fem/src/SParIterComm.F90:5019:51:

CALL MPI_ALLREDUCE( ssum, tsum, 1, MPI_COMPLEX, &
1
Error: Symbol ‘mpi_complex’ at (1) has no IMPLICIT type
``````
even with WITH_MPI=OFF

But I understand, that the error has something to do with the compiled version, because it runs for you. Let's see, what the future brings.

@Peter: Well I was really not aware, that a 6 month old version with the same version number is "old code".
Rich_B
Posts: 422
Joined: 24 Aug 2009, 20:18

### Re: max number of variables in scalar solver section

Hello,

I ran the Windows installer, which is based on the latest devel branch. Elmer has been on Version 9 for several years. That is why looking at the Compiled Date is of interest.

Which OS are you running?

Rich.
ea_Marc
Posts: 7
Joined: 18 Nov 2022, 14:48
Antispam: Yes

### Re: max number of variables in scalar solver section

Ah ok, I was not aware that version 9 is a LTS version

I use Rocky Linux 8.

Today I tried to compile the devel branch with ubuntu 20.04, but this does not work as well ... There he complains about not finding the mpif.h.

Code: Select all

``````[ 52%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/GeneralUtils.F90.o
/home/scma/devel/elmer/elmerfem/fem/src/GeneralUtils.F90:1994: Error: Can't open included file 'mpif.h'
make[2]: *** [fem/src/CMakeFiles/elmersolver.dir/build.make:245: fem/src/CMakeFiles/elmersolver.dir/GeneralUtils.F90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:15397: fem/src/CMakeFiles/elmersolver.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
``````
This applies for devel and release branch. It's curious, because the file is available and cmake set the MPI_Fortran_INCLUDE_PATH correctly.
However, I do not want to bother you with compilation issues.

I tested the windows version as well, there it works .

I installed the ppa Version on ubuntu 20.04, there it works as well, thx!