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

How to set the variable 'abaqus.v2024' in file “solver_modules.py”? #253

Closed QB-Lin closed 1 month ago

QB-Lin commented 1 month ago

I want to couple Abaqus v2024 and OpenFOAM-v11, how do I set the variable 'abaqus.v2024' in “solver_modules.py”. My operation system is Ubuntu 20.04.6 lts.

  1. I downloaded and place the coconut folder at: “/usr/local/1_software/3_pyfsi/coconut/”. I adjusted the variable “machine_name”, 'abaqus.v2024', and “openfoam.v11” in file “solver_modules.py”: “ machine_name = 'localhost' #'localhost'#'ugent_cluster_RHEL8' solver_load_cmd_dict = {

    lqb added

    'localhost': { 'abaqus.v2024': './usr/local/1_software/ABAQUS2024/commands/abaqus' '&& export LM_LICENSE_FILE="29X00@localhost"', 'openfoam.v11': 'source /usr/local/1_software/OpenFOAM-v11/OpenFOAM-11/etc/bashrc' #sh code to source openfoam-v11 bashrc---lqb-202409171900 } } ”

###############################################

  1. I ran the case in “coconut/examples/tube/openfoam3d_abaqus3d”. My input is: "python3 setup_case.py". The CFD folder was created correctly, but the CSM folder seems had a mistake. The terminal printed mistake info: “ Traceback (most recent call last): File "/usr/local/1_software/3_pyfsi/coconut/tools.py", line 387, in get_solver_env subprocess.check_call( File "/usr/local/1_software/Miniconda3/lib/python3.12/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command './usr/local/1_software/ABAQUS2024/commands/abaqus && export LM_LICENSE_FILE="29300@localhost" && python3 -c "from coconut import tools;tools.write_env()"' returned non-zero exit status 127.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/1_software/3_pyfsi/coconut/examples/tube/openfoam3d_abaqus3d/setup_case.py", line 25, in csm_env = tools.get_solver_env(csm_solver, csm_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/1_software/3_pyfsi/coconut/tools.py", line 391, in get_solver_env raise RuntimeError(f'Module load command for solver wrapper {solver_name} failed.') RuntimeError: Module load command for solver wrapper abaqus.v2024 failed. ”.

########################################################

  1. It seems that abaqus do not run correctly. How do I set the variable 'abaqus.v2024' in “solver_modules.py”. The location of Abaqus components is set as below: Main program: /usr/local/1_software/ABAQUS2024/product/ Commands: /usr/local/1_software/ABAQUS2024/commands/ Licenses: /usr/local/1_software/ABAQUS2024/license/ Temp: /usr/local/1_software/ABAQUS2024/temp/ Plugins: /usr/local/1_software/ABAQUS2024/plugins/
nicolasdlss commented 1 month ago

In solver_load_cmd_dict you only need to include commands required before starting up Abaqus/OpenFOAM. The executable itself is not needed. I suspect for you this will be:

machine_name = 'localhost'
solver_load_cmd_dict = {
  'localhost': {
    'abaqus.v2024': 'export LM_LICENSE_FILE="29X00@localhost"',
    'openfoam.v11': 'source $FOAM_BASH'
  }
}

All other problems seem to follow from the first one.

QB-Lin commented 1 month ago

Thank you very much. I solved it! Now I had another problem. I ran "python3 run_simulation.py" in the terminal, the system report that CSM_Time1Surface0Output.dat could not be generated the in Abaqus.

" /usr/local/1_software/3_pyfsi/coconut/coupling_components/solver_wrappers/abaqus/abaqus.py:587: UserWarning: SolverWrapperAbaqus2024 overwrites incrementation settings in 202409231120.inp, make sure this is intended warnings.warn(f'{self.class.name} overwrites incrementation settings in ' Traceback (most recent call last): File "/usr/local/1_software/Miniconda3/lib/python3.12/shutil.py", line 847, in move os.rename(src, real_dst) FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/1_software/3_pyfsi/1_phd_Case/202409182050-plate-validate/202409222000-cocoNut/2_ABAQUS/CSM_Time1Surface0Output.dat' -> '/usr/local/1_software/3_pyfsi/1_phd_Case/202409182050-plate-validate/202409222000-cocoNut/2_ABAQUS/CSM_Time0Surface0Nodes.dat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/1_software/3_pyfsi/1_phd_Case/202409182050-plate-validate/202409222000-cocoNut/run_simulation.py", line 12, in simulation.run() File "/usr/local/1_software/3_pyfsi/coconut/analysis.py", line 20, in run self.initialize() File "/usr/local/1_software/3_pyfsi/coconut/analysis.py", line 25, in initialize self.coupled_solver.initialize() File "/usr/local/1_software/3_pyfsi/coconut/coupling_components/coupled_solvers/iqni.py", line 22, in initialize super().initialize(print_components=False) File "/usr/local/1_software/3_pyfsi/coconut/coupling_components/coupled_solvers/coupled_solver.py", line 96, in initialize self.solver_wrappers[self.index_mapped].initialize(interface_input_from, interface_output_to) File "/usr/local/1_software/3_pyfsi/coconut/tools.py", line 216, in wrapper initialize(args) File "/usr/local/1_software/3_pyfsi/coconut/coupling_components/solver_wrappers/mapped.py", line 45, in initialize self.solver_wrapper.initialize() File "/usr/local/1_software/3_pyfsi/coconut/tools.py", line 216, in wrapper initialize(args) File "/usr/local/1_software/3_pyfsi/coconut/coupling_components/solver_wrappers/abaqus/abaqus.py", line 176, in initialize shutil.move(path_output, path_nodes) File "/usr/local/1_software/Miniconda3/lib/python3.12/shutil.py", line 867, in move copy_function(src, real_dst) File "/usr/local/1_software/Miniconda3/lib/python3.12/shutil.py", line 475, in copy2 copyfile(src, dst, follow_symlinks=follow_symlinks) File "/usr/local/1_software/Miniconda3/lib/python3.12/shutil.py", line 260, in copyfile with open(src, 'rb') as fsrc: ^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/1_software/3_pyfsi/1_phd_Case/202409182050-plate-validate/202409222000-cocoNut/2_ABAQUS/CSM_Time1Surface0Output.dat' "

Here is my case file

202409231130-plate.zip

nicolasdlss commented 1 month ago

Your issue looks like a user error, rather than a code issue (any behavior that does not meet reasonable expectations). Unfortunately we don't have the time nor capacity to provide extensive user support. I would recommend to have a close look to the documentation (especially the Abaqus documentation in your case) and/or the code itself.