Comments (5)
Hi @ddkn,.
This visualization looks strange to me, although I don't use paraview. Also, I am not sure about the sleep thing. Can you put a short program which demonstrates your problem so that I can take a close look? Thank you.
from pymfem.
This now seems to be a problem with my original StrainVectorCoefficient
which is leading me to think something is wrong with the mesh creating nodes that are invalid? I have no idea how to troubleshoot this.
I generate meshes on gmsh
, Here is my script:
output.geo.txt
I have a python script that changes a few lines to change where the boundary is, which seems to work fine and renders in GLVis
.
from pymfem.
Hm, I am noticing I need to add a import time; time.sleep(3)
for this to work... now for just my StrainVectorCoefficient
code. Is there a way to enforce a calculation is done before continuing.
Error
...
Iteration : 135 (B r, r) = 0.000272998
Iteration : 136 (B r, r) = 0.000214033
Iteration : 137 (B r, r) = 0.000154586
Iteration : 138 (B r, r) = 0.000109668
Iteration : 139 (B r, r) = 7.95231e-05
Average reduction factor = 0.935443
Setting Nodal FE Space
Assigning reference nodes
data
Strain
[5.851080012110099e-06, -3.056506058355944e-06, -4.061944796849572e-06, 1.0322523091085359e-05]
corrupted double-linked list
Aborted
$
But I also get intermittent errors such as,
Iteration : 136 (B r, r) = 0.000214033
Iteration : 137 (B r, r) = 0.000154586
Iteration : 138 (B r, r) = 0.000109668
Iteration : 139 (B r, r) = 7.95231e-05
Average reduction factor = 0.935443
Setting Nodal FE Space
Assigning reference nodes
munmap_chunk(): invalid pointer
Aborted
Strain
class StrainVectorCoefficient(mfem.VectorPyCoefficient):
def __init__(
self,
dim: int):
super(StrainVectorCoefficient, self).__init__(dim)
self.dim = dim
self.u = None # displacement GridFunction
self.grad = mfem.DenseMatrix()
def SetDisplacement(self, u: mfem.GridFunction):
self.u = u
def Eval(
self, v: mfem.Vector,
T: mfem.ElementTransformation,
ip: mfem.IntegrationPoint) -> None:
self.u.GetVectorGradient(T, self.grad)
self.grad.Symmetrize()
size = self.grad.Size()
# Set the principle strains xx, yy, zz, xy, xz, yz
if size == 2:
v[0] = self.grad[0, 0]
v[1] = self.grad[1, 1]
v[2] = self.grad[0, 1]
elif size == 3:
v[0] = self.grad[0, 0]
v[1] = self.grad[1, 1]
v[2] = self.grad[2, 2]
v[3] = self.grad[0, 1]
v[4] = self.grad[0, 2]
v[5] = self.grad[1, 2]
return v
def get_xyz(c, mesh, gf):
_, elem_ids, ips = mesh.FindPoints([c])
c = [gf.GetValue(elem_ids[0], ips[0], i) for i in range(4)]
return c
dim = 3
strain_coef = StrainVectorCoefficient(dim)
strain_coef.SetDisplacement(x)
vector_space = mfem.FiniteElementSpace(mesh, fec, dim)
strain = mfem.GridFunction(vector_space)
strain.ProjectCoefficient(strain_coef)
print("data")
# WARN: if sleep is lower than 3 it crashes prematurely
sleep(5)
print("Strain", get_xyz((10, 0, 5), mesh, strain))
# NOTE: Complains about destructors missing
del strain
del strain_coef
The original issue is still present with StressVectorCoefficient
. I can work with strain, but I am getting very intermittent errors on even if I can calculate the strain. So it isn't reliable.
from pymfem.
Hm, Opening in Paraview and moving shows some tetragonal elements missing as I rotate the solution... is it possible that mfem
is dropping elements and unable to calculate the mesh?
A more basic version of the mesh, as two simple cylinders.
If I stop moving it, it smooths it out which makes me think interpolation is happening to fill in the missing regions?
So rebuilding the geo file to ensure it is coherent has got me back to calculating strain, via VectorPyCoefficient
but it works only sometimes. I am back to the issue with StressVectorCoefficient
generating the error:
free(): invalid next size (fast)
from pymfem.
Hi @sshiraiwa, sorry for getting back late, grad school has been a bit chaotic. Here is an example with a script, and GMSH geofile and msh, example.zip. The StressVectorCoefficient
still continues to segfault,
One issue I discovered, is if I try to measure a spot that does not exist, the system crashes. I would likely need to implement some interpolation. The strain vector should work now. I did notice that small changes in the mesh generation can wildly change the element number.
As of now I would say being able to render via glvis -m test.mesh -g stress.gf
would be considered a wild success, haha.
Thanks again for taking your time to help me out!
from pymfem.
Related Issues (20)
- Power9 installation Failure HOT 6
- Up-to-date installation for parallel version? HOT 7
- Discrepancy in error calculation for identical meshes and solutions
- Module conflict with c++ mfem in `pyMFEM==4.5.2.1` HOT 2
- `FindPointsGSLIB::GetCode()` does not return `mfem::Array<unsigned int>` HOT 1
- Installation failure with `--with-parallel` and `--with-gslib` on v.4.5.2.1 HOT 4
- How to implement LinearFormIntegrator HOT 1
- MFEM4.6 support HOT 1
- vtk output for solutions HOT 14
- First element read by GF is 0 not the value in the file HOT 4
- can't build with external mfem HOT 13
- GridFunction, ProjectCoefficient and GetValue HOT 5
- build with external mfem still broken HOT 4
- build with external openblas HOT 3
- Modify an existing mfem.Mesh HOT 2
- Install fails on MacOS: `chrpath` not found HOT 5
- h derefinement fails after p adaption HOT 2
- Performance issues w/ mesh attribute retrieval HOT 3
- PyMFEM 4.7 HOT 4
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 pymfem.