CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] Need to use gravity field for defining the expression in swakFunction

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By wyldckat
  • 2 Post By gschaider
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2017, 20:26
Default 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
Esmaeelef is on a distinguished road
Quote:
Originally Posted by gschaider View Post
When it is ready. Intermediate versions are found in the mercurial-repository. But they may contain bugs so use with care. New features are documented in the README



No. That is the latest released one
Hi Bernhard,

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?
Esmaeelef is offline   Reply With Quote

Old   April 25, 2017, 11:27
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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"
After scrolling up for a while and checking each line, I spotted something interesting about "getG", inside the file "./groovyBC/fillingTheDam/system/controlDict", namely this:
Code:
    getG {
        type executeIfObjectExists;
        readDuringConstruction true;

        objectName g;
        checkType true;
        objectType uniformDimensionedVectorField;
        objectShouldExist false;

        functions {
            loadG {
                type readGravitation;
            }
        }
    }
Oddly enough, I didn't see where it was being used after that...

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.
Esmaeelef likes this.
__________________
wyldckat is offline   Reply With Quote

Old   April 25, 2017, 11:44
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Esmaeelef View Post
Hi Bernhard,

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?
Using the actual field is difficult as this is not a regular field. One way would be to read the g-file. This is hidden in the README
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.
wyldckat and Esmaeelef like this.
__________________
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
gschaider is offline   Reply With Quote

Old   May 1, 2017, 02:11
Default
  #4
New Member
 
Esmaeel Eftekharian
Join Date: Jan 2016
Location: Sydney, Australia
Posts: 16
Rep Power: 10
Esmaeelef is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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"
After scrolling up for a while and checking each line, I spotted something interesting about "getG", inside the file "./groovyBC/fillingTheDam/system/controlDict", namely this:
Code:
    getG {
        type executeIfObjectExists;
        readDuringConstruction true;

        objectName g;
        checkType true;
        objectType uniformDimensionedVectorField;
        objectShouldExist false;

        functions {
            loadG {
                type readGravitation;
            }
        }
    }
Oddly enough, I didn't see where it was being used after that...

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.
Hi Bruno,
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
Esmaeelef is offline   Reply With Quote

Old   May 1, 2017, 07:58
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Esmaeelef View Post
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.
I'm not familiar enough with the "del" operator, the closest I've dealt with was written on this thread: u.del v notation in openfoam
Esmaeelef likes this.
wyldckat is offline   Reply With Quote

Old   May 1, 2017, 17:01
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Esmaeelef View Post
Hi Bruno,
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
Define "unreasonable"
__________________
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
gschaider is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 19:04.