Comments (3)
Wow thanks so much!
from py-tdgl.
Hi Owen,
I've opened a Pull Request (#20) which optimizes the process of creating the necessary data structures after mesh generation. I've also added a progress bar to the parts of the process that take the longest.
With the new code, I get the results below. I am using max_edge_length = xi
because max_edge_length = xi/2
results in a mesh with over a million sites. Even with max_edge_length = xi
, the mean edge length is roughly xi / 2
, which is probably good enough.
The other thing to watch out for when making really large meshes is the number of points in the underlying tdgl.Polygon
. You may have to play around with the number of points in the Polygon
using tdgl.Polygon.resample()
and tdgl.Polygon.buffer()
to get rid of the Malformed Voronoi cell surrounding boundary site
warnings.
The other error I am seeing in your logs is RuntimeWarning: divide by zero encountered in double_scalars ... current_density = (-1 / term.length) ...
. This means that one of the tdgl.Polygon
instances you are using to define a transport terminal doesn't actually contain any boundary mesh sites.
I will merge this PR and push the changes to PyPI later today or tomorrow. In the meantime, if you'd like you can check out the branch that has the changes: https://github.com/loganbvh/py-tdgl/tree/big-mesh
Let me know if you have any other questions!
import logging
logging.basicConfig(level=logging.INFO)
import tdgl
from tdgl.geometry import box
xi = 0.005
d = 0.01
london_lambda = 0.2
layer = tdgl.Layer(coherence_length=xi, london_lambda=london_lambda, thickness=d)
film = tdgl.Polygon("film", points=box(2, 1)).resample(5001).buffer(0)
device = tdgl.Device("bar", layer=layer, film=film, length_units="um")
device.make_mesh(max_edge_length=xi)
Output:
INFO:tdgl.device.device:Generating mesh...
INFO:tdgl.device.meshing:Iteration 1: 23153 points, 41291 triangles, max_edge_length: 2.2e-01 (target: 5.0e-03).
...
INFO:tdgl.device.meshing:Iteration 22: 298368 points, 591716 triangles, max_edge_length: 4.9e-03 (target: 5.0e-03).
Finding Voronoi indices: 100%|████████████████████████████████████████████| 1775148/1775148 [00:14<00:00, 122284.12it/s]
Constructing Voronoi polygons: 100%|█████████████████████████████████████████| 298368/298368 [00:17<00:00, 16874.98it/s]
INFO:tdgl.device.device:Finished generating mesh with 298368 points and 591716 triangles.
INFO:tdgl.device.device:Total mesh generation time: 79.232 seconds
device.mesh_stats_dict()
:
{'num_sites': 298368,
'num_elements': 591716,
'min_edge_length': 0.0009765625,
'max_edge_length': 0.00494772146487779,
'mean_edge_length': 0.0028552928379728393,
'min_area': 2.900378605089071e-07,
'max_area': 1.2706923858807462e-05,
'mean_area': 6.7031299058204325e-06,
'coherence_length': 0.005,
'length_units': 'um'}
from py-tdgl.
With some further optimization, the total mesh generation time for this model is about 40 seconds. About half of this time is spent converting MeshPy C++ arrays to numpy arrays - not much I can do about that. The other half of the time is mostly taken up by finding the areas of the Voronoi cells and the lengths of the Voronoi edges. This can probably be sped up further, but I don't see any more obvious low-hanging fruit right now.
INFO:tdgl.device.device:Generating mesh...
INFO:tdgl.device.meshing:Iteration 1: 23153 points, 41291 triangles, max_edge_length: 2.2e-01 (target: 5.0e-03).
...
INFO:tdgl.device.meshing:Iteration 22: 298368 points, 591716 triangles, max_edge_length: 4.9e-03 (target: 5.0e-03).
INFO:tdgl.device.device:Creating Mesh object from triangulation.
Constructing Voronoi polygons: 100%|█████████████████████████████████████████| 298368/298368 [00:11<00:00, 25605.58it/s]
INFO:tdgl.device.device:Finished generating mesh with 298368 points and 591716 triangles.
INFO:tdgl.device.device:Total mesh generation time: 41.446 seconds
Merging #20 into main
from py-tdgl.
Related Issues (20)
- ParaView Visualization HOT 2
- Resources for Simulation Parameters of YBCO HOT 31
- make_mesh for Large Geometries HOT 10
- Modify Axis Limits in Visualize HOT 9
- Using Adaptive Library to Simulate a Range of Field Oscillations HOT 1
- Time dependent disorder_epsilon HOT 4
- Post Simulation Probe Points HOT 2
- Real-time monitor hangs for large geometries HOT 9
- High Fluxoid Error with No Screening HOT 6
- tdgl.visualize --output not recognized HOT 2
- Pixel Current Artefact HOT 8
- errors during tdgl testing HOT 40
- Field cooling in TDGL? HOT 1
- TypeError with Pardiso solver HOT 5
- Device with different layers/materials HOT 2
- Does not work with pint version 0.24 HOT 3
- Append new solution to seed solution HOT 1
- Add vector potential from magnetization distribution
- Traceback on quickstart.ipynb HOT 7
- Replicating SQUID loop result in paper HOT 3
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 py-tdgl.