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

fvOptions source dimensions

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Tobermory
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2023, 18:47
Default fvOptions source dimensions
  #1
New Member
 
Join Date: Dec 2021
Posts: 7
Rep Power: 4
frubicle93 is on a distinguished road
I have been trying to code up some sources in fvOptions for which the dimensions either can be specified by the user or can be identified from the PDE in which the term appears. Having dug into semiImplicitSource, it appears that the dimension of the source term is coded to be dimensions(field)/[seconds] where field is being solved for. This quite strongly constrains the way in which a PDE using fvOptions can be written. Taking a temperature/energy equation as an example, we are able to use it in the following ways:
Code:
   fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
   ==
   fvOptions(T)
(taken from ScalarTransportFoam) or
Code:
   rho*cp*fvm::ddt(T)
+ rho*cp*fvc::div(phi,T)
- fvm::laplacian(kappa, T)
   ==
   rho*cp*fvOptions(T)
which is another scaling of the energy equation. The dimensions of fvOptions(T) is [Kelvins]/[seconds]. To ensure the second equation is dimensionally consistent, the fvOptions term has to be multiplied by fvOptions(T). However, I cannot write:
Code:
   rho*cp*fvm::ddt(T)
+ rho*cp*fvc::div(phi,T)
- fvm::laplacian(kappa, T)
   ==
   fvOptions(T)
Because of this, whenever I want to use fvOptions to specify a heat source term (with semiImplicitSource), the value I need to put in the fvOptions dictionary is the absolute/specific heat source value in W or W/m^3 divided by rho*cp (density * specific heat capacity).

My question is whether I have missed a way already implemented in OF to change the dimensions of the source term without multiplying it by a dimensioned scalar? If not, has anyone managed to change the dimensions of the source term by modifying the source code? I believe it cannot be done by simply modifying semiImplicitSource, as the dimensionality appears to be fixed deeper in fvOptions.

Last edited by frubicle93; December 3, 2023 at 10:13.
frubicle93 is offline   Reply With Quote

Old   December 5, 2023, 12:11
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
I think you are right in your conclusion - the "source term" is literally that - adding, at the most basic level, a source term to the matrix equation, and so its dimensions are set by the dimension of the variable that the equation is solving, time and maybe also volume if you set the volume flag for the source.

If you want to add your heat source as a power, ie in W or W/m3, then you need to frame the equation in terms of energy (e or h) instead of temperature.

Or, you could try write a whole new source term class structure to duplicate the existing structure and allow for more "flexibility" ... but I suspect that might be more trouble than it's worth.
Tobermory is offline   Reply With Quote

Old   December 23, 2023, 09:11
Default
  #3
New Member
 
Dimitris
Join Date: Nov 2023
Posts: 3
Rep Power: 2
kazamiac is on a distinguished road
Hello Tobermory,
I have a rather relevant question, just for verification. I am currently experimenting with the chtMultiRegionFoam solver. I am applying a semiImplicitSource through fvModels on a solid heater region. Specifically, I want to apply a heat source of constant 100W. I am attaching my fvModels and fvSolution for the heater region.

fvSolution:
solvers
{
e
{
solver GAMG;
smoother symGaussSeidel;
tolerance 1e-6;
relTol 0.1;
}

eFinal
{
$e;
relTol 0;
}
}

PIMPLE
{
nNonOrthogonalCorrectors 0;
}



fvModels:
energySource
{
type semiImplicitSource;
active true;
semiImplicitSourceCoeffs
{
selectionMode all;
volumeMode absolute;
sources
{
e
{
explicit 100;
implicit 0;
}
}
}
}

Based on the fvSolution file, the energy equation of the solver is calculating the internal energy, e. By adding the "explicit 100", does it mean that it reads 100W of power, or do i need to make any dimensions' conversions?
kazamiac is offline   Reply With Quote

Old   December 23, 2023, 10:36
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
To answer this, start by checking out the energy equation for the solver, https://cpp.openfoam.org/v8/heatTran...8H_source.html. The fvMatrix equation is:

Code:
 
     fvScalarMatrix EEqn
     (
         fvm::ddt(rho, he) + fvm::div(phi, he)
       + fvc::ddt(rho, K) + fvc::div(phi, K)
       + (
             he.name() == "e"
           ? fvc::div
             (
                 fvc::absolute(phi/fvc::interpolate(rho), U),
                 p,
                 "div(phiv,p)"
             )
           : -dpdt
         )
       + thermophysicalTransport.divq(he)
      ==
         rho*(U&g)
       + rad.Sh(thermo, he)
       + reaction.Qdot()
       + fvOptions(rho, he)
     );
and so the dimensions for the equation, and therefore for the source, is rho*e/time (as can be seen from the first term), which has dimensions of (kg/m3)*(m2/s2)/(s), i.e. (kg/m/s3) or W/m3. Now, since you have selected "volumeMode absolute", then the units of the src will be this times volume, i.e. W.

And so, yes indeed - this will apply 100W over the selected volume (which is "all" here, i.e. the entire domain; use something like cellSet to focus it on just a sub volume).
ibitscholar likes this.
Tobermory is offline   Reply With Quote

Old   June 23, 2024, 15:13
Default
  #5
New Member
 
Henry
Join Date: Feb 2024
Posts: 5
Rep Power: 2
ibitscholar is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
To answer this, start by checking out the energy equation for the solver, https://cpp.openfoam.org/v8/heatTran...8H_source.html. The fvMatrix equation is:

Code:
 
     fvScalarMatrix EEqn
     (
         fvm::ddt(rho, he) + fvm::div(phi, he)
       + fvc::ddt(rho, K) + fvc::div(phi, K)
       + (
             he.name() == "e"
           ? fvc::div
             (
                 fvc::absolute(phi/fvc::interpolate(rho), U),
                 p,
                 "div(phiv,p)"
             )
           : -dpdt
         )
       + thermophysicalTransport.divq(he)
      ==
         rho*(U&g)
       + rad.Sh(thermo, he)
       + reaction.Qdot()
       + fvOptions(rho, he)
     );
and so the dimensions for the equation, and therefore for the source, is rho*e/time (as can be seen from the first term), which has dimensions of (kg/m3)*(m2/s2)/(s), i.e. (kg/m/s3) or W/m3. Now, since you have selected "volumeMode absolute", then the units of the src will be this times volume, i.e. W.

And so, yes indeed - this will apply 100W over the selected volume (which is "all" here, i.e. the entire domain; use something like cellSet to focus it on just a sub volume).
Hi Tobermory - I know I'm months late to the discussion, however, I am having similar issue trying to configure fvOption to take a csv/text file for the heat source for each time step for my selected cellSet. I was wondering if there is a way to configure fvOption for this?
Would really appreciate your help. Thanks!
ibitscholar is offline   Reply With Quote

Old   June 24, 2024, 10:32
Default
  #6
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
Heya Henry. If I understand you correctly, you want to apply a time-varying source, using data from a CSV file? I haven't tried that, but can I suggest a simpler route that will work - use a table entry. See the following example from one of my cases:

Code:
furnacePower    111700.0;
rampStart       200;
rampEnd         500;

heatSource
{
    type                 semiImplicitSource;
    active               true ;
    selectionMode   cellSet;
    cellSet              furnace;
    volumeMode     absolute;
    sources
    {
        e
        {
            explicit        table ( 
                                ( 0 0 )
                                ( $rampStart 0 )
                                ( $rampEnd  $furnacePower ) 
                                ( 1000000   $furnacePower ) 
                            );
            implicit        0;
        }
    }
}
Just use excel to edit the lines of your csv file to the right format for the table entry lines, and insert.
ibitscholar likes this.
Tobermory is offline   Reply With Quote

Reply

Tags
dimensions, fvoptions, fvoptions heat source, openfoam 8


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
[openSmoke] LaminarSMOKE compilation error mdhfiz OpenFOAM Community Contributions 8 July 2, 2024 11:32
[OpenFOAM.com] swak4foam compiling issues on a cluster saj216 OpenFOAM Installation 5 January 17, 2023 17:05
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18


All times are GMT -4. The time now is 16:22.