An error occurred reading the comsol mphtxt grid file

52 views
Skip to first unread message

chen zheng

unread,
Apr 11, 2023, 3:40:47 AM4/11/23
to deal.II User Group
hi
I modified Step 40 and an error occurred when I called comsol-mphtxt. I compared the read_comsol_mphtxt function to the file and found no error. 
    • There is no error when I call the ".inp" file.

      
exception on processing:

An error occurred in line <1557> of file </home/dlut/software/dealii/dealii-9.4.1/source/grid/grid_in.cc> in function
void dealii::GridIn<dim, spacedim>::read_comsol_mphtxt(std::istream&) [with int dim = 2; int spacedim = 2; std::istream = std::basic_istream]
The violated condition was:
s == "4 Mesh"
circle-grid.inp
example.mphtxt
step-40.cc

Wolfgang Bangerth

unread,
Apr 11, 2023, 3:17:52 PM4/11/23
to dea...@googlegroups.com
On 4/11/23 01:40, 'chen zheng' via deal.II User Group wrote:
> I modified Step 40 and an error occurred when I called comsol-mphtxt. I
> compared the read_comsol_mphtxt function to the file and found no error.

I looked into this, and the underlying issue turned out to be that the
COMSOL .mphtxt file uses DOS/Windows-style line endings whereas I
believe that you are running the program on Linux, which uses a
different style of line endings.

The problem goes away once you change the line endings from \r\n
(Windows) to \n (Unix). But this is a recurring problem, and so I've
also written the following patch:
https://github.com/dealii/dealii/pull/15079

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
Reply all
Reply to author
Forward
0 new messages