-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adapter and tool configuration schema #18
Comments
A schema could look like this (very first draft): {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"participant_name": {
"type": "string",
"description": "Name of the participant."
},
"config_file_name": {
"type": "string",
"description": "Path to the configuration file."
},
"interfaces": {
"type": "array",
"items": {
"type": "object",
"properties": {
"mesh_name": {
"type": "string",
"description": "Name of the mesh associated with this interface."
},
"write_data_names": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of data fields to be written on this mesh."
},
"read_data_names": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of data fields to be read on this mesh."
}
},
"oneOf": [
{
"required": ["write_data_names"]
},
{
"required": ["read_data_names"]
}
],
"required": ["mesh_name"]
}
}
},
"required": ["participant_name", "config_file_name", "interfaces"]
} This now enables tooling, for example to get a GUI via the MetaConfigurator. |
If we want to use something less verbose and significantly easier to read than JSON, we should strongly consider TOML. Possible dealbreaker is that TOML doesn't feature a validation schema yet. ExamplesFEniCS adapter: precice-adapter-config.json participant_name = "Solid"
config_file_name = "../precice-config.xml"
[interface]
coupling_mesh_name = "Solid-Mesh"
write_data_name = "Heat-Flux"
read_data_name = "Temperature"
interpolation_type = "rbf" FMI runner: precice-settings.json [coupling_params]
participant_name = "Mass-Left"
config_file_name = "../precice-config.xml"
mesh_name = "Mass-Left-Mesh"
write_data_name = "Force-Left"
read_data_name = "Force-Right" ASTE replay: participant = "Fluid"
startdt = 1
precice-config = "../precice-config.xml"
[[meshes]]
mesh = "Fluid-Mesh"
meshfileprefix = "./exported-meshes/Fluid-Mesh-Fluid"
[meshes.read-data]
vector = [ "Displacement" ]
[meshes.write-data]
vector = [ "Force" ] |
Just a side comment:
while that's true, json format is also supported and available in deal.II. |
@Logende This is the schema I just talked about. Could be an additional showcase for your thesis. |
An initial step may be to unify the syntax of all configuration files. There are tools that allow checking various formats against json schema files: There are also some format-specific toolkits that offer json schema validation: |
I think we first need to agree on whether we want to enforce every adapter to use the same configuration file format, even in the case the solver-specific solution makes sense. History:
In the proposal, we also don't really specify the enforcement:
I think that:
Going one step further, I still think that many (not all) of the options we currently provide via adapter configurations could be sourced from the preCICE configuration file, see the older issue precice/precice#474. |
To my understanding, @uekerman proposed to use a solver-native solution if available and use a uniform format as the default fallback. |
Even if we continue to also allow solver-native solutions (we have indeed learned in the past that this is very helpful), we could still make them use the same (language-independent) schema. Currently, OpenFOAM, for example, already follows a very similar schema, only in a different language. preciceConfig "precice-config.xml";
participant Fluid;
modules (CHT);
interfaces
{
Interface1
{
mesh Fluid-Mesh;
patches (interface);
locations faceCenters;
readData
(
Heat-Flux
);
writeData
(
Temperature
);
};
}; |
If you give ChatGPT the schema and the OpenFOAM config, it can convert to JSON: {
"participant_name": "Fluid",
"config_file_name": "precice-config.xml",
"interfaces": [
{
"mesh_name": "Fluid-Mesh",
"patches": [
"interface"
],
"location": "faceCenters",
"read_data_names": [
"Heat-Flux"
],
"write_data_names": [
"Temperature"
]
}
]
} |
The reverse direction seems to work as well. We could generate the following at least: preciceConfig "../precice-config1.xml";
participant Fluid;
interfaces
{
Interface1
{
mesh Fluid-Mesh;
writeData
(
Displacement
Temperature
);
readData
(
Velocity
);
};
}; |
@Logende How could we integrate the latter two use cases into MetaConfigurator? Assumption: We have our fixed JSON schema.
Similarly, it would be good if we could import / export yaml. |
On the first one I am working right now: creation of JSON document according to schema based on data in a different format. YAML export is already possible. |
Maybe in the settings, the user could add any arbitrary niche export format, together with a url for an example? |
We currently have a zoo of configuration options:
Some solver-specific solutions are quite meaningful. Other solutions reinvent the wheel. We have no standard and no schema yet. The latter could also enable quite some tooling support.
Example:
FEniCS adapter:
precice-adapter-config.json
FMI runner:
precice-settings.json
ASTE replay:
The text was updated successfully, but these errors were encountered: