dolfin-convert not accessible

Asked by Niklas

Hello FEniCS Community,

As a beginner in FEniCS, I seem unable to get the dolfin-convert script working. I used the syntax described in the manual:

dolfin-convert mesh.grid mesh.xml

I tried to call it from both the dolfin- and windows shell, both do not recognize the script, even it points at the binary folder of FEniCS, containing the script file. Do I have to add a reference somewhere, or do I have a queer approach?

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
FEniCS Project Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Jan Blechta (blechta) said :
#1

On Tue, 02 Apr 2013 11:51:24 -0000
Niklas <email address hidden> wrote:
> New question #225681 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/225681
>
> Hello FEniCS Community,
>
> As a beginner in FEniCS, I seem unable to get the dolfin-convert
> script working. I used the syntax described in the manual:
> dolfin-convert mesh.grid mesh.xml
>
> I tried to call it from both the dolfin- and windows shell, both do
> not recognize the script, even it points at the binary folder of
> FEniCS, containing the script file. Do I have to add a reference
> somewhere, or do I have a queer approach?
>
> Thanks in advance
>

Probably you can't execute python script by writing its name in windows
shell. Try
  C:\>python dolfin-convert mesh.grid mesh.xml

Or in python interpreter you can do
  >>> from dolfin_utils.meshconvert import meshconvert
  >>> meshconvert.foo(...)

Jan

Revision history for this message
Niklas (ntschech) said :
#2

By Murphy's Law I found the solution right after posting. If anyone was ever wondering the same:

dolfin-convert is a seperate python script (without the file extension) located in ~\bin. For convenience copy it to your project folder. The syntax will then be:

python dolfin-convert mesh.grid mesh.xml

This applies to the windows version...

Revision history for this message
Niklas (ntschech) said :
#3

Thanks Jan Blechta, that solved my question.

Revision history for this message
Niklas (ntschech) said :
#4

Actually, it did not seem to do the trick. I can execute the script now and it will generate the XML. It gives an error message though,
"dolfin-order is not recognized as an internal or external command..."

dolfin-order is put in the working directory, as well.

While the XML is generated, the _materials file just contains an empty MeshFunction. from what I understand, the different volumes should be defined here(?).

_material file:

<?xml version="1.0" encoding="UTF-8"?>
<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
  <mesh_function type="uint" dim="3" size="0">
  </mesh_function>
</dolfin>

I generate the mesh with NETGEN and then export to Abaqus file format, which seems to take account of the different volumes:

...
*Element, type=C3D4, ELSET=PART2
23831, 897, 986, 898, 809
...

Any ideas?

Revision history for this message
Johannes Ring (johannr) said :
#5

Try to create a file dolfin-convert.bat with the following contents:

  python "%~dp0\dolfin-convert" %*

Place this in the same folder as the dolfin-convert script. By default, this is C:\FEniCS\bin.

Revision history for this message
Niklas (ntschech) said :
#6

Unfortunately that makes no difference...

Revision history for this message
Jan Blechta (blechta) said :
#7

On Wed, 03 Apr 2013 11:26:00 -0000
Niklas <email address hidden> wrote:
> Question #225681 on FEniCS Project changed:
> https://answers.launchpad.net/fenics/+question/225681
>
> Status: Solved => Open
>
> Niklas is still having a problem:
> Actually, it did not seem to do the trick. I can execute the script
> now and it will generate the XML. It gives an error message though,
> "dolfin-order is not recognized as an internal or external command..."

That's the same problem like with dolfin-convert. On unix-like systems
you can call script file by its name (if it has executable mode bit
and has #!/path/to/interpreter on its first line). dolfin-convert
script calls dolin-order in the same way. You got at least three options

1. force your os to be able to execute script by its name - I don't
   know if it is possible
2. use second approach I suggested - call meshconvert.foo(...) from
   python interpreter
3. tweak dolfin-convert script - change "dolfin-order ..." call to
   "python dolfin-convert ..."

>
> dolfin-order is put in the working directory, as well.
>
> While the XML is generated, the _materials file just contains an empty
> MeshFunction. from what I understand, the different volumes should be
> defined here(?).
>
> _material file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
> <mesh_function type="uint" dim="3" size="0">
> </mesh_function>
> </dolfin>
>
> I generate the mesh with NETGEN and then export to Abaqus file format,
> which seems to take account of the different volumes:
>
> ...
> *Element, type=C3D4, ELSET=PART2
> 23831, 897, 986, 898, 809
> ...
>
>
> Any ideas?
>

Check site-packages/dolfin_utils/meshconvert/meshconvert.py if it
supports cell markers for your format and what is the logic behind
_material file. I reccomned using newer version of FEniCS - at least
1.1.0 as there were added features and fixed some issues in
meshconvert.py.

Jan

Revision history for this message
Johannes Ring (johannr) said :
#8

You should also add a file dolfin-order.bat with similar contents:

python "%~dp0\dolfin-order" %*

Revision history for this message
Jan Blechta (blechta) said :
#9

On Wed, 03 Apr 2013 11:46:15 -0000
Jan Blechta <email address hidden> wrote:
> Question #225681 on FEniCS Project changed:
> https://answers.launchpad.net/fenics/+question/225681
>
> Status: Open => Answered
>
> Jan Blechta proposed the following answer:
> On Wed, 03 Apr 2013 11:26:00 -0000
> Niklas <email address hidden> wrote:
> > Question #225681 on FEniCS Project changed:
> > https://answers.launchpad.net/fenics/+question/225681
> >
> > Status: Solved => Open
> >
> > Niklas is still having a problem:
> > Actually, it did not seem to do the trick. I can execute the script
> > now and it will generate the XML. It gives an error message though,
> > "dolfin-order is not recognized as an internal or external
> > command..."
>
> That's the same problem like with dolfin-convert. On unix-like systems
> you can call script file by its name (if it has executable mode bit
> and has #!/path/to/interpreter on its first line). dolfin-convert
> script calls dolin-order in the same way. You got at least three
> options
>
> 1. force your os to be able to execute script by its name - I don't
> know if it is possible
> 2. use second approach I suggested - call meshconvert.foo(...) from
> python interpreter
> 3. tweak dolfin-convert script - change "dolfin-order ..." call to
> "python dolfin-convert ..."

typo fix: change "dolfin-order ..." call to "python dolfin-order ..."

>
> >
> > dolfin-order is put in the working directory, as well.
> >
> > While the XML is generated, the _materials file just contains an
> > empty MeshFunction. from what I understand, the different volumes
> > should be defined here(?).
> >
> > _material file:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
> > <mesh_function type="uint" dim="3" size="0">
> > </mesh_function>
> > </dolfin>
> >
> > I generate the mesh with NETGEN and then export to Abaqus file
> > format, which seems to take account of the different volumes:
> >
> > ...
> > *Element, type=C3D4, ELSET=PART2
> > 23831, 897, 986, 898, 809
> > ...
> >
> >
> > Any ideas?
> >
>
> Check site-packages/dolfin_utils/meshconvert/meshconvert.py if it
> supports cell markers for your format and what is the logic behind
> _material file. I reccomned using newer version of FEniCS - at least
> 1.1.0 as there were added features and fixed some issues in
> meshconvert.py.
>
> Jan
>

Revision history for this message
Niklas (ntschech) said :
#10

That did solve the error message. The batch call made the dolfin-order available. I suppose, adding the bin folder to the windows path will make the scripts globally available then.

Unfortunately, I still do not have volumes / materials, however...

Version 1.0.0 seems to be the newest Win32/64 build :-/.

Revision history for this message
Johannes Ring (johannr) said :
#11

Yes, with these .bat files you can run the scripts as you would on unix. The bin folder should already be in the path if you use the FEniCS command shell.

Yes, 1.0.0 is the latest binary package for Windows and making a package for 1.2.0 does not have high priority. An alternative is to install Ubuntu in a virtual machine and then install 1.2.0 from the FEniCS PPA.

Can you help with this problem?

Provide an answer of your own, or ask Niklas for more information if necessary.

To post a message you must log in.