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

fvOptions scalarTransport utility

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By matthew.legg
  • 1 Post By matthew.legg
  • 1 Post By matthew.legg
  • 1 Post By matthew.legg

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 9, 2015, 11:56
Default fvOptions scalarTransport utility
  #1
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Hi all,

Has anybody had any experience with the scalarTransport utility using the fvOptions framework. It was apparently added in the v2.2.0 distribution (http://www.openfoam.org/version2.2.0...processing.php) but I cant find anywhere an example of the syntax.

I tried to reverse engineer the input from scalarTransport.H but failed when it appears to hand things over to fvOptions.

In essence I would like to add a volume (cellSet) source of a passive scalar to simpleFoam. They appear to have accomplished this in the link above but don't describe the syntax.

Any help is very much appreciated.

Thanks

Matt
matthew.legg is offline   Reply With Quote

Old   February 10, 2015, 03:07
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

In fact the statements are separate: 1. you utilize function object for scalar transport, 2. you utilize fvOption framework or BCs for the sources of scalar. If you'd like to have source of scalar inside a domain, you can take a look ether at explicitSetValue or at semiImplicitSource/codedSource. You can find dictionary syntax in the headers of corresponding H files.
alexeym is offline   Reply With Quote

Old   February 10, 2015, 04:33
Default
  #3
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Alexey,

Thank you. I have it working now. For reference;

Code:
      S
      {
          type            scalarTransport;
          outputControl   outputTime;
          resetOnStartUp  false;
          autoSchemes     true;
          fvOptions       
          {
               S-01
               {
               type            scalarExplicitSetValue;
               active          true;
               selectionMode   cellZone;
               cellZone        sampleInlet;
               scalarExplicitSetValueCoeffs
                   {
                       injectionRate
                       {
                           S   1;
                       }
                   }
               }
          };
      }
Matt
alexeym and amuzeshi like this.
matthew.legg is offline   Reply With Quote

Old   March 30, 2015, 19:00
Default hello! am interested in this!
  #4
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
hi there! well, for clarification, how do you implement the object? do I have to call an "S" file in the 0 folder?

Thanks for your future reply!
cfd_inquirer is offline   Reply With Quote

Old   March 31, 2015, 05:05
Default
  #5
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Hello,

You do not need to include a file in the 0 directory. The scalar field is initialised using the name given to the function object ("S" in the example above).

This is implemented as a function object in controlDict. Also remember that you need to call the correct libraries as well. In this case I used the following also in controlDict.

libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);

I believe that the scalarTransport object used above belongs to libswakFunctionObjects.

Regards,

Matt
matthew.legg is offline   Reply With Quote

Old   March 31, 2015, 08:46
Default
  #6
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
oh thanks for the reply! but then...I got this error...

I am trying to use it on porousSimpleFoam...u know trying to have a passive scalar on a porous obstacle or barrier...

I know it would be too much to ask...but what did I do wrong?

my entry in controlDict is as follows (for porousSimpleFoam case):

application porousSimpleFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1000000;

deltaT 1;

writeControl timeStep;

writeInterval 100;

purgeWrite 0;

writeFormat binary;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

graphFormat raw;

runTimeModifiable true;


functions

{

S
{
type scalarTransport;
outputControl outputTime;
resetOnStartUp false;
autoSchemes true;
fvOptions
{
S-01
{
type scalarExplicitSetValue;
active true;
selectionMode cellZone;
cellZone sampleInlet;
scalarExplicitSetValueCoeffs
{
injectionRate
{
S 1;
}
}
}
};
}


functionObjectLibs
(
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);


}



Thanks again in advance!
cfd_inquirer is offline   Reply With Quote

Old   March 31, 2015, 10:01
Default
  #7
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
It might be that you need to call the libraries in a subdictionary named "libs" not "functionObjectLibs". For example,

Code:
libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);
Your controlDict should then become,

Code:
functions

{

S
{
type scalarTransport;
outputControl outputTime;
resetOnStartUp false;
autoSchemes true;
fvOptions 
{
S-01
{
type scalarExplicitSetValue;
active true;
selectionMode cellZone;
cellZone sampleInlet;
scalarExplicitSetValueCoeffs
{
injectionRate
{
S 1;
}
}
}
};
}


libs
(
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);


}

If that doesn't work then please upload your output log so i can look at the specific error message.

Matt
amuzeshi likes this.
matthew.legg is offline   Reply With Quote

Old   March 31, 2015, 11:10
Default
  #8
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
oh wow! thanks for your prompt reply! well, this is the error am getting....I apologize as I am really new in C++ programming... but am really thanking you for your prompt help regarding this matter! Appreciate it so much!

Again thanks in advance....

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Searched : "constant/polyMesh/sets"
Found :
2
(
sampleInlet
c0
)


Adding set sampleInlet as a cellZone.
Adding set c0 as a cellZone.
Writing mesh.

End

howellg@derecho:~/OpenFOAM/howellg-2.2.2/run/NEW_howellg_tests/z_test2$ porousSimpleFoam
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.2.2-9240f8b967db
Exec : porousSimpleFoam
Date : Mar 31 2015
Time : 10:08:26
Host : "derecho"
PID : 28489
Case : /home/howellg/OpenFOAM/howellg-2.2.2/run/NEW_howellg_tests/z_test2
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
field p tolerance 1e-07
field U tolerance 1e-07
field "(k|epsilon|omega)" tolerance 1e-07

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
sigmaEps 1.3;
}

No finite volume options present

No MRF models present

Creating porosity model list from porosityProperties

Porosity region porosity1:
selecting model: DarcyForchheimer
creating porous zone: c0
Using pressure implicit porosity

Starting time loop



--> FOAM FATAL ERROR:
Unknown function type scalarTransport

Valid functions are :

4
(
patchProbes
probes
sets
surfaces
)



From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 92.

FOAM exiting
cfd_inquirer is offline   Reply With Quote

Old   April 2, 2015, 04:00
Default
  #9
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Hi,

Apologies for the delayed response.

I forgot to mention that in this instance I have called the libswakFunctionObjects.so library which is part of the excellent swak4foam distribution which I strongly recommend you install.

However if you do not have this then you have to use one of the standard openFoam libraries, which by elimination I found to be libutilityFunctionObjects.so.

So your libs entry in controlDict should become,

Code:
libs  (
      "libutilityFunctionObjects.so"
      );
I hope this works for you.

Matt
rob3rt 0ng likes this.
matthew.legg is offline   Reply With Quote

Old   April 2, 2015, 11:56
Default
  #10
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
hi there again! thanks for your reply. well, I think it's not only about that swak4Foam thingee. As I've said, it seems like my OpenFOAM (ver. 2.2.2) does not recognize the ff:

"type scalarTransport"

within the command. But as far as I know, it can be done right?
O am I missing a thing here...

Thanks again in advance!
cfd_inquirer is offline   Reply With Quote

Old   April 2, 2015, 12:23
Default
  #11
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
well am trying a different approach using fvOptions...since I think the ControlDict approach is not applicable in OpenFOAM ver. 2.2.2.

Do you happen to have experience on this? am trying to "copy" what was done in reactingParcelFoam and the ff entry I have:

filter1
{
type explicitPorositySource;
selectionMode cellZone;
cellZone c0;
active true;

explicitPorositySourceCoeffs
{
type DarcyForchheimer;

DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (500000 -1000 -1000);
f f [0 -1 0 0 0 0 0] (0 0 0);

coordinateSystem
{
e1 (1 0 0);
e2 (0 1 0);
}
}
}
}


massSource1
{
type scalarSemiImplicitSource;
active true;
timeStart 0.2;
duration 2.0;
//selectionMode points;
//points
//(
// (2.75 0.5 0)
//);
selectionMode cellZone;
cellZone c1;

scalarSemiImplicitSourceCoeffs
{
volumeMode absolute;
injectionRateSuSp
{
rho (1e-4 0); // kg/s
H2O (1e-4 0); // kg/s
}
}
}

but it gives me error like:

FOAM Warning :
From function void option::checkApplied() const
in file fvOptions/fvOption.C at line 365
Source massSource1 defined for field rho but never used
--> FOAM Warning :
From function void option::checkApplied() const
in file fvOptions/fvOption.C at line 365
Source massSource1 defined for field H2O but never used
--> FOAM Warning :
From function void option::checkApplied() const
in file fvOptions/fvOption.C at line 365
Source massSource1 defined for field rho but never used
--> FOAM Warning :
From function void option::checkApplied() const
in file fvOptions/fvOption.C at line 365
Source massSource1 defined for field H2O but never used

you have idea what injection setup mean?
what I actually want is let's say an initial concentration at the c1 zone which is "filtered" in the c0 zone...

Did i do good on the code? I really have not much experience in C++ coding. :-(

Again thanks in advance!
cfd_inquirer is offline   Reply With Quote

Old   April 2, 2015, 13:01
Default
  #12
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Hmm that is curious as the scalarTransport utility and the fvOptions framework seems to be implemented in 2.2.0 and therefore should be in 2.2.2.

http://www.openfoam.org/version2.2.0...processing.php

The solver will not be able to "find" the scalarTransport routine if the correct library is not defined in the controlDict libs sub dictionary. As i mentioned earlier this should be "libutilityFunctionObjects.so", so this should be present in your libs sub dictionary. I am unsure whether this is present in 2.2.2 but it works no problem in my 2.3.0 distribution.

I'm unfamiliar with the method you suggested so can't help you there I'm afraid.

I am happy to share a working test case with you but it won't be for a few days now as i am away from my computer.

Matt
matthew.legg is offline   Reply With Quote

Old   April 2, 2015, 14:53
Default
  #13
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
oh yeah, I was thinking the same...it's like, it doesn't make sense.. LOL (unless am doing wrong things with my code or something).

sure, I would love to wait for a working case. and it's really kind of weird coz I installed 2.30 previously but my case wasn't working there and now my case is working on 2.2.2 so I am stuck with 2.2.2. The problem is, I've exhausted so much finding the right solution on this, and weirdly enough am just using simple geometry.

again, I would love to wait and thanks for the help. In the meantime, I am still finding "other" ways to do this.
cfd_inquirer is offline   Reply With Quote

Old   April 9, 2015, 03:37
Default
  #14
New Member
 
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 11
matthew.legg is on a distinguished road
Hello,

Apologies for the delay. Please find attached a working case in OF 2.3 based on the pitzDaily simpleFoam tutorial.

A scalar source is added to three cells in the "throat" of the model using the scalarTransport utility.

Let me know if you are able to execute this case without any errors.

Matt
Attached Files
File Type: zip scalarTransportPitzDaily.zip (8.0 KB, 173 views)
rob3rt 0ng likes this.
matthew.legg is offline   Reply With Quote

Old   April 9, 2015, 15:54
Default
  #15
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
Hello there matthew!

Well, I tried it at first for OpenFOAM 2.2.2 and it smoothly ran BUT there are no fields/results for "S"...

So i ran it again in ver. 2.3.0 and it did the same thing.... only U and p are in the fields results but it seemed that there was no solution done for "S" through time...

Do you have an inkling why would this happen?

Thanks again bro! Really looking forward for your reply!
cfd_inquirer is offline   Reply With Quote

Old   April 14, 2015, 12:09
Default
  #16
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
hello there again Matthew!

well, ok, I don't know what was going on but i was able to run the one you gave me in both ver. 2.2.2 and 2.3.0. I think ParaView is the one that is giving me trouble. anyways, I was wondering, the one you gave me is simpleFoam and am trying to adapt it in porousSimpleFoam where I have a "porous" zone where this "passive scalar" will go through and be filtered out. Do you have any ideas about this? Because when I tried to just copy the ones you gave me (and it was working on my simpleFoam geometry and domain...) and try to run porousSimpleFoam,. my "p" value suddenly blows up and the simulation just terminates. Was wondering if you have any idea what could be wrong? Thanks again and I really appreciate your help!
cfd_inquirer is offline   Reply With Quote

Old   April 14, 2015, 12:23
Default
  #17
New Member
 
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 12
cfd_inquirer is on a distinguished road
hmm....I think I have "conflicting" cellZones' call. It seems like the porous cellzone that I had which worked without the scalartransport tracer source is now not working when I have the tracer cellzone and it doesn't give any field zones (when I tried to open the cellZone file).
cfd_inquirer 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
Can I use fvOptions to couple a solid region and a fluid region? titanchao OpenFOAM Running, Solving & CFD 4 January 14, 2022 07:55
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
[mesh manipulation] mirrorMesh utility preserving regions zfaraday OpenFOAM Meshing & Mesh Conversion 1 November 7, 2016 21:51
Something doens't work with wallHeatFlux utility or externalWallHeatFluxTemperat BC!! zfaraday OpenFOAM Post-Processing 0 February 5, 2015 16:47
Sample Utility not working in OpenFoam 1.6 titio OpenFOAM Post-Processing 0 February 5, 2010 12:12


All times are GMT -4. The time now is 17:37.