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

coded source nerver used

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 2, 2021, 05:43
Default coded source nerver used
  #1
Member
 
Yann Guyot
Join Date: Feb 2019
Posts: 37
Rep Power: 7
YannGuyot is on a distinguished road
Dear all,
I am writing this message since I am struggling with an issue.
I want to add steam in my buoyantsimpleFoam simulations. For this I added a scalartransport term in the controldict. I want to have the source (a specific volume in the mesh) dependent on the computed temperature T, so I used the scalarCodedSource f in the fvOptions.
No error is coming out, the problem is that the coded source term is not taken into account.
Here is the codes I used, I know the toposet defining my source volume is working fine since it is also a source term for heat and this part works fine.


output :

Code:
OAM Warning :
    From function virtual void Foam::fv::option::checkApplied() const
    in file cfdTools/general/fvOptions/fvOption.C at line 125
    Source steam defined for field H2O but never used

controlDict :

Code:
functions
{
    steam
    {
          type                 scalarTransport;
          functionObjectLibs   ("libsolverFunctionObjects.so");
          field                H2O;
          writeControl         timeStep;
          schemesField         k;
          writeInterval        1;
          resetOnStartUp       false;
          autoSchemes          true;
      }
}

fvOptions:
Code:
steam
{
    type            scalarCodedSource;
    active          yes;
    name            sourceTime;

    scalarCodedSourceCoeffs
    {
        selectionMode   cellSet;
        cellSet         Porosity;
        fields          (H2O);
        codeInclude
        #{
        #};
        codeCorrect
        #{
        #};
        codeAddSup
        #{
              const volScalarField& Tm = mesh_.lookupObject<volScalarField>("T");
              const volScalarField Tcc = Tm.mesh().C() & vector(1,1,1);
              const scalarField& V = mesh_.V();
              scalarField& H2OSource = eqn.source();
              const labelList& cellIDs = cells();
              forAll(cellIDs, i)
              {
                  label cellI = cellIDs[i];
                  H2OSource[cellI] = -0.00000245*(HEATBROILER-(0.61*HEATBROILER*(1000+20*(20-(Tm[cellI]-273.15)))/1000-(0.228/1000)*(Tm[cellI]-273.15)*(Tm[cellI]-273.15)))*DENSITY/0.3*V[cellI];
              }
        #};
        codeSetValue
        #{
        #};
    }
    sourceTimeCoeffs
    {
        $scalarCodedSourceCoeffs;
    }
}

Thank you very much for any help
Yann
YannGuyot is offline   Reply With Quote

Old   February 13, 2022, 15:43
Default same problem
  #2
New Member
 
manou mouna
Join Date: Jan 2022
Posts: 7
Rep Power: 4
Manouu is on a distinguished road
Hi Yann, I have the same problem did you solve it please???
Manouu is offline   Reply With Quote

Old   February 13, 2022, 16:52
Default
  #3
Member
 
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 8
SHUBHAM9595 is on a distinguished road
Quote:
Originally Posted by YannGuyot View Post
Dear all,
I am writing this message since I am struggling with an issue.
I want to add steam in my buoyantsimpleFoam simulations. For this I added a scalartransport term in the controldict. I want to have the source (a specific volume in the mesh) dependent on the computed temperature T, so I used the scalarCodedSource f in the fvOptions.
No error is coming out, the problem is that the coded source term is not taken into account.
Here is the codes I used, I know the toposet defining my source volume is working fine since it is also a source term for heat and this part works fine.


output :

Code:
OAM Warning :
    From function virtual void Foam::fv::option::checkApplied() const
    in file cfdTools/general/fvOptions/fvOption.C at line 125
    Source steam defined for field H2O but never used

controlDict :

Code:
functions
{
    steam
    {
          type                 scalarTransport;
          functionObjectLibs   ("libsolverFunctionObjects.so");
          field                H2O;
          writeControl         timeStep;
          schemesField         k;
          writeInterval        1;
          resetOnStartUp       false;
          autoSchemes          true;
      }
}

fvOptions:
Code:
steam
{
    type            scalarCodedSource;
    active          yes;
    name            sourceTime;

    scalarCodedSourceCoeffs
    {
        selectionMode   cellSet;
        cellSet         Porosity;
        fields          (H2O);
        codeInclude
        #{
        #};
        codeCorrect
        #{
        #};
        codeAddSup
        #{
              const volScalarField& Tm = mesh_.lookupObject<volScalarField>("T");
              const volScalarField Tcc = Tm.mesh().C() & vector(1,1,1);
              const scalarField& V = mesh_.V();
              scalarField& H2OSource = eqn.source();
              const labelList& cellIDs = cells();
              forAll(cellIDs, i)
              {
                  label cellI = cellIDs[i];
                  H2OSource[cellI] = -0.00000245*(HEATBROILER-(0.61*HEATBROILER*(1000+20*(20-(Tm[cellI]-273.15)))/1000-(0.228/1000)*(Tm[cellI]-273.15)*(Tm[cellI]-273.15)))*DENSITY/0.3*V[cellI];
              }
        #};
        codeSetValue
        #{
        #};
    }
    sourceTimeCoeffs
    {
        $scalarCodedSourceCoeffs;
    }
}

Thank you very much for any help
Yann
Hi Yann
Have you tried
Code:
active          true;
instead of
Code:
active          yes;
Also, if you look at the syntax implementation can u try replacing
Code:
 H2OSource[cellI] = -0.00000245*(HEATBROILER-(0.61*HEATBROILER*(1000+20*(20-(Tm[cellI]-273.15)))/1000-(0.228/1000)*(Tm[cellI]-273.15)*(Tm[cellI]-273.15)))*DENSITY/0.3*V[cellI];
with
Code:
 H2OSource[cellI] += -0.00000245*(HEATBROILER-(0.61*HEATBROILER*(1000+20*(20-(Tm[cellI]-273.15)))/1000-(0.228/1000)*(Tm[cellI]-273.15)*(Tm[cellI]-273.15)))*DENSITY/0.3*V[cellI];
SHUBHAM9595 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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[OpenFOAM.com] swak4foam compiling issues on a cluster saj216 OpenFOAM Installation 5 January 17, 2023 16:05
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57


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