foamlib 0.1.8__tar.gz → 0.1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: A Python interface for interacting with OpenFOAM
5
5
  Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
6
6
  Project-URL: Homepage, https://github.com/gerlero/foamlib
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.8"
1
+ __version__ = "0.1.10"
2
2
 
3
3
  from ._cases import FoamCase, AsyncFoamCase, FoamTimeDirectory, FoamCaseBase
4
4
  from ._dictionaries import (
@@ -23,7 +23,18 @@ except ModuleNotFoundError:
23
23
  else:
24
24
  numpy = True
25
25
 
26
- from pyparsing import Group, Keyword, Opt, ZeroOrMore, Literal, Forward, common
26
+ from pyparsing import (
27
+ Forward,
28
+ Group,
29
+ Keyword,
30
+ Literal,
31
+ Opt,
32
+ QuotedString,
33
+ Word,
34
+ common,
35
+ identchars,
36
+ identbodychars,
37
+ )
27
38
 
28
39
  FoamDimensionSet = namedtuple(
29
40
  "FoamDimensionSet",
@@ -66,6 +77,10 @@ A value that can be stored in an OpenFOAM dictionary.
66
77
 
67
78
  _YES = Keyword("yes").set_parse_action(lambda s, loc, tks: True)
68
79
  _NO = Keyword("no").set_parse_action(lambda s, loc, tks: False)
80
+ _WORDS = Word(identchars, identbodychars + "(),")[1, ...].set_parse_action(
81
+ lambda s, loc, tks: " ".join(tks)
82
+ )
83
+ _STRING = QuotedString('"', unquote_results=False)
69
84
  _VALUE = Forward()
70
85
  _LIST = Opt(
71
86
  Literal("List") + Literal("<") + common.identifier + Literal(">")
@@ -73,7 +88,7 @@ _LIST = Opt(
73
88
  (
74
89
  Opt(common.integer).suppress()
75
90
  + Literal("(").suppress()
76
- + Group(ZeroOrMore(_VALUE))
91
+ + Group(_VALUE[...])
77
92
  + Literal(")").suppress()
78
93
  )
79
94
  | (
@@ -98,7 +113,8 @@ _VALUE << (
98
113
  | common.number
99
114
  | _YES
100
115
  | _NO
101
- | common.identifier
116
+ | _WORDS
117
+ | _STRING
102
118
  )
103
119
 
104
120
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: A Python interface for interacting with OpenFOAM
5
5
  Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
6
6
  Project-URL: Homepage, https://github.com/gerlero/foamlib
@@ -16,6 +16,9 @@ def test_parse() -> None:
16
16
  assert _parse("1.0e-3") == 1.0e-3
17
17
  assert _parse("yes") is True
18
18
  assert _parse("no") is False
19
+ assert _parse("word") == "word"
20
+ assert _parse("word word") == "word word"
21
+ assert _parse('"a string"') == '"a string"'
19
22
  assert _parse("uniform 1") == 1
20
23
  assert _parse("uniform 1.0") == 1.0
21
24
  assert _parse("uniform 1.0e-3") == 1.0e-3
@@ -162,3 +165,11 @@ def test_internal_field(pitz: FoamCase) -> None:
162
165
  assert u == pytest.approx(u_arr)
163
166
 
164
167
  pitz.run()
168
+
169
+
170
+ def test_fv_schemes(pitz: FoamCase) -> None:
171
+ div_schemes = pitz.fv_schemes["divSchemes"]
172
+ assert isinstance(div_schemes, FoamDictionary)
173
+ scheme = div_schemes["div(phi,U)"]
174
+ assert isinstance(scheme, str)
175
+ assert scheme == "bounded Gauss linearUpwind grad(U)"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes