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

How can I write the dictionary without key in snappyHexMeshDict? #293

Closed
zzkluck opened this issue Dec 3, 2024 · 5 comments · Fixed by #298
Closed

How can I write the dictionary without key in snappyHexMeshDict? #293

zzkluck opened this issue Dec 3, 2024 · 5 comments · Fixed by #298

Comments

@zzkluck
Copy link

zzkluck commented Dec 3, 2024

I am trying to generate a snappyHexMeshDict and encountering such an example. The whole snappyHexMeshDict I want is like:

.....
castellatedMeshControls
{
    ......
    features
    (
        {
            file        "cylinder.eMesh";
            levels       ((0.5 4));
        }
    );
    ......
}
......

That's a list of dictionary without keys. It seems that openfoam uses a very different syntax here than it does elsewhere. My intuition is that will work:

snappy_dict["castellatedMeshControls"] = {
    ......
    "features": [{
        "file": "cylinder.eMesh",
        "levels":  "((0.5 4))";
    }],
    ......
}

But this will output:

features 
(
    file "cylinder.eMesh"; 
    levels ((0.5 4));
);

I tried several other methods, but found it difficult. What I can do here?

@gerlero
Copy link
Owner

gerlero commented Dec 3, 2024

@zzkluck Thanks for the report. I hadn't considered this case, so indeed I don't think there's a way to read/write something like this now. I'll try to get a fix out as soon as possible.

@gerlero
Copy link
Owner

gerlero commented Dec 4, 2024

@zzkluck Thanks again. Version 0.8.0 is now out and should fix this. Feel free to reopen otherwise.

@gerlero
Copy link
Owner

gerlero commented Dec 4, 2024

Actually, 0.8.0 is not yet published on PyPI because the release workflow bumps into a setuptools bug (pypa/setuptools#4759). Sorry about that. I'll keep trying to publish it

@gerlero
Copy link
Owner

gerlero commented Dec 4, 2024

0.8.0 is now out

@zzkluck
Copy link
Author

zzkluck commented Dec 5, 2024

0.8.0 is now out

Thank you for such a quick update, now my code can work well!

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

Successfully merging a pull request may close this issue.

2 participants