Open loveinthebone opened 4 years ago
Thanks, Kingson, for reporting this issue, and for including your test code. Oleg updated the Radia Python wrappers, and it appears we have not synced the underlying Radia Engine on our Jupyter server. We'll look into this and get back to you.
In the meantime, I just tried running your Python code and several errors arose. For example,
from future import absolute_import, division, print_function
should read
from __future__ import absolute_import, division, print_function
and
slicePgn.append([_rcos(phi), _r*sin(phi)])
should read
slicePgn.append([_r*cos(phi), _r*sin(phi)])
Also, the indentation of your Python code was mangled. It would be great if you could edit the above to make it easier us to help you.
Thanks again for reporting this issue, Dan
Hi Dan,
Thank you for your fast reply. Sorry, I don't know how to easily paste code in the Github comment, but I uploaded the code (a clearer version) to here: https://github.com/loveinthebone/Radia-Examples/blob/master/test_Magnet_VS_Coil.ipynb You can access and test it.
Thank you, Kingson
Thanks, Kingson. I edited your original comment.
The comments here are parsed by Markdown. This means that to post a block of code, you simply put it between “fences”, which are denoted by a triplet of backticks: ```
. Thus
```python
def pick(l, c):
return [e for idx, e in enumerate(l) if c[idx]]
```
yields
def pick(l, c):
return [e for idx, e in enumerate(l) if c[idx]]
This will prevent Markdown from converting, for example, your code __future__
into
the bold "future".
For more information, see the GitHub Markdown page or the useful Markdown Cheatsheet.
Thank you for the mentoring, Dan.
@dtabell Hi Dan, any progress on solving the issue? From my side, the error is still there when I use the rad.FldEnrTrq function.
Hello Kingson, I have confirmed that I get the same error as you when running Radia on the RadiaSoft Jupyter server. Our version of Radia there comes from O. Chubar's repository. We are in the process of rebuilding it, to take advantage of the recent parallel processing abilities. It may be that when we compile and install the most recent version, this problem will be resolved. In the meantime, I have emailed Oleg requesting assistance.
Hi, radia_FldEnrTrq is in radpy.cpp, but there is a bug in it. Here is a fix (I'll include it to next update), in line ~#2612 (https://github.com/ochubar/Radia/blob/master/cpp/src/clients/python/radpy.cpp#L2612):
if((indDst <= 0) || (indSrc <= 0) || (oCmpnId == 0) || (oP == 0)) throw CombErStr(strEr_BadFuncArg, ": FldEnrTrq"); //OC14042020 //if((indDst <= 0) || (indSrc <= 0) || (oCmpnId == 0) || (oP)) throw CombErStr(strEr_BadFuncArg, ": FldEnrTrq");
Thanks for the reply and explanation, @ochubar!
Great!. Thank you, Oleg! @bnash Could you send me a message when this bug is fixed in the Jupyter server?
I will make a good effort to do so, Kingson. We may want to consider some sort of mailing list for updates so that Radia users can keep up to date on the developments in the code and interfaces and share experience.
Hi All,
First of all, thank you for offering the Jupyter version of Radia for free. I am trying to use it to simulate the force and torque applied by a electromagnet to a permanent magnet. Now I can already get the force component, but find that when I try to use
radia.FldEnrTrq
function for calculating the torque, it always reports an error:While if I run
I can get a proper explanation of this function.
I checked the file
radiasoft/Radia/cpp/src/clients/python/radpy.cpp
, didn't find functionFldEnrTrq
. However, I did find it in this repository:https://github.com/ochubar/Radia/blob/master/cpp/src/clients/python/radpy.cpp
.Could you help me to solve this problem? For your reference, here is the code I used to test in the Jupyter server:
Thanks, Kingson