|
[Sponsors] |
December 2, 2023, 17: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 09:13. |
|
December 5, 2023, 11:11 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 727
Rep Power: 14 |
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, 08: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 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? |
|
December 23, 2023, 09:36 |
|
#4 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 727
Rep Power: 14 |
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). |
|
June 23, 2024, 14:13 |
|
#5 | |
New Member
Henry
Join Date: Feb 2024
Posts: 5
Rep Power: 2 |
Quote:
Would really appreciate your help. Thanks! |
||
June 24, 2024, 09:32 |
|
#6 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 727
Rep Power: 14 |
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; } } } |
|
Tags |
dimensions, fvoptions, fvoptions heat source, openfoam 8 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] LaminarSMOKE compilation error | mdhfiz | OpenFOAM Community Contributions | 8 | July 2, 2024 10:32 |
[OpenFOAM.com] swak4foam compiling issues on a cluster | saj216 | OpenFOAM Installation | 5 | January 17, 2023 16:05 |
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 | tlcoons | OpenFOAM Installation | 13 | April 20, 2016 17:34 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 06:42 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 05:18 |