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

template file not in project root directory #115

Open
nplinden opened this issue Nov 13, 2024 · 0 comments
Open

template file not in project root directory #115

nplinden opened this issue Nov 13, 2024 · 0 comments

Comments

@nplinden
Copy link

Hello,
i've been trying to use the watts.PluginGeneric to run templated OpenFOAM calculations.
First I'm trying to run a simple meshing script, this requires the following directory structure:

.
|-- system
|   |-- blockMeshDict
|   `-- controlDict
`-- watts_script.py

Where blockMeshDict is templated and controlDict is not.
My watts script looks like this:

import watts

params = watts.Parameters(nx=20) # Number of mesh cells in the x direction

plugin = watts.PluginGeneric(
    "blockMesh",
    "{self.executable}",
    "system/blockMeshDict",
    extra_inputs=["system/controlDict"],
    show_stdout=True,
    show_stderr=True
    )
result = plugin(params)

This fails because the two files are copied at the root of the temporary directory, so the "system/*" structure is not preserved and OpenFOAM is lost.

Looking at the code it seems there is no obvious way of preserving the path structure, as all path are made absolute and are simply copied to the temp directory using shutil.copy

Is there any way of preserving the directory structure? If not, is there interest in adding this feature? I don't mind implementing this if this is interesting to you.

Cheers

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

No branches or pull requests

1 participant