How can I add external C++ libraries to use in MOOSE? #28769
Unanswered
richmondodufisan
asked this question in
Q&A General
Replies: 1 comment 14 replies
-
Hello
If the library is already compiled on your machine, you'll want to add to several environment variables in the Makefile. We have automatic differentiation in moose using MetaPhyscL through libmesh. Every single object in MOOSE prefaced with AD already uses this. And all you need to do to use it is:
|
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Check these boxes if you have followed the posting rules.
Question
First I want to know generally how I would add an external library and add it to the Makefile so I can compile. Whether autodiff (what I'm asking about) or any other library in general. Also curious if there is a way to write a python script which is called, does the calculations I want, and returns the results to the C++ source file.
Second, I want to know how to add autodiff (https://github.com/autodiff/autodiff) and wondering if it necessary since MOOSE already has some kind of AD system that is supposed to do the same thing? I'm not sure. In my custom Material file I am currently calculating derivatives manually with finite differencing, for example:
And I am getting good results, but I am wondering if the convergence and accuracy is affected by this because it solves a bit slowly and my choice of epsilon is problem-dependent. I want to instead add autodiff (https://github.com/autodiff/autodiff) do something like (I used chatGPT for this sample but I want to do something similar):
How can I do this? I have already tried https://mooseframework.inl.gov/source/materials/DerivativeMaterialInterface.html and it didn't work to calculate derivatives of scalars wrt tensors
Beta Was this translation helpful? Give feedback.
All reactions