
[Sponsors] 
December 2, 2023, 18:47 
fvOptions source dimensions

#1 
New Member
Join Date: Dec 2021
Posts: 7
Rep Power: 4 
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) Code:
rho*cp*fvm::ddt(T) + rho*cp*fvc::div(phi,T)  fvm::laplacian(kappa, T) == rho*cp*fvOptions(T) Code:
rho*cp*fvm::ddt(T) + rho*cp*fvc::div(phi,T)  fvm::laplacian(kappa, T) == fvOptions(T) 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. 

December 5, 2023, 12:11 

#2 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 649
Rep Power: 13 
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. 

December 23, 2023, 09:11 

#3 
New Member
Dimitris
Join Date: Nov 2023
Posts: 3
Rep Power: 2 
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 1e6; 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? 

December 23, 2023, 10:36 

#4 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 649
Rep Power: 13 
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, 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). 

Tags 
dimensions, fvoptions, fvoptions heat source, openfoam 8 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[OpenFOAM.com] swak4foam compiling issues on a cluster  saj216  OpenFOAM Installation  5  January 17, 2023 17:05 
[openSmoke] LaminarSMOKE compilation error  mdhfiz  OpenFOAM Community Contributions  7  October 4, 2022 14:57 
[OpenFOAM.org] Error creating ParaView4.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 