Frustrations learning Elmer

General discussion about Elmer
pwray
Posts: 31
Joined: 11 Nov 2022, 05:59
Antispam: Yes

Frustrations learning Elmer

Post by pwray »

Ive been using Elmer for a short while, and have proceeded from modifying the introductory examples, and asking questions on the forum. Im gradually gathering information from the many documents, and from this forum, which has been very helpful thanks to a few people who seem to be ever-ready to answer obvious newbie questions (thanks :))

I thought it may be useful to write down a few examples of the sort of things that confuse new users...

Recently Im going through the SIF file, trying to understand it line by line, but I really dont get far before I have very basic questions I can't answer, but ought to be able to answer from the reference material. (Of course maybe I have just missed it in the documentation, and I will be told RTFM!)

For example I have a SIF file with:

Code: Select all

Body 1
    Target Bodies(1) = 1
But I cannot find documentation for 'Target Bodies'. Presumably, it is an external reference to the index of the required bodies as defined in the mesh.
But then later, I find other examples which DONT include Target Bodies under Body. So now all sorts of questions arise, like:
* Is it just because there is one body that we dont need to specify since its not ambiguous?
* or does the number after 'Body' now refer to a external entity, and not just a reference internal to the SIF file?
* or is Target Bodies only required when you want to include multiple bodies under one Elmer body?

Edit: I think I can answer this now. P12 of the solver manual states: "Note that the integer in the body section name is an identifier for the body itself." So presumably:
* Body section numbers are external references to physical groups in the mesh file, if there is one body
* Target Bodies(1) = n will override this behaviour either (i) if you want a more consistent approach of cleanly separating internal references from external references, OR (ii) if you need to specify more than one external body.
Note that the sentence I quoted above is not in a reference manual under "Body...", but just a sentence among many others in the solver manual, whose full meaning may not be obvious to a beginner at the first reading, particularly as it does not stress that its an *external* reference to a mesh physical group, unlike other section identifiers in the sif file which are (AFAIK) all internal. The words 'the body itself' are ambiguous.
End Edit

Similarly I find under 'Solver' section:

Code: Select all

Solver 1
    Equation = Elastic Plates
Here I find different names are used in different SIF files, and this does not seem to be a cross-reference in the SIF file, even though I have an Equation section with a Name="Plate Equation", it does not seem to be required at all, nor required to be the same if both are present. Still I wonder, because the keyword is 'Equation', not 'Equation Title' or something that would make its usage more obvious.

Or again something like:

Code: Select all

Solver 1
    Procedure = "Smitc" "SmitcSolver"
This is less important I guess, because Im unlikely to every want to adjust this line to do something different. Still I'm still left with questions. Why are there are two designations for the solver? Is one a shorthand? If so, why specify both? If they specify different aspects, then what do they each mean? Are there different combinations of keywords that can be used here? And so on... Without a reference manual, these lines become like incantations that you dont fully understand, you just do it because 'thats the way its done'.

(Edit: I think Ive found the answer to this one. "Smitc" is the module and "SmitcSolver" is the subroutine. Both are required. But I needed to find this detail in the models manual so I could understand the syntax, rather than have the syntax defined first in a reference manual.) End Edit

So my point is that a complete and unambiguous reference manual is required for keywords in the sif file, at least the basic ones. I understand that Elmer is a research tool first and foremost, and people are adding keywords all the time. But if Ive faced these sorts of problems with the simplest keywords I guess others have too. Probably when they were first added, each keyword had an intuitively obvious role, but they may not remain so as additions and changes are made. Many people probably just cut and paste and accept that "it seems to work like this, that's just what you do", because one feels stupid asking such basic questions on the forum.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Frustrations learning Elmer

Post by kevinarden »

In the documentation link, you can go to parent directory and then find presentations, courses, etc. Such as this one
https://www.nic.funet.fi/pub/sci/physic ... merSif.pdf

Input in parenthesis allow multiple things to be targeted and become one, such as
Target Bodies(3) = 1 2 3
Target Boundaries(2) = 1 2

You can also use body names not numbers, there is good information on how to mesh body and boundaries, with control over there numbers and names here at least for gmsh and salome. Basically physical groups become named bodies and boundaries.
https://www.nic.funet.fi/pub/sci/physic ... dElmer.pdf

Procedure = "module" "Subroutine" is correct
there maybe more than one subroutine in a module, and you can write your own modules, with multiple subroutines
they are compiled with elmerf90
elmerf90 MyModule.F90 -o MyModule.so (or dll on windows)
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: Frustrations learning Elmer

Post by Rich_B »

Hello,

As Kevin posted, the slides at

https://www.nic.funet.fi/pub/sci/physics/elmer/slides/

are a basic introduction to the Elmer suite. The Sif slides in particular are close to being a 'Get Started with Sif files'.

Would adding some additional sections to GetStartedElmer.pdf be helpful? Such as summarizing the Sif slides?

Rich.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Frustrations learning Elmer

Post by raback »

Hi

Legit questions. It may be a little confusing.

Often in meshes the identier for a group is a number. It is annoying if one need to repeat the same thing many times so you have "Target Bodies" (and "Target Boundaries") for convenience so you can group things together.

"Equation" was initially used to identify the "Procedure". That was many years ago when there were just a few options and they were built in. Later, Elmer was made able to deal with any number different modules that are DLL and Equation remains just a tag in some internal opeterations.

-Peter
pwray
Posts: 31
Joined: 11 Nov 2022, 05:59
Antispam: Yes

Re: Frustrations learning Elmer

Post by pwray »

The slides about the sif file dont help much, because none of the confusions I mentioned in the original post are covered by that document. In fact part of the problem is that there is probably *too much* documentation in too many different places, so that it's too much trouble to keep it all up to date.

At a minimum, I think that more detailed info in the solver manual about each keyword's pupose, syntax, other related keywords or mutually exclusive keywords would be very useful for beginners.

Beyond that, a wiki or living reference manual might be something that the community could develop and improve together. This might help with undocumented keywords, so new tags could be added by the developers in a timely manner. (For example I recently learnt that some undocumented keywords developed for linear elasticity can also be used with the plate solver, like HarmonicMode. But only by being told on the forum. But AFAIK, the detailed workings of HarmonicMode remain undocumented, save one or two comments in the test files. The other advantage of a good wiki could be that modifications could be made by beginners (when they first learn about something that is not properly documented) and their edits checked for accuracy by more experienced users/administrators. That could be a sort of code of practice on the forum - we will help you with your issues with Elmer, but in exchange, you put in some time improving the docs, so the next person does not face the same issue.

I find it remarkable that a GUI has been developed (actually two if I you count the old one), presumably to overcome some of the issues that beginners face, and that development would have taken far more time to than it would take to improve the reference documentation. I actually find the sif file approach simpler, quicker, and more useful (particularly combined with a scripting language). Although a beginner, I barely used the GUI, because at the end of the day when a problem arises, the sif file is what needs to be understood, and the GUI can actually obscure the logical structure of the problem you are solving.

Sorry for the ranting, but I do think that Elmer would benefit from taking the perspective of a beginner.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Frustrations learning Elmer

Post by raback »

Hi

ElmerGUI really has not eaten any resources from documentation or solver development lately. The whole code was coined long ago in less than a year mainly by the ingenious Mikko L. Currently we are extremely lucky to have T. Saeki continue the work in equally high level in the truest spirit of open source software. A big hand to Saeki!! So we really use most of the time just on the ElmerSolver part.

Our funding instruments are related to new developments for various projects. So there is something happening all the time under the hood. The resources to constantly improve the documentation and consistency, keep up with latest best practices etc. is somethings that works better for commercial software. Luckily we have some kind spirits like Kevin and Rich you take time to try to help newcomers in this forum to overcome the limitations.

My hope would be that there could be domain specific communities. So whether you're working on electrical machines, glaceology, blood flow, crystal growth, acoustics, thermal analysis etc. there would be at least small group of peers. For glaceology (Elmer/Ice) this has worked extremely well and they have close to 200 publications. In parts it is even driving Elmer developments aside being a community.

So I wish I could say we'll fix everything but it is not that easy...

-Peter
saekit
Posts: 6
Joined: 27 Jul 2019, 01:34
Antispam: Yes
Location: Okayama, Japan

Re: Frustrations learning Elmer

Post by saekit »

Hello pwray,

Please never be sorry. Telling your frustration and such rating is a great contribution to the community. I'm the one who update ElmerGUI frequently. Because I'm not a member of CEC, I was keeping a distance from documentation of ElmerSolver. In this time, I spent some time for this topic according to your recommendation. Your feedback changed my behavior. That's great.


Hi all,

I want dive into the confusion around Target Bodies in more detail. This confusion is caused by using same word Body for two different things (referred as to "internal" and "external" by pwray):
  • One is for a geometric entity defined in Elmer mesh files. Let's call it geometric body here. Geometric bodies are distinguished by its ID specified in the 2nd column of the file mesh.elements
  • Another is for a Body section in sif file. A Body section assigns a set of body-related sections (i.e., Material, Equation, Body Force, Initial Condition) to geometric bodies by specifying IDs of the geometric bodies with "Target Bodies" keyword. Body sections are distinguished by the number following the word 'Body' in the top line of each Body section. Let's call this number Body section number here.
When "Target Bodies" keyword in a Body section is omitted, body-related sections in the Body section are assigned to the geometric body whose ID is identical to the Body section number. (I confirmed this not by reading source code, but by running simulation with modifying sif file and mesh.elements file. So, there may be exceptions.)

The body-related sections (Material, Equation, Body Force, Initial Condition) do not have "Target Bodies" keyword. That's why we need Body section. On the other hand, Boundary Condition section has "Target Boundaries" keyword. This is because Boundary Condition is the only boundary-related section which is assigned to geometric boundaries, and there is no need to consider a set of boundary-related sections. As pwray mentioned, this asymmetry between body and boundary amplifies the confusion. Interestingly, when "Target Boundaries" keyword is omitted, the Boundary Condition wasn't assigned to any geometric boundary as far as I tried.

I'm going to put this explanation into https://github.com/ElmerCSC/elmerfem/wiki, but is that right place for such a topic?


BTW, to eliminate this confusion, one possible change in sif file format would be:
  • Rename Body section to Body Assignment section, AND
  • Take "Target Boundaries" keyword away from Boundary Condition, AND
  • Add new section Boundary Assignment to specify Boundary Condition and Target Boundaries
sif file will look as shown below. This is just an idea. Some people may feel this is too redundant.

Saeki

Code: Select all

Body Assignment 1
  Target Bodies(2) = 1 2
  Equation = 1
  Material = 1
End

Boundary Assignment 1
  Target Boundaries(5) = 1 2 3 4 5
  Boundary Condition = 1
End
 
Equation 1
  ...
End

Material 1
  ...
End

Boundary Condition 1
 ...
End
...
MartinHoeijmakers
Posts: 37
Joined: 22 Oct 2017, 21:03
Antispam: Yes

Re: Frustrations learning Elmer

Post by MartinHoeijmakers »

Hi,

Perhaps it is also possible to mention the possibility to relate a Body and a Boundary Condition section to the mesh by using the keyword Name instead of using the keywords Target Bodies and Target Boundaries.

Kind regards,
Martin Hoeijmakers
saekit
Posts: 6
Joined: 27 Jul 2019, 01:34
Antispam: Yes
Location: Okayama, Japan

Re: Frustrations learning Elmer

Post by saekit »

Thanks Martin! Yes, that's a good point. I guess it's a little complicated for beginners and worth to add. -Saeki
pwray
Posts: 31
Joined: 11 Nov 2022, 05:59
Antispam: Yes

Re: Frustrations learning Elmer

Post by pwray »

Hello saekit

I think that changing syntax is always going to be a huge headache, so claryfying the documentation in the solver manual is the most important step. A general community wiki could be great, but would still need to be monitored & curated by admins so misinformation is not added and it stays well organised.

If syntax changes were to be considered though (not advocating, just responding to your suggestion), what about just mandating the use of Target Bodies, and making the Body N reference strictly internal? That seem to be the minimal change.

(Edit: I suggested another syntax possibility here that would not work, so I deleted)

PS Are notifications working for the forum? I am subscribed to the topic, and I believe I have the correct options set, but have nothing in my notifications list.

Paul
Post Reply