Thanks to visit codestin.com
Credit goes to github.com

Skip to content

template file not in project root directory #115

@nplinden

Description

@nplinden

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions