|
[Sponsors] |
[swak4Foam] Need to use gravity field for defining the expression in swakFunction |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 24, 2017, 20:26 |
Need to use gravity field for defining the expression in swakFunction
|
#1 | |
New Member
Esmaeel Eftekharian
Join Date: Jan 2016
Location: Sydney, Australia
Posts: 16
Rep Power: 10 |
Quote:
I am using fireFoam solver and trying to define a new field using libswakFunctionObjects.so library. I need to use gravity field for defining the expression, however, I cannot retrieve gravity value to define the expression value. Is there any parameter retrieving gravity vector field? |
||
April 25, 2017, 11:27 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quick answer: I've moved your post to a new thread, because it was not within the context of the other thread.
I used the following command, executed from within the folder "Examples" in swak4Foam's folder: Code:
find . -name "controlDict" | xargs grep "g" Code:
getG { type executeIfObjectExists; readDuringConstruction true; objectName g; checkType true; objectType uniformDimensionedVectorField; objectShouldExist false; functions { loadG { type readGravitation; } } } Either way, there is an example in the README file too, search for "gravity" and you should find an example for including the gravity file "g" and using it directly in the entry for the function object.
__________________
|
|
April 25, 2017, 11:44 |
|
#3 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
**** Macro expansion For expressions and variable lists there is now the possibility to expand values from the dictionary during reading. The two characters that trigger this are - $ :: like the regular variable lookup in OpenFOAM.In its most complex form it looks like this =$[(type)spec]= where =spec= specifies where to look for the value (including scoping if the OpenFOAM-version supports it). The optional =type= specifies how the entry should be interpreted - # :: in variable lists: =#otherList;= includes the variable list =otherList= instead of this entry These expansions allow the construction of reusable snipplets that include information from other parts of the case. For instance (this is only part of the specification) : #include "$FOAM_CASE/constant/g" : vecName U; : downComponent ( : "grav=$[(dimensionedVector)g];" : "down=($vecName & grav)/mag(grav);" : ); : variables ( : "#downComponent;" : "maxDown=max(mag(down));" : ); would calculate the component of a vector field that points in the direction of the gravity (as specified in the =g=-file). This expansion is done during the expression.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
May 1, 2017, 02:11 |
|
#4 | |
New Member
Esmaeel Eftekharian
Join Date: Jan 2016
Location: Sydney, Australia
Posts: 16
Rep Power: 10 |
Quote:
Many thanks for your response. I have another question. In a part of my work, I need to calculate the flow local acceleration DU/Dt (which is in fact du/dt +U.del(U)). To calculate this term, I put (ddt(U)+U&grad(U)) as the expression, However, I get unreasonable results. Do you have any idea if I am on the right track concerning calculation of this term. Thank you in advance |
||
May 1, 2017, 07:58 |
|
#5 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quote:
|
||
May 1, 2017, 17:01 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 04:49 |
Convergence problem with tetrahedral grids | Tarak | OpenFOAM Running, Solving & CFD | 22 | June 25, 2018 19:09 |
CEL expression in CFX pre | Jane92 | Main CFD Forum | 1 | June 3, 2016 02:48 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |