|
[Sponsors] |
February 9, 2015, 12:56 |
fvOptions scalarTransport utility
|
#1 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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 |
|
February 10, 2015, 04:07 |
|
#2 |
Senior Member
|
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. |
|
February 10, 2015, 05:33 |
|
#3 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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; } } } }; } |
|
March 30, 2015, 20:00 |
hello! am interested in this!
|
#4 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
March 31, 2015, 06:05 |
|
#5 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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 |
|
March 31, 2015, 09:46 |
|
#6 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
March 31, 2015, 11:01 |
|
#7 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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" ); 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 |
|
March 31, 2015, 12:10 |
|
#8 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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 |
|
April 2, 2015, 05:00 |
|
#9 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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" ); Matt |
|
April 2, 2015, 12:56 |
|
#10 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
April 2, 2015, 13:23 |
|
#11 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
April 2, 2015, 14:01 |
|
#12 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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 |
|
April 2, 2015, 15:53 |
|
#13 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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. |
|
April 9, 2015, 04:37 |
|
#14 |
New Member
Matthew Legg
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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 |
|
April 9, 2015, 16:54 |
|
#15 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
April 14, 2015, 13:09 |
|
#16 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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! |
|
April 14, 2015, 13:23 |
|
#17 |
New Member
howgee
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
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).
|
|
|
|
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 08:55 |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
[mesh manipulation] mirrorMesh utility preserving regions | zfaraday | OpenFOAM Meshing & Mesh Conversion | 1 | November 7, 2016 22:51 |
Something doens't work with wallHeatFlux utility or externalWallHeatFluxTemperat BC!! | zfaraday | OpenFOAM Post-Processing | 0 | February 5, 2015 17:47 |
Sample Utility not working in OpenFoam 1.6 | titio | OpenFOAM Post-Processing | 0 | February 5, 2010 13:12 |