We have moved the forum to https://forum.ngsolve.org. This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.
I am sorry I have to bring up this topic again, but everything worked flawlessly besides some minor issues I encountered with the stresses around the undeformed state. Here the stresses computed from NGSolve are somewhat different compared to the results I obtain by using the same Matrizes using the origninal tensorflow network. However this is only the case around the undeformed state for larger deformations everything works fine again. I have attached an Image to illustrate the behaviour the blue and orange lines can be ignored they are some test data I use from other sources. Important are the red (NGSolve Simulation) and the green (Tensorflow Prediciton) data. I made sure this is no issue on the meshing by refining the mesh in size, order and a combination thereof. All result in the same data. Then I tried refining the steps I use to plot the data to see wether the linearization might result in some issues, but this also resulted in no changes. Lastly I wanted to see whether the Energy Density computed is the issue or whether the differentiation of said Energy Density.
Now I tried to evaluate the Energy Density function I am using to solve the Problem by generating a CoefficientFunction and evaluating it on the net, just I have done it with the stresses. However, this results in the error
Code:
File "<string>", line 91, in <module>
netgen.libngpy._meshing.NgException: MultMatMatCF:: scalar evaluate for matrix called
This error is not reproducable with the NeoHookean example in the WTA section of the Documentation, so I believe it to be an issue with the Matrix-Multiplication I am using, I sadly didn't find any further details on how the error is happening, but I attached a file wich reproduces the error.
I am using
Code:
NGSolve-6.2.2008-78-ga51abb5db
in order to enable differentiation of vector-valued functions as mentioned above.
Thank you again for all your help, should you need anything more from me, just let me know!
thanks a lot for the quick answer.
I am left with just one minor question: If I need to distinguish between scalars and 1x1 matrices the "cleaner" way to return the energy desinty would be to write
Code:
return W[0,0]
instead of
Code:
return W
in line 37 of my example file?
Regarding the differences between the NGSolve simulation and my Tensorflow model I am still investigating where exactly the error is sourced. The Problem I encountered while doing this was the problem with the evaluation of 1x1 matrizes. I was able to compare the energy density of both approaches now and recognized, that the tensorflow model does not result in an energy density of 0 at an undeformed state, which is most likely the reason behind this inconsistencies between the two approaches. I am sorry if I made the impression there would be something wrong with NGSolve in this case. I just wanted to give some background on how I encountered the error.
Thank you again!
Stay healthy and best regards,
Til