|
[Sponsors] |
February 24, 2020, 04:38 |
Trying to Generalize fvSolutions file
|
#1 |
New Member
Farhan Ahmed
Join Date: Feb 2020
Posts: 6
Rep Power: 6 |
Hi Everyone!
We are trying to develop a GUI OF OPENFOAM FOR OUR INSTITUTE. To do so initially we are Generalizing the fvSchemes controldict and other OPENFOAM files by listing every option available in them. The problem is with fvSolutions file every solver has a different fvSolutions file ....is it possible to make a single generalized fvSolutions file which will work with any solver ??? |
|
February 25, 2020, 06:52 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
If not for all, but for the most you can do it. Supply the PIMPLE and SIMPLE dictionary, all fields which can be in the solver. You can also use regex so for example ".*"{solverOptions} will be used for every field, etc... You can add everything in the fvSolution, the solver will only read what is needed. A bruteforce method can be if you just use the same fvSolution for different solvers. If the solver will miss something, just add it. Then go to the next solver with the same fvSolution... Another possibility if you create more fvSolutions, like fvSolution.simpleFoam, fvSolution.icoFoam, etc. For all the solvers you need. And then just copy-paste the needed file into your case. |
|
February 25, 2020, 10:07 |
|
#3 |
Member
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7 |
Hey,
If you know the general structure of a solver and each of your group follows strict naming conventions, you could try to find out which fields are being solved by pattern matching the solver files. For instance, running: Code:
grep -Erh "[a-zA-Z]*\.solve\(" | cut -f 1 -d '.'| tr -d ' '| sed "s/Eqn//" |
|
February 26, 2020, 23:31 |
|
#4 |
New Member
Farhan Ahmed
Join Date: Feb 2020
Posts: 6
Rep Power: 6 |
Thank you So Much ...your suggestions were great help
|
|
February 27, 2020, 00:44 |
|
#5 |
New Member
Farhan Ahmed
Join Date: Feb 2020
Posts: 6
Rep Power: 6 |
I'm not familiar with regex .* concept.
can u help me understand it ? I have noticed in fvSolutions with some solver options it uses .* e.g in some files it uses "k.*" ....in others just simply k without .*? if we use .* for every solver option or dont use .* at all ..what difference will it make? I'm new to openfoam or ubuntu scriting ...So i hope you don't mind answering my questions ?..Thanks |
|
February 27, 2020, 02:42 |
|
#6 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
You can search for "POSIX regex" and probably you will find how to use it. The most common ones I know are: ".*" -> everything matches "U.*" -> Everything starts with U "(U|k|h)" -> match for U, k, and h so you don't need 3 dictionary if they are the same. "(U|k|h)Final" -> This will match for UFinal, kFinal, hFinal You can do fancy stuff with POSIX regex, but sadly these are ones I know Also in the tutorials you can find some usage. I hope it helps. |
|
February 27, 2020, 02:44 |
|
#7 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Sorry I missed it and can't edit my post:
" are needed around the variables!!! |
|
February 27, 2020, 08:11 |
|
#8 | |
Member
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7 |
Quote:
In the fvSolution files the expression "rho.*" is also a regex expression matching. The dot "." matches any character. The "*", as previously explained, matches zero or more of the previous character. This means that the expression "rho.*" matches not only "rho" but also "rhoFinal" or "rhoAwesomeVariable234askj2" and will use the same solution settings for all these fields. Hope it's understandable. |
||
March 2, 2020, 03:44 |
|
#9 | |
New Member
Farhan Ahmed
Join Date: Feb 2020
Posts: 6
Rep Power: 6 |
Quote:
|
||
March 2, 2020, 04:17 |
|
#10 |
New Member
Farhan Ahmed
Join Date: Feb 2020
Posts: 6
Rep Power: 6 |
raumpolizei....Thanks Man
yeah it was quite clear to understand ..i got it Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to calculate mass flow rate on patches and summation of that during the run? | immortality | OpenFOAM Post-Processing | 104 | February 16, 2021 08:46 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 21:53 |
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 | towanda | OpenFOAM Community Contributions | 6 | September 5, 2015 21:03 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 11:44 |
ParaView Compilation | jakaranda | OpenFOAM Installation | 3 | October 27, 2008 11:46 |