-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fields and Variables #231
Comments
I fully agree. It would make things much simpler. And simpler is better ;) Even for the solution field, often the fields do not behave as a Tensor together: rhoU, rhoV, rhoW are a vector, but rho and rhoE are not (hence the ARRAY type) -- so if you want to keep them together, you name the whole lot something like: u[] and u[0] is rho. Then what we can do is provide some sort of "alias" component, that allows you to write "rho", and internally translates to u[0]. |
In literature one indeed calls it the solution "variable", with symbol Q or U or W. I don't think this poses any issue for UFEM, as if I understand correctly, it assembles a solution-vector on the fly (?) |
Allright, looks like we have an item on the agenda for Thursday then ;) Anyway, just a short version of my thoughts about this: I don't want to be a wet blanket, but converting what we have now to this "simpler" system is a far from easy task. When interfacing the LSS, for example, it is much easier to refer to all variables if they are in the same field, otherwise updating the solution vector becomes a nightmare. Switching to an "array" variable as a combined pressure, temperature and velocity places this burden on the author of the solver, making things much harder instead of simpler. µThere is also the issue of parallel sync, where a field is handled in one grouped comms call, so that's an optimization we'd lose. Basic observation: if the current API to access variables is too complicated, we should work on improving that API, and not jump head-over-heels into a structural change that will require a LOT of rewriting. |
Those are pretty good points. |
Absolutely! Note that I am in favor of keeping our API as simple as possible, but I'm sure we can figure out ways to have a simple API and still keep the advantages of the current data structure. It's definitely a strength that we have such radically different solvers as SDM and UFEM, that makes sure all requirements are met. |
I do think that it is a too complex system to have IN GENERAL multiple variables inside fields. It is much easier to think in terms of scalar-fields, vector-fields, tensor-fields, ... The variable-length is trivial, the variable-name as well is trivial. A variable is a component itself this way also, and can be accessed through scripts by its variable (or field) name. For SDM, I anyhow require such thing as a solution-field. This field would just be a variable-less field with column-names "Q[0], Q[1], Q[2], Q[3], Q[4]". In fact the solution-vector is thus a variable itself. The compressible Navier-Stokes equations have equations for rho, rhou, rhov, rhow, rhoE. Storing these solution-variables as separate fields doesn't really make sense, as users are only intersted in more tangible variables (temperature, velocity, pressure). Applying the initial condition of the solution-field correctly is rather not a complexity that is added to the solver, but what a user would expect to do manually with components such as "mesh::actions::InitFieldFunction", or a python loop. Really in practice this will not remove functionality from solver algorithms, but only serve to create new post-proc algorithms that can take better advantage of the fact that a field is a variable. |
I propose that the dictionary then just has 2 functions to create fields: dict.create_field( name, columns ) for ARRAY fields such as the solution dict.create_field( name, SCALAR ) |
OK, after thinking about this for almost 3 years, I have to say I agree, changing the API so a field contains a single variable would indeed simplify things. I could work out a proposal in my fork, if that's OK. |
I have a proposal for the Fields and Variables.
I would propose to have only 1 variable per field.
This would really improve the handling of fields and variables.
--> function-parsers could automatically use these unique variable names as arguments
A field would be defined to have only one of following variable-types:
SCALAR: 1 column
VECTOR_2D: 2 columns
VECTOR_3D: 3 columns
TENSOR_2D: 4 columns
TENSOR_3D: 9 columns
ARRAY: variable columns
There is of course the "issue" of the solution-field consisting in principle out of many variables. This is really more of an exception than a rule.
I propose to just keep that field as 1 variable "solution" of the ARRAY variable-type consisting of e.g. 5 columns in the 3D Navier-Stokes case. The solution variables (e.g. rhoE ) are usually not as important as more tangible variables such pressure and temperature.
This solution-field should then be seen as a more intermediate field, just to arrive to a set an updated set of variables. A physics module or python script is then responsible for translations.
The text was updated successfully, but these errors were encountered: