pyfsi / coconut

Coupling Code for Numerical Tools. The documentation can be found at
https://pyfsi.github.io/coconut/
GNU General Public License v3.0
30 stars 4 forks source link

CoCoNut coupling with OpenFoam 11 (solver_modules section) #256

Closed Imanmirafzal closed 1 week ago

Imanmirafzal commented 3 weeks ago

Hello community,

I was wondering if anyone could assist me in modifying Solver_modules.py file. I keep getting this error which I am attaching and I think because Python can't recognize my machine name to call the command when I run setup_case.py command and open OpenFoam 11 can not be called by Python.

1) Should I change anything in the name of my Machine in the file solver_modules.py?

2) should I make any changes in the directory of my openfoam11 to simplify it for CoCoNut to open it? if yes, which file or dictionary should I revise? What should I add to the file?

The documentation just mentioned that "In case your system differs from the ugent_cluster_CO7 settings, it is advised to add your own internal dictionary to solver_load_cmd_dict and provide this key to machine_name. If a solver module is not present on your system the key should be removed. If a solver module is always present, i.e. no module load command or similar action is needed, an empty string should be given as value. When CoCoNuT tries to use a solver module that is not present in the solver_load_cmd_dict or that has the wrong value, an error will be raised." when I open solver_modules.py file I got 'ugent_cluster_RHEL8' as the machine name (which apparently is the machine cluster name in Gent. should I import my machine name on the top line of this file and in the def get_solver_cmd part?

3) I mean How can I define my personalized dict for my machine? what contents should it have?

4) What parts of the Dict should I change to specifically in front of "Openfoam.v1 : 'ml OpenFOAM/11-foss-2023a && source $FOAM_BASH'

5) should I change anything in my bashrc file?

6) what about the structure solver? If I installed it, for example Keratos, what parts of this solver should I change?

I greatly appreciate any help from anyone.

It really matters to me.

Thanks . Best regards Screenshot_20241010-152540_Chrome

nicolasdlss commented 3 weeks ago

Hi Imanmirafzal

In the dictionary solver_load_cmd_dict you only need to include commands required before starting up OpenFOAM. The dictionary is intended for when you work with a system where you have to load software (for example with the Lmod system) or set certain paths. It's perfectly possible that that is not necessary for you. If you can work with OpenFOAM in your normal workflow (without doing anything except sourcing $FOAM_BASH), you can set it up like this:

machine_name = 'local_machine'
solver_load_cmd_dict = {
  'local_machine': {
    'openfoam.v11': 'source $FOAM_BASH'
  }
}