How to add MECA into Salome-9.12 Windows-10 Installation?

Hello,
I am a new user to Salome. Just installed Salome v9.12 from the Salom-Project > Resources > Download page.

My Salome Installation does not have the Code-Aster Environment/Module installed in it. It only has Shaper, Geometry, Mesh and other environments installed. In the documentation, it says use add module button in the modules toolbar. But I don’t even have the add module button in my toolbar.

I am ABSOLUTELY NEW to Salome. My aim is to first familiarise myself with Salome and it’s environments and later get proficient with Salome-Meca (Code Aster) soon.

My question is How to add the MECA part into Salome?

There is another similar question ( How to Install Meca,CFD, Hydro, TRUST on windows? ), but hasn’t had any replies for over 1.5 years.

New User Restrictions lifted, More Details:
I installed Salome 9.12 from Salome-platform website, but it does not have code aster environment in it. I searched the documentation(Add/remove modules dynamically — GUI 9.12.0 documentation) and it said Click on ADD modules icon.
image

But my Salome installation does not have the ADD MODULE button at all.

How do I install MECA in my salome installation?
Do I download Code Aster from Download - Code_Aster and somehow add it to my Salome Installation?
(or)
Do I HAVE to download Salome Meca directly from Salome-Meca - Code_Aster?
If I download code aster from the first link, how do I add it to my Salome installation?
If I download Salome Meca directly, how do I know which version of Salome I am getting in it? I would like to have the latest version of Salome.

I would call my answer half an answer as I am not an expert in the subject but at least it could throw you some light.
from what I know (and I am not an user of salome-meca) salome meca is the complete suite, with salome +code-aster. if you dont want to make your life hard I would download salome-meca directly, and wait for the next release to get it with salome 9.12 under the hood. it should have right now 9.11 (if I am correctly, you could check this in the release notes of salome-meca) and there wasnt too much changes between the two versions. I imagine that you could compile a salome9.12-meca but not sure where to point for you.

Thank you Franco. But I would really like to know how to add Aster and Saturne and others into my installation of Salome, so that I can if needed at a later date add saturne and Trust into my installation.
If someone answers it, This post would also help other newbies like myself the next time someone has the same problem.

You have to install the Salome Meca and the Sovler.The latest meca version is 9.10
go to (Salome Meca root dir)/W64 and copy ASTERSTUDY dir into (Salome root dir)/W64.
Add several codes in (Salome root dir)/salome (it’s a python file without a suffix )
You can find those in (Salome Meca root dir)/salome and copy to (Salome root dir)/salome in same position.
register ASTERSTUDY

 context.setVariable(r"SALOME_MODULES", r"SHAPER,SHAPERSTUDY,ASTERSTUDY,GEOM,SMESH,PARAVIS,YACS,JOBMANAGER", overwrite=True)

tell salome where to find ASTERSTUDY and the solver

    #[ASTERSTUDY]
    context.setVariable(r"ASTERSTUDY_ROOT_DIR", out_dir_Path + r"\W64\ASTERSTUDY", overwrite=True)
    context.addToPythonPath(r"%ASTERSTUDY_ROOT_DIR%\%PYTHON_LIBDIR%")
    context.addToPythonPath(r"%ASTERSTUDY_ROOT_DIR%\%PYTHON_LIBDIR%\salome")
    appendPath(r"SalomeAppConfig", out_dir_Path + r"\W64\ASTERSTUDY\share\salome\resources\asterstudy",separator=";")

    #[CODEASTER]

    import winreg
    try:
        with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"SOFTWARE\code_aster\v2023") as key:
            aster_root_dir = winreg.EnumValue(key, 0)[1]
    except:
        aster_root_dir = None
    if aster_root_dir is None and os.path.exists(out_dir_Path + r"\W64\code_aster"):
        # use embeded code_aster
        aster_root_dir = out_dir_Path + r"\W64\code_aster\v2023"
        if not os.path.exists(aster_root_dir + r"\16.5\lib\aster\aster.pyd"):
            # execute post-installation for embeded code_aster
            subprocess.run(aster_root_dir + r"\16.5\update_pyd_links.bat")
    if aster_root_dir:
        context.setVariable(r"ASTER_ROOT_DIR", aster_root_dir, overwrite=True)
        #context.setVariable(r"ASTER_OLDSTABLE", r"%ASTER_ROOT_DIR%\15.9", overwrite=True)
        context.setVariable(r"ASTER_STABLE", r"%ASTER_ROOT_DIR%\16.5", overwrite=True)
        context.addToPath(r"%ASTER_ROOT_DIR%\bin")
        context.addToPythonPath(r"%ASTER_ROOT_DIR%\lib\python3.7\site-packages")
    else:
        print("ERROR : Code_Aster installation not found on this machine. ASTERSTUDY module will not found any Code_Aster version")
        print("        You may download and install 'code_aster 2023 msi' package available at code-aster-windows.com/download")

a Salome MECA custom method

# salomeContext only prepend variables, we use our own appendPath when required
def appendPath(name, value, separator=os.pathsep):
    if value == '':
      return

    value = os.path.expandvars(value) # expand environment variables
    env = os.getenv(name, None)
    if env is None:
      os.environ[name] = value
    else:
      os.environ[name] = env + separator + value

do the same like previous and save. Go to Salome root dir and run run_salome.bat

1 Like

Dear Colleagues,
how to integrate AsterStudy from singularity file (salome_meca-lgpl-2023.1.0-4-20240327) with Salome 9.13 platform.
Any suggestions?
Many thanks in advance.
Regards,
mjb