CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Howto use scalarCodedSource in fvOptions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree37Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2015, 17:07
Default
  #21
New Member
 
Join Date: Nov 2014
Posts: 3
Rep Power: 11
EnricoA is on a distinguished road
Hello alexeym,

I am trying to implement a source term for turbulent dissipation in a simulation using the standard k-epsilon model following your explanation about the scalarCodedSource. I ended up with this fvOptions file (where there is also a source for the momentum equation):

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


momentumSource
{
    type            vectorSemiImplicitSource;
    selectionMode   cellZone;
    cellZone        disk;
    active          true;

    vectorSemiImplicitSourceCoeffs
    {
        volumeMode      absolute;
        injectionRateSuSp
        {
            U           ((0 0 -180e3) 0);
        }
    }
}

dissipationSource
{
    type            scalarCodedSource;
    selectionMode   cellZone;
    cellZone        disk;
    active          true;

    scalarCodedSourceCoeffs
    {
        fieldNames      (epsilon);
        redirectType    sourceTime;

        codeInclude
        #{

        #};

        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
            const Time& time = mesh().time();
            const scalarField& V = mesh_.V();
            const vectorField& C = mesh_.C();
            const scalarField& nut_ = nut();
            const vectorField& U_ = U();
            const scalarField& k_ = k();
            const scalarField& Pt = nut_*2*magSqr(symm(fvc::grad(U_)));
            scalarField& epsilonSource = eqn.source();
            forAll(C, i)
            {
                epsilonSource[i] -= 0.37*Pt[i]*Pt[i]/k_[i]*V[i];
            }
            Pout << "***codeAddSup***" << endl;
        #};

        codeSetValue
        #{
                Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }

    sourceTimeCoeffs
    {
        // Dummy entry
    }
}

// ************************************************************************* //
Apparently there are some mistakes in my file which I cannot find, because when I run the simulation the output is:

Code:
--> FOAM Warning : 
From function void option::checkApplied() const
in file fvOptions/fvOption.C at line 368
Source dissipationSource defined for field epsilon but never used
Do you have any advises to give me?

Thanks
LidaSa likes this.
EnricoA is offline   Reply With Quote

Old   April 1, 2015, 01:50
Default
  #22
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

My advice: implement your own turbulence model I.e. you take k-epsilon family model, copy it, rename it, add your code.

There are certain conditions for fvOptions to work, see, for example, UEqn.H of pimpleFoam:

Code:
tmp<fvVectorMatrix> UEqn
(
    fvm::ddt(U)
  + fvm::div(phi, U)
  + turbulence->divDevReff(U)
 ==
    fvOptions(U)
);

UEqn().relax();

fvOptions.constrain(UEqn());
See all these calls to fvOptions. Now if you look at kEpsilon.C, there are no such calls.

During last workshop there was an idea of implementation of turbulence models, which use fvOptions framework. I do not know if there is any progress, for me it is still on TODO list.
alexeym is offline   Reply With Quote

Old   April 28, 2015, 05:36
Default fvOptions heatsource in chtmultiregionsimpleFoam case in openfoam2.3.x
  #23
New Member
 
Sandeep Rapol
Join Date: Feb 2015
Posts: 11
Rep Power: 11
sandeeprapol is on a distinguished road
Hello everyone
I am implementing volumetric heat source in chtmultiregionsimplefoam with help of fvoptions files
in that "duration ....." and " h(.... 0)" so my problem is

1) how to convert 200 W source into enthalpy h(... 0) with help of "duration ...." in sec
2) in that "fvOptions" file "duration..." so which time put here in duration
sandeeprapol is offline   Reply With Quote

Old   April 28, 2015, 05:49
Default
  #24
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Quote:
Originally Posted by sandeeprapol View Post
Hello everyone
I am implementing volumetric heat source in chtmultiregionsimplefoam with help of fvoptions files
in that "duration ....." and " h(.... 0)" so my problem is

1) how to convert 200 W source into enthalpy h(... 0) with help of "duration ...." in sec
2) in that "fvOptions" file "duration..." so which time put here in duration
Hello Sandeep!

1) You don't need to convert nothing into nothing. For the case of using chtMultiRegionSimpleFoam you just have to put the thermal power value into the first place within the brackets, like that:
Code:
energySource
{
    type            scalarSemiImplicitSource;
    active          true;
    selectionMode   all;

    scalarSemiImplicitSourceCoeffs
    {
        volumeMode      absolute;//specific;//
        injectionRateSuSp
        {
            h           (q 0); //   q in [W]; or in [W/m] if you use specific mode
        }
    }
}
2) Never used the duration field (I don't even know wether it exist) as you can see in the piece of code above.

Hope it helps.

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 28, 2015, 06:03
Default
  #25
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
@faraday

Quote:
Originally Posted by zfaraday View Post
2) Never used the duration field (I don't even know wether it exist) as you can see in the piece of code above.
In fact the field comes from base abstract fvOption and defines duration of time the option is active:

Code:
inline bool Foam::fv::option::inTimeLimits(const scalar time) const
{
    return
    (
        (timeStart_ < 0)
     ||
        (
            (mesh_.time().value() >= timeStart_)
         && (mesh_.time().value() <= (timeStart_ + duration_))
        )
    );
}
Code:
bool Foam::fv::option::isActive()
{
    if (active_ && inTimeLimits(mesh_.time().value()))
    {
        ---
        return true;
    }
    else
    {
        return false;
    }
}
zfaraday likes this.
alexeym is offline   Reply With Quote

Old   April 28, 2015, 06:10
Default
  #26
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Thanks for the clarification Alexey! I didn't remember that because I never had to specify the duration of the source.

Everything must be clear now for @Sandeep.
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 28, 2015, 07:42
Default fvOptions heatsource in chtmultiregionsimpleFoam case in openfoam2.3.x
  #27
New Member
 
Sandeep Rapol
Join Date: Feb 2015
Posts: 11
Rep Power: 11
sandeeprapol is on a distinguished road
hello alex,
thank you for the replay , I used that syntax in fvOptions file but result showing no heat generation, it shows constant temperature

when I use my fvOptins that showing heat generation it include "duration....." of time
-------#---------------------------#-----------------------------#--------------------
heatSource
{
type scalarSemiImplicitSource;
active on;
timeStart 0.;
duration 1e3;
selectionMode cellSet;
cellSet IC1;

scalarSemiImplicitSourceCoeffs
{
// volumeMode absolute; // Values are given as <quantity>
volumeMode specific; // Values are given as <quantity>/m3

injectionRateSuSp // Semi-implicit source term S(x) = S_u + S_p x
{
h (200000 0);
}
}
}
--------------------#--------------------------------#-----------------------#------------------#---
am trying to implement 200 W/m3 volumetric heat generating source for circuit board cooling
raj kumar saini likes this.
sandeeprapol is offline   Reply With Quote

Old   April 28, 2015, 08:09
Default
  #28
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Well, I don't understand why my specification is not working. As per what I see you are using a cellSet as a selection mode, while I sellect all cells belonging to one region. If you just copypasted all my specification of course it's not going to work...

Another point I don't get is why you are setting a generation of 200000 when you say your generation is supposed to be of 200 W/m2... If you give a higher value than the one you need, obviously the effect will be more visual and bigger...

Regards,

Alex

Ps: excuse me if I wrote something wrong, I'm writing from my phone
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 29, 2015, 07:01
Default
  #29
New Member
 
Sandeep Rapol
Join Date: Feb 2015
Posts: 11
Rep Power: 11
sandeeprapol is on a distinguished road
hello alex,
you are on the right way you see in src/fvOptios/lninclude/fvOptionListTemplates.C
at line no 135
ds = rho.dimensions()*fld.dimensions()/dimTime*dimVolume
rho * h *1/time * vol
kg/m3 * j/kg * m3 / sec
j/s
W
so here is dimTime in sec plese tell me how to implement 200 W/m3 heat generating source
altinel likes this.
sandeeprapol is offline   Reply With Quote

Old   April 29, 2015, 07:47
Default
  #30
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
check this out!
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 30, 2015, 06:25
Default
  #31
New Member
 
Sandeep Rapol
Join Date: Feb 2015
Posts: 11
Rep Power: 11
sandeeprapol is on a distinguished road
hello alex
thank you for your humble reolay
in fvoptions
volumeMode absolute; // Values are given as <quantity>
volumeMode specific; // Values are given as <quantity>/m3
what is "absolute" and "specific"
if my heat generating element is 200 W having dimension 0.2m*0.01m*0.05m
1) if I consider "absolute" then total element given value is 200 W is this correct or not?
2) if I consider "specific" then total element each cell point given value is 200 W is this correct or not?
sandeeprapol is offline   Reply With Quote

Old   April 30, 2015, 07:40
Default
  #32
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Dear Sandeep,

the meaning of "absolute" and "specific" is given behind "//". Then, if you consider "absolute" mode you just have to give the constant source term a value of 200. On the other hand, if you prefer to use "specific" mode you have to use a value of 200/(0.2*0.01*0.05).

That's all!

Best regards,

Alex
raj kumar saini likes this.
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   May 4, 2015, 04:49
Default
  #33
New Member
 
Sandeep Rapol
Join Date: Feb 2015
Posts: 11
Rep Power: 11
sandeeprapol is on a distinguished road
thank you alex,
which parameter analyze in post processing.I thought that only temp of oullet, & velocity is analyze in chtmultiregionSimpleFoam and chtmultiRegionFoam please suggest me
sandeeprapol is offline   Reply With Quote

Old   May 11, 2015, 14:08
Default
  #34
New Member
 
Join Date: Nov 2014
Posts: 3
Rep Power: 11
EnricoA is on a distinguished road
Hi,

I would like to follow up my previous post regarding the implementation of a source term for the turbulent dissipation rate with scalarCodedSource.
I eventually implemented my own turbulence model of the k-epsilon family. This is the main modification which takes into account the possible source term:

Code:
// Dissipation equation
tmp<fvScalarMatrix> epsEqn
(
    fvm::ddt(epsilon_)
  + fvm::div(phi_, epsilon_)
  - fvm::laplacian(DepsilonEff(), epsilon_)
 ==
    C1_*G*epsilon_/k_
  - fvm::Sp(C2_*epsilon_/k_, epsilon_)
  + fvOptions(epsilon_)
);

epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, epsilonMin_);
Then I was trying to add a source of the following form in a particular region:

S = 0.37 G^2 / k

where G is the the generation of turbulent kinetic energy computed in the sandard k-epsilon model and k is the turbulent kinetic energy. In order to do this, I added the following piece of code to fvOptions:

Code:
dissipationSource
{
    type            scalarCodedSource;
    selectionMode   cellZone;
    cellZone        diss;
    active          true;

    scalarCodedSourceCoeffs
    {
        fieldNames      (epsilon);
        redirectType    sourceTime;

        codeInclude
        #{
            #include "fvCFD.H"
        #};

        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
            const scalarField& V = mesh_.V();
            const vectorField& C = mesh_.C();
            const volScalarField& nut = mesh().lookupObject<volScalarField>("nut");
            const volVectorField& U = mesh().lookupObject<volVectorField>("U");
            const volScalarField& k = mesh().lookupObject<volScalarField>("k");
            const volScalarField& G = nut*2*magSqr(symm(fvc::grad(U))); // as computed in the k-epsilon model
            scalarField& epsilonSource = eqn.source();
            forAll(C,i)
            {
                epsilonSource[i] -= 0.37*G[i]*G[i]/k[i];
            }
            Pout << "***codeAddSup***" << endl;
        #};

        codeSetValue
        #{
            Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }

    sourceTimeCoeffs
    {
        // Dummy entry
    }
}
When I run a simulation, the compilation of the dynamic library doesn't give errors but apparently there is something wrong with my implementation, since the results that I get don't match with the expected one.
Can you see any errors in the code?

Thanks
raj kumar saini likes this.
EnricoA is offline   Reply With Quote

Old   September 8, 2016, 14:40
Default
  #35
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
Dear Alex

How to set multiple discrete heat sources using scalarSemiImplicitSource ?
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   January 3, 2017, 11:24
Default what for solver using EEqn.C?
  #36
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Quote:
Originally Posted by zfaraday View Post
{
type scalarSemiImplicitSource;
active true;
selectionMode all;

scalarSemiImplicitSourceCoeffs
{
volumeMode absolute;//specific;//
injectionRateSuSp
{
h (q 0); // q in [W]; or in [W/m] if you use specific mode
}
}
}
Hi,

just a clarification for buoyantSimpleFoam.
This solver uses EEqn.C file, so you have to specify the thermal model.
In case you set the following dict for thermophysicalProperties
Code:
    {
        type heRhoThermo;
        mixture pureMixture;
        transport const;
        thermo hConst;
        equationOfState perfectGas;
        specie specie;
        energy sensibleEnthalpy;
    }
q parameter (specific) is equal to Watt only if you consider a fluid with Cp = 1kJ/(kg*K) and rho = 1 kg/m^3 as for Q= rho cp * T(1Kelvin)/1sec = 1W/m3 as h = Cp*T(1Kelvin)/1sec = 1W/kg

but if you consider a fluid with Cp = 4.186kJ/(kg*K) and rho = 1000 kg/m3, if you want to have 1W/m3 you have to set h value (q parameter [specific] ) equal to 0,000000239
Code:
 q = Q = rho*Cp*T/t ==> 1/1000/4186
is it correct?
raj kumar saini likes this.

Last edited by student666; January 3, 2017 at 12:36.
student666 is offline   Reply With Quote

Old   January 4, 2017, 17:38
Default
  #37
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
I performed this simple test case.
3D simulation.
All patches have been set to "walls"(T=293K), but patch named "fondo" has been set to zeroGradient for T.
cellZone "c0" , at the bottom (coord z=0), has 500W power source.

laminar.

simulation performed with openFoam v4.1

run
Code:
blockMesh
topoSet
renumberMesh -overwrite
buoyantPimpleFoam > log.1
when steadyness is reached, stop running and
Code:
wallHeatFlux
you may see dissipation through patch "pareti" equal to heat (absolute) source 500W in fvOptions.

Code:
Time = 2.554868161131
Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

Reading/calculating face flux field phi

Selecting turbulence model type laminar

Wall heat fluxes [W]
pareti
    convective: -497.79226
    radiative:  -0
    total:      -497.79226
fondo
    convective: 0
    radiative:  -0
    total:      0

Time = 2.9167083871732
Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

Reading/calculating face flux field phi

Selecting turbulence model type laminar

Wall heat fluxes [W]
pareti
    convective: -498.87276
    radiative:  -0
    total:      -498.87276
fondo
    convective: 0
    radiative:  -0
    total:      0

Time = 3.27661601896623
Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

Reading/calculating face flux field phi

Selecting turbulence model type laminar

Wall heat fluxes [W]
pareti
    convective: -499.42118
    radiative:  -0
    total:      -499.42118
fondo
    convective: 0
    radiative:  -0
    total:      0

End
Hope this can clarify any further doubt...mine too.

Regards.
Attached Files
File Type: zip heatSource_H20.zip (11.5 KB, 99 views)
student666 is offline   Reply With Quote

Old   February 14, 2017, 02:37
Default
  #38
New Member
 
Join Date: Dec 2016
Posts: 10
Rep Power: 9
ChrisBa is on a distinguished road
Hello,

I'm trying to implement a volumetric source with scalarCodedSource.
At the surface the equation: q=q0 * e^(re^2/r^2)
In the depth the value q0 is described with functions.

I'm using Openfoam 4.1 and the solver buoyantBoussinesqSimpleFoam.

After calling the function I get this:
Code:
Creating finite volume options from "constant/fvOptions"



--> FOAM FATAL ERROR: 
Attempt to return primitive entry ITstream : /home/cfd/OpenFOAM/cfd-4.1/run/elektronen/constant/fvOptions.heatSource.scalarCodedSourceCoeffs.codeInclude, line 31, IOstream: Version 2.0, format ASCII, line 0, OPENED, GOOD
    primitiveEntry 'codeInclude' comprises 
        on line 31 the verbatim string "\
           \
        "
 as a sub-dictionary

    From function virtual const Foam::dictionary& Foam::primitiveEntry::dict() const
    in file db/dictionary/primitiveEntry/primitiveEntry.C at line 189.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::primitiveEntry::dict() const at primitiveEntry.C:?
#3  Foam::dictionary::substituteScopedKeyword(Foam::word const&) at ??:?
#4  Foam::entry::New(Foam::dictionary&, Foam::Istream&) at ??:?
#5  Foam::dictionary::read(Foam::Istream&, bool) at ??:?
#6  Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#7  Foam::dictionaryEntry::dictionaryEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#8  Foam::entry::New(Foam::dictionary&, Foam::Istream&) at ??:?
#9  Foam::dictionary::read(Foam::Istream&, bool) at ??:?
#10  Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#11  Foam::dictionaryEntry::dictionaryEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#12  Foam::entry::New(Foam::dictionary&, Foam::Istream&) at ??:?
#13  Foam::dictionary::read(Foam::Istream&, bool) at ??:?
#14  Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#15  Foam::dictionaryEntry::dictionaryEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#16  Foam::entry::New(Foam::dictionary&, Foam::Istream&) at ??:?
#17  Foam::dictionary::read(Foam::Istream&, bool) at ??:?
#18  Foam::operator>>(Foam::Istream&, Foam::dictionary&) at ??:?
#19  Foam::IOdictionary::readFile(bool) at ??:?
#20  Foam::IOdictionary::IOdictionary(Foam::IOobject const&) at ??:?
#21  Foam::fv::options::options(Foam::fvMesh const&) at ??:?
#22  Foam::fv::options::New(Foam::fvMesh const&) at ??:?
#23  ? at ??:?
#24  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#25  ? at ??:?
Abgebrochen (Speicherabzug geschrieben)

My fvOption-file looks like this:

Code:
heatSource
{
    type            scalarCodedSource;

    active          true;
    selectionMode   all;

    scalarCodedSourceCoeffs
    {
        fieldNames      (T);
        name            sourceTime;

        codeInclude
        #{
           
        #};

        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
            scalarField& TSource = eqn.source();


            //Values for checking the equations
            const scalar power = 1000;
            const scalar Radius = 0.5;
            const scalar rho = 1000;
            const scalar Cp = 4.19;
            const scalar xCenter = 3;
            const scalar yCenter = 0.01;
            const scalar zCenter = 2;             
            
            // Equations 

            // -Face centers
            const List<point>& cf = p.Cf();
            const scalar xCF = cf[c][0];
            const scalar XF = xCenter - xCF;
            const scalar check+ = xCenter + Radius; 
            const scalar check- = xCenter - Radius;

            if ((xCF < check+) && (xCF > check-))
            {
                const scalar r2 = XF * XF; 
                const scalar re2 = Radius * Radius; 
                const scalar factor = r2/re2; 
                const scalar pre = exp(factor); 
                const scalar qfa_ [c] = power * exp;
                const scalar TzuF_ [c] = (1/(rho*Cp))*qfa   
            }
            else 
            {
                const scalar qfa_ [c] = 0;
            };
            
            // -Depth centers or cell centers
            
            
            
            
            
                       
         

            TSource -= Tzuf; 
            Pout << "***codeAddSup***" << endl;

        #};
 
        codeSetValue
        #{
            Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        {
           $codeInclude
           $codeCorrect
           $codeAddSup
           $codeSetValue
        };
    }

    sourceTimeCoeffs
    {
        // Dummy entry
    }
}
Maybe somebody can help me.

regards
Chris
ChrisBa is offline   Reply With Quote

Old   February 14, 2017, 04:53
Default
  #39
Member
 
hannes
Join Date: Mar 2013
Posts: 47
Rep Power: 13
hanness is on a distinguished road
Hi Chris,

I'm not too much into the scalarCodedSource fvOptions but just by looking at the error message it tells you that on line 31 of your code something is going wrong. More precisely it is in the section codeInclude (I suppose that is line 31 when looking at the entiere fvOptions file including its header.
This section supposedly must be filled and cannot be left blank. As I'm not familiar with this tool I can't help you any further but maybe it helps.
Regards
Hannes
hanness is offline   Reply With Quote

Old   February 14, 2017, 05:42
Default
  #40
New Member
 
Join Date: Dec 2016
Posts: 10
Rep Power: 9
ChrisBa is on a distinguished road
Thanks for your reply.
I look into this.
ChrisBa is offline   Reply With Quote

Reply

Tags
fvoptions, heat source, scalarcodedsource

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 2.2 fvOptions temperature limits fredo490 OpenFOAM Running, Solving & CFD 12 January 16, 2020 23:59
Building a solver with fixedTemperatureConstraint using fvOptions Fluido OpenFOAM Programming & Development 9 February 15, 2018 00:30
How to set fvOptions yurifrey OpenFOAM Pre-Processing 5 February 22, 2016 18:14
[swak4Foam] Setting BC for a passive scalar (groovy vs fvOptions) Tobi OpenFOAM Community Contributions 0 May 23, 2013 14:53
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 08:54


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