CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

semiImplicitSource, Source defined for field but never used

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Tom Lauriks
  • 1 Post By LuckyTran
  • 1 Post By LuckyTran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2020, 12:22
Default semiImplicitSource, Source defined for field but never used
  #1
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 6
Tom Lauriks is on a distinguished road
Hi Foamers,


I’m performing an atmospheric boundary layer simulation with OpenFOAM v6. The domain is a cuboid. In the middle, there are 2 buildings. In between the buildings at the ground level, a passive scalar should be released from 4 volumes, collectively known as source1, this at a fixed mass flow rate. These volumes are created via topoSet as a cellSet and are indeed present (verified in paraFoam).



I used the simpleFoam solver and added the scalar transport as a function object of type scalarTransport. The field has the name sf6. When I specify a concentration at the inlet, sf6 is calculated. When I specify concentration 0 at the inlet and a scalarSemiImplicitSource in fvOptions, in the log file I get the line “Source scalarSource defined for field sf6 but never used”. I checked the scalarTransport.C file and the source term is present in the equation: fvScalarMatrix sEqn ( fvm::ddt(rho, s_) + fvm::div(phi, s_, divScheme) - fvm::laplacian(D, s_, laplacianScheme) == fvOptions_(rho, s_) );



What I found so far on the forum isn’t helping. Does anyone have an idea how to solve this issue?



The semiImplicitSource is defined in fvOptions as follows:


Code:
scalarSource//name
 {
 
 
     type            scalarSemiImplicitSource;
     active          true;//Usable with any type
 
 
 
 
     scalarSemiImplicitSourceCoeffs
     {
 
 
 //        timeStart       0;//Usable with any type
 //        duration        1e6;//Usable with any type
         selectionMode   cellSet;// all, cellSet, points, cellZone  
         cellSet       source1;//Name of cell set or cell zone
 
 
 
 
         volumeMode    absolute; //absolute <quantity>; specific <quantity>/m^3
         injectionRateSuSp  
         {
             sf6      (10.0 0.0); //keyword is field name. 1st value is explicit value, 2nd implicit coefficient.   
                              //Units: [M T-1], where these units should probably be consistent with time and mass used in other the simulation settings
                              //CODASC case: source strength is 10 g s-1
         }
 
 
 
 
     }
 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
SHANRU likes this.
Tom Lauriks is offline   Reply With Quote

Old   April 24, 2020, 12:52
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Is there any chance that your transported scalar is NOT named sf6? What do you have in your 0 dir?
LuckyTran is offline   Reply With Quote

Old   April 24, 2020, 13:10
Default
  #3
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 6
Tom Lauriks is on a distinguished road
In the 0 dir, I have the file sf6, with the following header:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 6 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object sf6;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Tom Lauriks is offline   Reply With Quote

Old   April 24, 2020, 13:17
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
So in your definition of the scalar you correctly named the field not vapour but sf6? E.g.:
Code:
scalar1 {
     type            scalarTransport;
     libs            ("libsolverFunctionObjects.so");
       // Optional entries      // Name of scalar field to transport, default = 's'
     field           vapour;
LuckyTran is offline   Reply With Quote

Old   April 24, 2020, 13:44
Default
  #5
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 6
Tom Lauriks is on a distinguished road
Already thanks for helping out!

Do you mean in the functionObject definition? If yes, I indeed named the field sf6. This is how wrote the functionObject:

sf6 //Object name
{
type scalarTransport;
functionObjectLibs ("libsolverFunctionObjects.so");

enabled true;

writeControl outputTime;
//writeControl timeStep;
//writeInterval 1;

log yes;

nCorr 1;//Number of corrector iterations. At least 1 is recommended.

//Diffusion coefficient
// D 9.30E-6;//[m2 s-1] Molecular difussion coefficient
//If turbulent modeling in use, can define alphaD and alphaDt. OF source code manual D = alphaD*nu + alphaDt*nut. OF source code, scalarTransport.C:
//fvScalarMatrix sEqn ( fvm::ddt(rho, s_) + fvm::div(phi, s_, divScheme) - fvm::laplacian(D, s_, laplacianScheme) == fvOptions_(rho, s_) );
//Hence D is sum of molecular and turbulent diffusion. In COMSOL manual, diffusive flux is made up by: (D+nu_t/Sc_t). The sum of everything between the brackets should be the
//equivalent of D from the OF source code manual. Hence, in D=alphaD*nu + alphaDt*nut, alphaD*nu is the molecular diffusion coefficient and alphaDt*nut the turbulent diffusion coefficient.
//Hence, alphaD=D_molecular/nu. From the COMSOL manual and the info in en.wikipedia.org/wiki/Schmidt_number, it is clear that alphaDt=1/Sc_t, since Sc_t=nu_t/D_t
alphaD 0.62;
alphaDt 1.4286;

field sf6;//name of field. Need to select discretization schemes and linear solvers for this field. Also need to define boundary conditions and initial conditions for this field.

//Optional. Use the schemes of field, in this case, U
//schemesField U;
}
Tom Lauriks is offline   Reply With Quote

Old   April 24, 2020, 14:35
Default
  #6
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
The message Source scalarSource defined for field sf6 but never used comes from fvOption. Seeing this msg means fvOption is supported and that it was read but it doesn't know what to do with it. If there was missing definitions, you would get the corresponding error.

Usually what happens is, you define a source for a field (in this case sf6) and that field doesn't exist (or it exists but it's not registered) for the particular solver because you misnamed one or the other.

So my next question is... where are these dicts? I'm guessing the scalarTransport is defined as a function object in your control dict. Where did you put the fvOptions stuff? In its own dict in the system or constants? It needs to be declared as a sub-dict inside the same function object. E.g.


Code:
    s
    {
        type            scalarTransport;
        libs            ("libsolverFunctionObjects.so");
        field           s;

        fvOptions
        {
            s
            {
                type            scalarSemiImplicitSource;
                volumeMode      absolute;
                injectionRateSuSp
                {
                    s     (1000 0);
                }
            }
        }
Tom Lauriks likes this.

Last edited by LuckyTran; April 24, 2020 at 20:18.
LuckyTran is offline   Reply With Quote

Old   April 24, 2020, 15:43
Default
  #7
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 6
Tom Lauriks is on a distinguished road
(I've defined my function objects external to controlDict and I load them as follows:
functions
{
#include "externalFunctionObjects"
})

I was indeed placing fvOptions in either system or constant. I tried what you specified and it works! I would've never found that on my own. Thanks a lot, you've really, really, really made my day!
Tom Lauriks is offline   Reply With Quote

Old   April 24, 2020, 20:25
Default
  #8
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Great!


In general you can and should put the fvOptions stuff in its own dict in the constant or system dirs. If you had done this for any normal field (like p, T, U) chances are, it would have worked.



Your case was a bit special because your sf6 field is defined by a coded function object (it not a pre-registered fieldname).
Tom Lauriks likes this.
LuckyTran is offline   Reply With Quote

Old   July 18, 2022, 17:44
Default
  #9
New Member
 
TX
Join Date: May 2020
Posts: 3
Rep Power: 5
SHANRU is on a distinguished road
In my case, the fvOption was missed in thee equation.

Quote:
Originally Posted by Tom Lauriks View Post
Hi Foamers,


I’m performing an atmospheric boundary layer simulation with OpenFOAM v6. The domain is a cuboid. In the middle, there are 2 buildings. In between the buildings at the ground level, a passive scalar should be released from 4 volumes, collectively known as source1, this at a fixed mass flow rate. These volumes are created via topoSet as a cellSet and are indeed present (verified in paraFoam).



I used the simpleFoam solver and added the scalar transport as a function object of type scalarTransport. The field has the name sf6. When I specify a concentration at the inlet, sf6 is calculated. When I specify concentration 0 at the inlet and a scalarSemiImplicitSource in fvOptions, in the log file I get the line “Source scalarSource defined for field sf6 but never used”. I checked the scalarTransport.C file and the source term is present in the equation: fvScalarMatrix sEqn ( fvm::ddt(rho, s_) + fvm::div(phi, s_, divScheme) - fvm::laplacian(D, s_, laplacianScheme) == fvOptions_(rho, s_) );



What I found so far on the forum isn’t helping. Does anyone have an idea how to solve this issue?



The semiImplicitSource is defined in fvOptions as follows:


Code:
scalarSource//name
 {
 
 
     type            scalarSemiImplicitSource;
     active          true;//Usable with any type
 
 
 
 
     scalarSemiImplicitSourceCoeffs
     {
 
 
 //        timeStart       0;//Usable with any type
 //        duration        1e6;//Usable with any type
         selectionMode   cellSet;// all, cellSet, points, cellZone  
         cellSet       source1;//Name of cell set or cell zone
 
 
 
 
         volumeMode    absolute; //absolute <quantity>; specific <quantity>/m^3
         injectionRateSuSp  
         {
             sf6      (10.0 0.0); //keyword is field name. 1st value is explicit value, 2nd implicit coefficient.   
                              //Units: [M T-1], where these units should probably be consistent with time and mass used in other the simulation settings
                              //CODASC case: source strength is 10 g s-1
         }
 
 
 
 
     }
 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }p { margin-bottom: 0.1in; line-height: 115%; orphans: 2; widows: 2 } a.western:visited { so-language: en-GB } a.cjk:visited { so-language: en-US } a.ctl:visited { so-language: ar-SA } a:link { color: #0563c1 }
SHANRU is offline   Reply With Quote

Reply

Tags
never used, scalartransport, semiimplicitsource


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
[OpenFOAM.com] swak4foam compiling issues on a cluster saj216 OpenFOAM Installation 5 January 17, 2023 16:05
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
[snappyHexMesh] Invalid Normals for source face to target face while making AMI? Sorabh OpenFOAM Meshing & Mesh Conversion 1 August 3, 2021 06:35
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


All times are GMT -4. The time now is 08:09.