Hello,

It seems possible to generate a parameterized 1D mesh using gmsh within a
python script, and then generate the corresponding 1D FiPy mesh in that
same python script:

1) Use pygmsh in a python script to construct a parameterized 1D (gmsh)
mesh.

2) From that 1D mesh, construct a list of dx's

3) Follow https://www.mail-archive.com/fipy@nist.gov/msg01650.html and
create a 1D FiPy mesh from a list of dx's.

It was pure luck to have found the mailing list message in (3).

I did not see how to get the Physical Groups data from the pygmsh mesh into
the FiPy mesh.

Thanks



On Thu, Jul 12, 2018 at 3:26 PM Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> No, FiPy doesn't presently have any ability to read 1D meshes.
>
> I do have some experimental code that supports this, but it needs a lot of
> work. I have no prognosis for when this will be made public.
>
> - Jon
>
> > On Jul 12, 2018, at 1:21 PM, Drew Davidson <davidson...@gmail.com>
> wrote:
> >
> > Hello,
> >
> > Can Gmsh2D read a 1D gmsh mesh?
> >
> > I have tried a similar script to the FiPy diffusion example circle.py:
> >
> > SCRIPT BEGINS
> > import fipy as fp
> > from IPython import embed
> > import sys
> >
> > #I created this gmsh .geo file in gmsh GUI, then copied and pasted here;
> I cannot see a syntax error if it exists???
> >
> > geo="""
> > L_Sample=%(L_Sample)g;
> > L_Substrate=%(L_Substrate)g;
> > cellSize=%(cellSize)g;
> > Point(1) = {0, 0, 0, cellSize};
> > Point(2) = {L_Substrate, 0, 0, cellSize};
> > Point(3) = {L_Substrate+L_Sample, 0, 0, cellSize};
> > Line(1) = {1, 2};
> > Line(2) = {2, 3};
> > Physical Point("SubstrateEnd") = {1};
> > Physical Point("SampleEnd") = {3};
> > Physical Point("ThermalContact") = {2};
> > Physical Line("Substrate") = {1};
> > Physical Line("Sample") = {2};
> > """ % locals()
> >
> > #I am not having success with:
> > mesh = fp.Gmsh2D(geo,coordDimensions=1) #TODO throwing error about there
> being no cells; is it a problem that mesh is 1D and Gmsh2D is called 2D?
> > mesh = fp.Gmsh2D(geo) #TODO throwing error about there being no cells
> >
> > #then I went into gmsh GUI and saved to .msh, but still no luck:
> > mesh = fp.Gmsh2D('OneDimensionalSampleAndSubstrate.msh') #TODO throwing
> error about there being no cells
> > mesh =
> fp.Gmsh2D('OneDimensionalSampleAndSubstrate.msh',coordDimensions=1) #TODO
> throwing error about there being no cells
> > SCRIPT ENDS
> >
> >
> > If coordDimensions=1 is unsupported or meaningless, it would be great if
> FiPy printed a message saying so.
> >
> > I believe my FiPy installation is OK and was downloaded from github
> 6/30/2018 (fipy-develop). I can run circle.py, although I have never gotten
> it to plot the mesh. I can run anisotropy.py from diffusivity examples.
> Nearly all fipy tests pass (setup.py).  Can you please check if Gmsh2D is
> capable of reading a 1D gmsh mesh? Or is there another FiPy class which can
> do it, and how?
> >
> > gmsh –version returns 3.0.6.  Installation is system-wide via download
> method in Ubuntu 16.04.
> >
> > If I cannot read in a parameterized 1D gmsh mesh using FiPy
> functionality, I am at a loss as to how to have a single Python script that
> allows me to set cellSize, L_Sample, and L_Substrate, produce a mesh, and
> efficiently conduct a parameter study with FiPy. Gmsh is desirable because
> I want to go to a more complicated nonuniform/graded mesh, and would rather
> not write code to make a mesh myself.
> >
> > Thanks.
> >
> >
> > _______________________________________________
> > fipy mailing list
> > fipy@nist.gov
> > http://www.ctcms.nist.gov/fipy
> >  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to