Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically set the exchange-directory #20

Open
MakisH opened this issue Mar 27, 2020 · 5 comments
Open

Automatically set the exchange-directory #20

MakisH opened this issue Mar 27, 2020 · 5 comments

Comments

@MakisH
Copy link
Member

MakisH commented Mar 27, 2020

For some reason that we currently don't understand, the exchange-dir is not set correctly to the same values in the respective OpenFOAM-Code_Aster tutorial, requiring us to do something like:

<!-- TODO: Give an absolute path for the exchange-directory, as Code_Aster starts in /tmp/ -->
- <m2n:sockets from="Fluid" to="Solid" exchange-directory="/path/to/tutorials/CHT/flow-over-plate/buoyantSimpleFoam-aster"/>
+ <m2n:sockets from="Fluid" to="Solid" exchange-directory="/home/tester/tutorials/CHT/flow-over-plate/buoyantSimpleFoam-aster"/>

(both . and .. don't work).

I will have a look on this issue.

@MakisH MakisH added the bug label Mar 27, 2020
@MakisH MakisH self-assigned this Mar 27, 2020
@MakisH MakisH changed the title Automatically set the exchange-dir Automatically set the exchange-directory Mar 27, 2020
@MakisH
Copy link
Member Author

MakisH commented Mar 27, 2020

It looks like Code_Aster uses a subdirectory of /tmp/ as a working directory.

In solid.export, I see the following:

P proxy_dir /tmp
P rep_trav /tmp/tester-tester-VirtualBox-interactif_6834

@micheltakken any idea how to change this? (i.e. without modifying this file, but maybe through ASTK)

@MakisH
Copy link
Member Author

MakisH commented Mar 27, 2020

I cannot find any way to set a different rep_trav without changing this file, but if I set it to the working directory, it looks like it is working in the beginning, but at the end of the simulation, it deletes the complete directory. Therefore, let's not do this.

P rep_trav /home/tester/tutorials-CA_OpenFOAM/CHT/flow-over-plate/buoyantSimpleFoam-aster

The effort for fixing this seems to overcome the benefit at the moment.

@micheltakken
Copy link
Contributor

I cannot find any way to set a different rep_trav without changing this file, but if I set it to the working directory, it looks like it is working in the beginning, but at the end of the simulation, it deletes the complete directory. Therefore, let's not do this.

P rep_trav /home/tester/tutorials-CA_OpenFOAM/CHT/flow-over-plate/buoyantSimpleFoam-aster

The effort for fixing this seems to overcome the benefit at the moment.

I came across this solution on the Code_Aster forum. It might be worth it to try setting rep_trav in both the export file, and in ~/etc/codeaster/asrun (For me, however, changing rep_trav in the export file, crashes the Solid solver in the very beginning).
On the post redirects to a file ~/.astkrc/config, which doesn't exist on my Code_Aster installation, so it even seems to be an outdated solution.
In the end I agree that it's better to just set an absolute path in the preCICE config file, as the means defy the goal to use less absolute paths at this point.

@micheltakken micheltakken reopened this Mar 30, 2020
@MakisH
Copy link
Member Author

MakisH commented Mar 30, 2020

Then I have another (a little bit crazy) idea.

Facts:

  • The adapter finds precice-config.xml, which is located in the same directory as precice-run/
  • We only need the adapter to know where precice-run/ is, we don't want to affect what Code_Aster does.

Idea:
We could ask the adapter to create a symbolic link from e.g. /tmp/my-simulation/precice-run/ to /path/to/precice-config/precice-run/.

We already know where precice-config.xml is (e.g. /path/to/config), so we can use os.symlink to create a link, e.g. (check):

os.symlink("/path/to/config/"+"precice-run", "precice-run", True, *, None)

If we directly have the file path and we need the folder path, we can split it. Maybe we need to define a code_aster file unit somewhere.

Furthermore, we should give the user the option to still specify a custom exchange-directory, so we could have an option to set this on or off (in config.comm).

@micheltakken what do you think?

@MakisH
Copy link
Member Author

MakisH commented Mar 30, 2020

On the post redirects to a file ~/.astkrc/config, which doesn't exist on my Code_Aster installation, so it even seems to be an outdated solution.

It is common that such .[something]rc files don't exist by default, as they are optional files where the user can define some user-specific options. See, e.g. .bashrc, .gitconfig, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants