Jesusbill / code-aster-examples

A number of examples for Code_Aster and Salome_Meca
Other
74 stars 36 forks source link

Running code_aster the pythonic way #2

Open Jesusbill opened 2 years ago

Jesusbill commented 2 years ago

@philbucher: Thanks for sharing the first input file with code_aster commands the pythonic way!

Can you share please how do you manage to setup the environment variables to import code_aster in python? Do you use the singularity container or if not what? I have tried in the past but did not have success.

Thanks in advance!

Ping @andefined who would be interested in this as well

philbucher commented 2 years ago

Hi, I used the singularity container, but I am in the process of compiling & setting up 15.4 myself I posed the steps already in the forum, it was quite simply for me with the container:

  1. ./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell (log into the container)
  2. source /opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/share/aster/profile.sh (source the environment)
  3. run any python-script, e.g. python3 runCA.py

Unfortunately I have not yet found any documentation for the python interface, only some snippets here and there

I would be glad if you could also share if you find documentation of other hints where to find out about the python interface :)

Jesusbill commented 2 years ago

Thanks a lot! I had tried in the past like this but I was missing to call python3 !! This is great! I will start looking into it and will post here any useful information or outcomes.

andefined commented 2 years ago

Hi @philbucher this is absolutely wonderful!!

philbucher commented 1 year ago

Hey, have you guys made any advances with the pythonic version? I would like to look into it in more detail soon. Maybe you have discovered some more documentation in the meantime?

Krande commented 9 months ago

Hey guys!

I have also started looking for information regarding the new pythonic code_aster module. I've found some examples in the astest directory, but there are still a lot of functions I seem unable to find the pythonic equivalent of. I've also tried browsing the Code Aster user forums, but I haven't found much related to the pythonic api there neither.

Have any of you found any other good resources? We could perhaps combine our efforts and make PR's to the official docs (here is the gitlab source)

And while making the PR's we can ask EDF our questions we might have regarding the pythonic api?

I could also mention that I'm packaging Code_Aster >=16.4.2 into a conda package for linux (see https://gitlab.com/codeaster/src/-/issues/1). In the conda-packaging I am adding type stubs using pybind11-stubgen that also includes types for the runtime-generated "injected" python methods. I have found that helps a bit to browse the different objects and methods using your IDE and get (almost) proper signatures and doc stubs. My plan is to update the code-aster package on conda-forge. But I'm currently waiting for my PR to be approved for the mgis dependency.

philbucher commented 9 months ago

Hi @Krande, I have not continued with the pythonic interface, since we are still stuck with v14.6 (but working on updating to 15 or 16 atm)

I got the information about the python interface from a presentation which showed a basic example. Other than that I read the source code :sweat_smile: . I have plenty of experience with pybind thus it was not very difficult for me

I guess EDF will work on adding py-interface documentation after they fully support it. I doubt I will be able to spend time on this in the near future, my apologies :/

BTW I am following your work on the conda package, massive kudos!

Krande commented 9 months ago

Hey @philbucher! No apology needed :) Thanks for the kudos!

Nice tip regarding following the pybind11 bindings. I think I might do just that!

Btw: I see that you are involved in developing kratos?

It looks really interesting! By briefly looking through parts of the docs I get the sense that it might be focusing more towards multiphysics rather than basic solid mechanics applicable for structural engineering. But I might be wrong.

Are you primarily using Code_Aster to compare results with kratos or do you use it for scenarios not suitable for kratos?

philbucher commented 9 months ago

Yes I did a lot of developments in Kratos during my PhD. My main work was in large scale multiphysics simulations. And yes, Kratos focusses much more on different simulations techniques (including multiphysics), not only structural.

Code aster is much much more powerful in this structural simulations

I now work at SimScale, where we use Code_Aster as structural solver :)