ElmerGrid / MATC bug ?

Clearly defined bug reports and their fixes
Post Reply
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

ElmerGrid / MATC bug ?

Post by NJank »

for scripting I use MATC variables to define my grid size. I ran into a recent bug where I had an 8x8 grid that worked fine, but a 9x8 grid would crash elmergrid. (it wouldn't throw an error message. I'd get some sort of unhandled exception crash).

Here's the working grid file:

Code: Select all

***** ElmerGrid input file for structured grid generation *****
Version = 210903
MATC = True

$Mesh_dens = 17000
$Diamond_Passivation = 0.1e-6
$subthickness = 380e-6
$subthickminus30 = subthickness - 30e-6
$GanThick =1.2e-6
$Bufferw = 493.35e-6
$Act_width = 500e-9
$Act_halfwidth = Act_width/2
$Act_height = 30e-9
$Act_halfheight = Act_height/2

Coordinate System = Cartesian 2D
Subcell Divisions in 2D = 9 8 
Subcell Sizes 1 = 493.35e-6 $4e-6 1.9e-6 Act_halfwidth Act_halfwidth 1.2e-6 1.2e-6 4.5e-6 Bufferw
Subcell Sizes 2 = $subthickminus30 30e-6 GanThick Act_halfheight Act_halfheight 0.15e-6 Diamond_Passivation 1e-6 

Material Structure in 2D
  0 0 0 0 0 0 0 0 0
  1 1 1 1 1 1 1 1 1
  1 2 1 1 1 2 1 2 1
  3 3 3 4 4 3 3 3 3
  3 3 3 4 4 3 3 3 3
  5 5 5 5 5 5 5 5 5
  6 6 6 6 6 6 6 6 6
  7 7 7 7 7 7 7 7 7 
End
Materials Interval = 1 7

Surface Elements = $Mesh_dens	

Element Densities 1 = 10 9 30 100 100 20 20 9 10
Element Densities 2 = 100 100 100 1 1 1 1 10

!Minimum Element Divisions = 1 1 
Triangles = False

Boundary Definitions
! type     out      int      double   of the boundaries
! top 
  1        -3        1        1
!heatzone top surface
  2        -3       4        1
! side symmetries
  3        0        1        1
  3        0        3        1
  3        0        5        1
  3        -2       6        1
  3        -4       6        1
  3        -2       7        1
  3        -4       7        1
! bottom conv
  4       -1        7        1
!heat gap / interface resistance boundary
! 5        5        6        2
End

Numbering Horizontal
Element Degree = 1s
and here's a version that throws the error. The only difference is that the first element of the "Subcell Sizes 1" list is a MATC variable. It also means that the line includes a 9 element list in the MATC definition.

Code: Select all

***** ElmerGrid input file for structured grid generation *****
Version = 210903
MATC = True

$Mesh_dens = 17000
$Diamond_Passivation = 0.1e-6
$subthickness = 380e-6
$subthickminus30 = subthickness - 30e-6
$GanThick =1.2e-6
$Bufferw = 493.35e-6
$Act_width = 500e-9
$Act_halfwidth = Act_width/2
$Act_height = 30e-9
$Act_halfheight = Act_height/2

Coordinate System = Cartesian 2D
Subcell Divisions in 2D = 9 8 
Subcell Sizes 1 = $Bufferw 4e-6 1.9e-6 Act_halfwidth Act_halfwidth 1.2e-6 1.2e-6 4.5e-6 Bufferw
Subcell Sizes 2 = $subthickminus30 30e-6 GanThick Act_halfheight Act_halfheight 0.15e-6 Diamond_Passivation 1e-6 

Material Structure in 2D
  0 0 0 0 0 0 0 0 0
  1 1 1 1 1 1 1 1 1
  1 2 1 1 1 2 1 2 1
  3 3 3 4 4 3 3 3 3
  3 3 3 4 4 3 3 3 3
  5 5 5 5 5 5 5 5 5
  6 6 6 6 6 6 6 6 6
  7 7 7 7 7 7 7 7 7 
End
Materials Interval = 1 7

Surface Elements = $Mesh_dens	

Element Densities 1 = 10 9 30 100 100 20 20 9 10
Element Densities 2 = 100 100 100 1 1 1 1 10

!Minimum Element Divisions = 1 1 
Triangles = False

Boundary Definitions
! type     out      int      double   of the boundaries
! top 
  1        -3        1        1
!heatzone top surface
  2        -3       4        1
! side symmetries
  3        0        1        1
  3        0        3        1
  3        0        5        1
  3        -2       6        1
  3        -4       6        1
  3        -2       7        1
  3        -4       7        1
! bottom conv
  4       -1        7        1
!heat gap / interface resistance boundary
! 5        5        6        2
End

Numbering Horizontal
Element Degree = 1s
realizing that's two changes, here's a third case, where the first element in the list is just the size value and not a variable, but still included after the $ for MATC parsing. This version also crashes.

Code: Select all

***** ElmerGrid input file for structured grid generation *****
Version = 210903
MATC = True

$Mesh_dens = 17000
$Diamond_Passivation = 0.1e-6
$subthickness = 380e-6
$subthickminus30 = subthickness - 30e-6
$GanThick =1.2e-6
$Bufferw = 493.35e-6
$Act_width = 500e-9
$Act_halfwidth = Act_width/2
$Act_height = 30e-9
$Act_halfheight = Act_height/2

Coordinate System = Cartesian 2D
Subcell Divisions in 2D = 9 8 
Subcell Sizes 1 = $493.35e-6 4e-6 1.9e-6 Act_halfwidth Act_halfwidth 1.2e-6 1.2e-6 4.5e-6 Bufferw
Subcell Sizes 2 = $subthickminus30 30e-6 GanThick Act_halfheight Act_halfheight 0.15e-6 Diamond_Passivation 1e-6 

Material Structure in 2D
  0 0 0 0 0 0 0 0 0
  1 1 1 1 1 1 1 1 1
  1 2 1 1 1 2 1 2 1
  3 3 3 4 4 3 3 3 3
  3 3 3 4 4 3 3 3 3
  5 5 5 5 5 5 5 5 5
  6 6 6 6 6 6 6 6 6
  7 7 7 7 7 7 7 7 7 
End
Materials Interval = 1 7

Surface Elements = $Mesh_dens	

Element Densities 1 = 10 9 30 100 100 20 20 9 10
Element Densities 2 = 100 100 100 1 1 1 1 10

!Minimum Element Divisions = 1 1 
Triangles = False

Boundary Definitions
! type     out      int      double   of the boundaries
! top 
  1        -3        1        1
!heatzone top surface
  2        -3       4        1
! side symmetries
  3        0        1        1
  3        0        3        1
  3        0        5        1
  3        -2       6        1
  3        -4       6        1
  3        -2       7        1
  3        -4       7        1
! bottom conv
  4       -1        7        1
!heat gap / interface resistance boundary
! 5        5        6        2
End

Numbering Horizontal
Element Degree = 1s
My preference would be to have a variable for that first list element, so this is a bit inconvenient, but something I can workaround for the time being. But I wasn't aware of whether it was a bug or a known limitation.

I've tested this on 2 PC's. One older laptop running Windows 2000,with the latest Elmer Nightly build [Library version:6.1 (Rev:5043)] and another running Vista, but with an older Elmer version (Library version: 6.0 (Rev: 4649)) Both 32bit, no parallel setup. Both crash the same way. Newer machine is a managed desktop, so it tends to run older versions since I have to put a help desk ticket in to request the upgrade.

The Win2K version does provide the following error message with the crash, not sure if it's of any use:

Elmergrid - Application error
The instruction at "0x6d756c6f" referenced memory at "0x6d756c6f". The memory could not be "read".
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: ElmerGrid / MATC bug ?

Post by raback »

Hi

You're certainly stretching the limits of ElmerGrid format. I barely remembered that it had matc built in. Anyways, when MATC is activated every expression after the '$' mark is evaluated using the matc library. Now it seems that your one long line is interpreted as a vector and matc adds separators between the values making the continued work difficult for the ElmerGrid parser. The remedy is to close each matc field, also by '$' sign. So instead of

Code: Select all

$x 1.2 3.4 $y 5.6
use

Code: Select all

$x$ 1.2 3.4 $y$ 5.6
The closing of matc fields is of course not that crucial if the parameter finishes the line.

-Peter
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

Re: ElmerGrid / MATC bug ?

Post by NJank »

The remedy is to close each matc field, also by '$' sign.
Ahhh... I didn't realize it was a field marker with closing as an option. I thought it was a flag telling the MATC parser to take care of the rest of the line. This makes much more sense.

Thanks again.
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

Re: ElmerGrid / MATC bug ?

Post by NJank »

ok, took me a while to get back on this. The $variablename$ format didn't exactly fix the problem. It seems that the closing $ ends the line. In otherwords, if I'm defining a 10 item list, and the 3rd is the MATC variable, I can't just put
list = 1 2 $thirditem$ 4 5 6 7 8 9 10
because it seems to interpret that as just
list = 1 2 $thirditem$

and enclosing the full 10 item list in the $, as in
list = 1 2 $thirditem 4 5 6 7 8 9 10$

causes the same type of crash mentioned at the start of the thread.

this seems to preclude any format such as the one I was trying for, such as
list = 1 2 $thirditem 4 5 6 7 8 9 tenthitem$
stroop
Posts: 26
Joined: 22 Nov 2016, 17:26
Antispam: Yes
Location: Germany

Re: ElmerGrid / MATC bug ?

Post by stroop »

did you use elmergrid to convert the grd file into elmer mesh files? if so, did you get an error that MATC was not compiled?
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

Re: ElmerGrid / MATC bug ?

Post by NJank »

stroop wrote:did you use elmergrid to convert the grd file into elmer mesh files? if so, did you get an error that MATC was not compiled?
this was 6 years ago so I don't recall exactly. As the first post says, I was getting an


My general workflow was to use elmergrid that way, but I don't recall any particular error message except for what is posted in my initial message above. unhandled exception crash, no specific elmergrid error message. no message about matc.
stroop
Posts: 26
Joined: 22 Nov 2016, 17:26
Antispam: Yes
Location: Germany

Re: ElmerGrid / MATC bug ?

Post by stroop »

ok thanks for responding, I guess your version had matc compiled within ElmerGrid already if you didn't receive the error. :)
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

Re: ElmerGrid / MATC bug ?

Post by NJank »

stroop wrote:ok thanks for responding, I guess your version had matc compiled within ElmerGrid already if you didn't receive the error. :)
For the windows releases I think that would be a correct assumption.
NJank
Posts: 99
Joined: 05 Dec 2009, 00:05
Location: Baltimore, MD, USA

Re: ElmerGrid / MATC bug ?

Post by NJank »

just a late update now that I'm using newer versions of elmer on windows, i'm getting matc not compiled errors as well. perhaps it stopped being included by default?
Post Reply