Mesh generation with specific mesh size
I try to generate a mesh with a specific mesh size using the new CSG features.
I followed the indication given on the doc page
but I get the following error:
TypeError: __init__() got an unexpected keyword argument 'meshsize'
Below the code to reproduce the issue
## BEGIN ###
from dolfin import *
geom=Rectangle(
mesh = Mesh(geometry, meshsize="fine")
## END ###
If I use a integer as a parameter (as one should do looking at Mesh.ccp), Mesh accepts it, but it seems to do not affect the mesh resolution. For example
mesh = Mesh(geometry, 10)
gives the same result as
mesh = Mesh(geometry, 1)
How the integer parameter is expected to control the resolution?
Is there a way to generate a unstructured mesh with given mesh size within dolfin?
I use the development version of FEniCS
P.S.: I currently use an external mesh generator, but the feature may be useful for test problems
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- corrado maurini
- Solved:
- 2013-01-31
- Last query:
- 2013-01-31
- Last reply:
- 2013-01-30
Anders Logg (logg) said : | #1 |
On Wed, Jan 30, 2013 at 10:25:54AM -0000, corrado maurini wrote:
> New question #220533 on DOLFIN:
> https:/
>
> I try to generate a mesh with a specific mesh size using the new CSG features.
>
> I followed the indication given on the doc page
>
> http://
>
> but I get the following error:
>
> TypeError: __init__() got an unexpected keyword argument 'meshsize'
>
> Below the code to reproduce the issue
>
> ## BEGIN ###
> from dolfin import *
> geom=Rectangle(
> mesh = Mesh(geometry, meshsize="fine")
> ## END ###
>
> If I use a integer as a parameter (as one should do looking at Mesh.ccp), Mesh accepts it, but it seems to do not affect the mesh resolution. For example
>
> mesh = Mesh(geometry, 10)
>
> gives the same result as
>
> mesh = Mesh(geometry, 1)
>
> How the integer parameter is expected to control the resolution?
>
> Is there a way to generate a unstructured mesh with given mesh size within dolfin?
>
> I use the development version of FEniCS
>
> P.S.: I currently use an external mesh generator, but the feature may be useful for test problems
Last I heard the resolution option was not implemented in 2D, only 3D.
Perhaps Benjamin or Johannes could give an updated on this?
--
Anders
Johannes Ring (johannr) said : | #2 |
Yes, the int parameter is not implemented in 2D and the keyword argument 'meshsize' does not work in either 2D or 3D.
Thanks for the information!
Johannes Ring (johannr) said : | #4 |
Note that you can use the 'cell_size' parameter in CSGCGALMeshGene
from dolfin import *
geom = Rectangle(0,0,1,2)
mesh = Mesh(geom, 1)
gen = CSGCGALMeshGene
gen.parameters[
gen.generate(mesh)
very nice, it works, thanks!
11:41, Johannes Ring a écrit :
> from dolfin import *
> geom = Rectangle(0,0,1,2)
> mesh = Mesh(geom, 1)
> gen = CSGCGALMeshGene
> gen.parameters[
> gen.generate(mesh)