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

Howto use scalarCodedSource in fvOptions

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 18, 2013, 08:59
Default Howto use scalarCodedSource in fvOptions
  #1
New Member
 
hannes
Join Date: Mar 2013
Posts: 28
Rep Power: 3
hanness is on a distinguished road
Hi,

currently I'm struggling with setting up a volumetric source. In my case I would like to add a volumetric heat source for a given cellSet and run the simulation with the buoyantBoussinesqSimpleFoam solver, later with the respective Pimple solver.
I tried creating a fvOptions file but unfortunately I don't really know what to put where... I adapted the below code from the CodedSource.H and now my question is where can I put the source term and in which form?
Code:
mySource
{
    type            scalarCodedSource;
    active          on;
    selectionMode   cellSet;
    cellSet         myCellSet;
    rampCoeffs      {};
    scalarCodedSourceCoeffs
    {
        fieldNames      (T);
        redirectType    ramp;
        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};
        codeAddSup
        #{
            Pout<< "**codeAddSup**" << endl;
        #};
        codeSetValue
        #{
            Pout<< "**codeSetValue**" << endl;
        #};
        code
        #{
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }
}
Moreover, I see a general problem with this approach because I don't actually want to set a source for the temperature but for the heat (I know the value in terms of W/m≥) and the Boussinesq-solvers solve a T-equation and not a h/e-equation.
Does anybody have any suggestions?

Thanks a lot
Hannes
hanness is offline   Reply With Quote

Old   November 29, 2013, 07:49
Default
  #2
New Member
 
RB
Join Date: Aug 2013
Posts: 5
Rep Power: 2
rbaud is on a distinguished road
Hi Hanness,

I'm interesting in your case, do you finally work out how to tackle your problem?

(i.e volumetric "heat source" in buoyantBoussinesqSimple/PimpleFoam)

Why are you trying with a codedSource, an explicit or semi-implicit should be able to do the job, shouldn't it?

I'm currently able to add a source of "temperature", (i.e I set a value with an explicitSource and the temperature raise up in my selected region) but I'm struggling to understand which amount of heat I'm setting in my model.

Is it wrong to try to link it to a proper heat load? (as we are solving only temperature?)

I'm currently trying the same basic "testing" than in this post:
buoyantBoussinesqSimpleFoam

And it doesn't make sense. (does the source's unit is really in K/s? --> seems ok for me regarding the equation i.e homogeneous with the dT/dt)

Thanks for sharing any hints,
R
rbaud is offline   Reply With Quote

Old   December 6, 2013, 04:25
Default
  #3
New Member
 
hannes
Join Date: Mar 2013
Posts: 28
Rep Power: 3
hanness is on a distinguished road
Hi R,

Eventually I got it working. I don't know whether it is the best approach but it works for me:

Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
    selectionMode   cellZone;
    cellZone        heatSourceCells;
    scalarSemiImplicitSourceCoeffs
    {
        volumeMode      specific;
        injectionRateSuSp
        {
            T           (0.1 0); //DT = PHI''' / (rho * cp) 
        }
    }
}
Maybe my comment behind the source term might help you to calculate the correct value for DT?

Regards,
Hannes
hanness is offline   Reply With Quote

Old   December 9, 2013, 10:23
Red face volumetric heat source in TEqn, dimension understanding
  #4
New Member
 
RB
Join Date: Aug 2013
Posts: 5
Rep Power: 2
rbaud is on a distinguished road
Hi Hannes,

Many thanks for your reply,
I use the same functionality as you to get it run (well), (i.e. semiimplicitsource)

I've took the week end to sleep on it and reach the following:

I like the idea of your: Q/(rho*cp) = Ts (1)
It fits with the TEqn solved, which is, I think an energy equation divided by rho*cp, considered as constant.
With:
Ts : source of temperature (0.1 in your example).
Q : heat source
Is that correct with your notation, I try to avoid any confusion with your PHI'''.

Iím still kind of struggle with the dimension of all of this.
Based on the attached small test case (air flow in a duct with a heat source in the middle of the duct.), I get the relation:
Ts = phi*DT
With:
phi : (openfoam calculated) flow (m3/s as we have an incompressible solver)???
DT variation of temperature along the duct (K)

Coupled with the (1), it fits with the classic Q=phi*rho*cp*DT.

I could stop there and be happy but 2 questions remained:
- Which value are you using for your rho and cp, as in the transport property we don't set them explicitly but hidden under the Pr and nu. The solver probably don't use rho and cp at all, so I'm not confident with this step. (do you just use the value which fit the model environment, without any link with the model?)

- This approach leads for the Ts a dimension in m3.K/s where I think K/s is more correct, regarding the TEqn. I guess somewhere the source module link it to the volume to reduce it in K/s. ???

(Iím aware of the absolute/specific functionality, and Iíve understand what is doing in the fact but Iíve not fully understand the code), and so canít explain my dimension issue..

I hope my post is clear,
Iím probably doing a mistake somewhere or missing something, certainly trivialÖ
Thanks for any reply,
Remi
Attached Files
File Type: zip T_Source_2_velocity_duct.zip (63.0 KB, 23 views)
rbaud is offline   Reply With Quote

Old   March 20, 2014, 13:59
Default
  #5
New Member
 
Yanxiang Shi
Join Date: Mar 2012
Location: Cambridge, MA, US
Posts: 22
Rep Power: 4
yanxiang is on a distinguished road
Hi Hannes,

Thanks for the comments first of all.

It looks like "specific", instead of "absolute", is required for this to work properly. However, it is kind of confusing to me when it is named "specific" and "absolute". To me, it sounds more like "intensive" property versus "extensive" because when I calculated the source for T, I didn't really have a m^3 in the denominator.

yanxiang
yanxiang is offline   Reply With Quote

Old   May 6, 2014, 14:36
Default Volumetric heat source (W/m≥)
  #6
Member
 
Alex
Join Date: Oct 2013
Posts: 54
Rep Power: 2
zfaraday is on a distinguished road
Hello everybody!

I'm aware that this thread is maybe dead by now but I have a quick question related to what it has been said here. I hope that someone can answer me.

My case is that I have to define a volumetric heat source in chtMultiRegionSimpleFoam in a solid region defined as, say, heatSource. The approach I thought about is similar to what suggested hanness but I don't want to define a "source of temperature" (K) but a "source of heat" (W/m≥). I have tried the following fvOptions settings to do so:

Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
    selectionMode   all;

    scalarSemiImplicitSourceCoeffs
    {
        volumeMode      specific;//absolute;
        injectionRateSuSp
        {
            h           (X Y);
        }
    }
}
I have tried a few combinations of Su-Sp coefficients but I don't really understand the meaning and use of them. What values should I give to the coeffs if I want to set up a source of, for instance, 50 W/m≥?

Another question I have is if it's correct or not to use the h variable (enthalpy, if I am not wrong) to create a heat source in a solid region.

I have also made some other attempts using T instead of h but I noticed that nothing happened, like if no source existed. But, according to what I read in this topic above, it shoud have been because I used absolute mode instead of specific. Am I right?

Thanks in advance. Any suggestion or hint will be welcome!


Alex
__________________
I'm newbie in OpenFOAM's world and not an English-speaking, so if I make any mistake a correction will be welcome!
zfaraday is offline   Reply With Quote

Old   May 6, 2014, 20:33
Default
  #7
Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 73
Rep Power: 3
massive_turbulence is on a distinguished road
Quote:

My case is that I have to define a volumetric heat source in chtMultiRegionSimpleFoam in a solid region defined as, say, heatSource. The approach I thought about is similar to what suggested hanness but I don't want to define a "source of temperature" (K) but a "source of heat" (W/m≥). I have tried the following fvOptions settings to do so:
I'm almost positive this would work with the chtMultiRegionSimpleFoam using the heat flux in W/m≥.

Code:
        type            compressible::turbulentHeatFluxTemperature;
        heatSource      flux;
        q               uniform 1000;
        alphaEff        kappaEff;
        K               basicThermo;
        Cp              uniform 1000;
        value           uniform 273.5;//set initially?
        KName             K;
I'm assuming that you know the initial temperature of your entire system which means in this case it would be set to 273.5k.
massive_turbulence is offline   Reply With Quote

Old   May 7, 2014, 12:37
Default
  #8
Member
 
Alex
Join Date: Oct 2013
Posts: 54
Rep Power: 2
zfaraday is on a distinguished road
Quote:
Originally Posted by massive_turbulence View Post
I'm almost positive this would work with the chtMultiRegionSimpleFoam using the heat flux in W/m≥.
Thanks for your quick replay Andrew!

Yes, I guess it should work at least this configuration of the fvOptions file makes sense to me. But my hesitation is about the values I have to set as Su-Sp coefficients (assuming the configuration is ok) to define the heat generation (for example, 50 W/m≥) inside the region.

Regards

Alex
__________________
I'm newbie in OpenFOAM's world and not an English-speaking, so if I make any mistake a correction will be welcome!

Last edited by zfaraday; May 7, 2014 at 14:59.
zfaraday is offline   Reply With Quote

Reply

Tags
fvoptions, heat source, scalarcodedsource

Thread Tools
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 On
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 5 April 30, 2014 06:19
Building a solver with fixedTemperatureConstraint using fvOptions Fluido OpenFOAM Programming & Development 8 February 14, 2014 06:25
How to set fvOptions yurifrey OpenFOAM Pre-Processing 4 February 10, 2014 06:01
Setting BC for a passive scalar (groovy vs fvOptions) Tobi OpenFOAM Pre-Processing 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:15.