Import data fields for boundary conditions during run time
Dear Foamers,
Is it possible to import data during run time and map it on the inlet patch? The data could be the result of another case, from measurements or artificially created and saved in text files. I would like to periodically read in the prepared data fields during run time. I did not find a possible approach in swak4foam (funkySetFields, groovyBC), please correct me if I am wrong. Each answer is appreciated! Aylalisa |
You could code a library function to do that. You'd need to pass the field you wanted to change, probably, so that you didn't change the internal field (you want that to remain as it is, right?)
Then you can set boundary values using something like Code:
field.boundaryField()[patchNumberForInlet] == setOfNewValues What setup do you have for your text files? Do you have a list of values, one per patch face? If so, should be pretty doable. If you have a different number of values, I suppose you'll need to reconstruct a new patch face - maybe the mapFields utility could help you here, but I have no idea how it works and haven't used it. Best, Christian |
Dear Christian,
thanks a lot for your reply! I have minimal programming skills, so please apologize my questions. Quote:
I would prefer to do all the data formatting before transfering it to the library function, maybe with Python because it seems to me to be easier to handle it there. In Python I could probably produce each kind of format. But in which format does OpenFOAM accept the values? My first idea is a *.xy file with one column (according to the cell ordering of the area I want to provide with the data? Do you think I destroy to much of the field information if I do some kind of interpolation with the field data to finally match the number of patch faces??? mapFields works good to map Fields from a source case to a target case before simulation starts. I need a mapFields function that runs periodically through the source case volume field (with the mapped measurement data) maybe during the run. At the moment this is still an idea. Yet I am busy with existing utilites (that don't cooperate:o). Best regards, Aylalisa |
Have a look at the coupling boundary condition, e.g. https://github.com/OpenFOAM/OpenFOAM...lCoupledCavity
|
All times are GMT -4. The time now is 02:44. |