Comments (4)
How about a polygon?
from dmsh.
Closing for lack of feedback. Feel free to reopen at any time.
from dmsh.
Just wanted to note that you can do this for any contour, first by making an arbitrary function that outputs an array of [x,y] coordinates associated with the edges.
for a quarter ellipse...
import numpy as np
#This is in polar coordinates to generate equi-theta spaced points. Can do it in elliptical or whatever.
def EllipsePol(a,b,Points):
theta=np.linspace(0,np.pi/2,Points)
r = a*b/np.sqrt((b**2 -a**2)*np.cos(theta)**2 + a**2)
theta=np.append(theta,0)
r=np.append(r,0)
return np.array([r,theta])
#Converts to Cartesian
def PolToCart(r,theta):
x=r*np.cos(theta)
y=r*np.sin(theta)
return np.array([x,y])
#Define A and B and resolution (How polygon-esque it is)
A=2
B=5
res=5
Points=PolToCart(EllipsePol(A,B,res)[0],EllipsePol(A,B,res)[1])
geo = dmsh.Polygon(Points.T)
X, cells = dmsh.generate(geo,.3)
dmsh.helpers.show(X, cells, geo)
yields
The weird elements are due to the spacing of the poly-points. See with equi-X spacing:
from dmsh.
The weird boundary on ellipse meshes are a known bug, see #44.
from dmsh.
Related Issues (20)
- It would be super useful if you could specify the number of nodes you wanted in your mesh HOT 1
- update expected test results for meshplex 0.15.4 HOT 2
- Boundary Node Identification HOT 6
- Upgrade results in error
- coordinates and elements array in poisson problem HOT 1
- How to order boundary points/edges HOT 10
- Duplicate points HOT 7
- create_edges can no longer be found from MeshTri HOT 1
- bending?
- MeshTri troubles
- Mesh 2 surfaces in different planes HOT 1
- potentially better force function HOT 7
- use median for scaling factor?
- can't import dmsh HOT 2
- Further documentation please HOT 1
- Anaconda - dmsh installation problem HOT 2
- missing attribute 'node_coords' HOT 6
- Problems with install HOT 1
- Issue with custom geometries and max boundary steps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dmsh.