Closed keiyamamo closed 1 year ago
I have several capitalized parameters in my config files and I think it would be nice to have support for this. We used to have support for this before we switched from DefaultConfigArgParser
to ConfigparserConfigFileParser
in PR #57. That PR adds support for dictionaries like this:
[fluid]
fluid_properties : {
dx_f_id: 2,
rho_f: 1,
mu_f: 1E3
}
This does not work with DefaultConfigArgParser
, however keeping the dictionary on one line works fine:
fluid_properties={dx_f_id: 2, rho_f: 1, mu_f: 1E3}
Then we don't need the section header anymore either, which is not used anyway.
What do you think @keiyamamo?
Hi @johannesring
I agree that it would be nice to support capitalized parameters!
I want to test if using other material model (like this problem) with config file would still work before switching back to DefaultConfigArgParser
.
If it works fine for solid parameters as well, then I can probably make a new PR for switching back to the DefaultConfigArgParser
. (unless you want to do it :)) What is your thought? @johannesring
With this patch we will keep support for the fluid_properties
and solid_properties
dictionaries (if they are specified on one line) and the parameters will be case sensitive like before:
diff --git a/turtleFSI/utils/argpar.py b/turtleFSI/utils/argpar.py
index c1acedc..3ce9232 100644
--- a/turtleFSI/utils/argpar.py
+++ b/turtleFSI/utils/argpar.py
@@ -120,7 +120,7 @@ def restricted_float(x):
def parse():
- parser = configargparse.ArgParser(config_file_parser_class=configargparse.ConfigparserConfigFileParser,
+ parser = configargparse.ArgParser(
description=("turtleFSI is an open source Fluid-Structure Interaction (FSI) solver written in Python "
+ "and built upon the FEniCS finite element library. The purpose of turtleFSI is to "
+ "provide a user friendly and numerically robust monolithic FSI solver able to handle "
Please go ahead and make a PR if it works for you @keiyamamo.
@johannesring I got it! Thank you :)
I noticed that
configparser
convert all key names to lowercase by its default. This is not a big problem but is not mentioned anywhere in our example and we actually use parameter with uppercase. As long as there is no demand for supporting upper case parameter, I will changeexample.config
andturtle_demo
to make it consistent.Ref. https://github.com/KVSlab/turtleFSI/blob/e869c8dd363b0e869f279749a66fd1203df8ef8a/docs/examples/example.config#L50
This will be treated as
um