|
[Sponsors] |
when should the cellVolume multiply a source term expression? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 12, 2024, 13:31 |
when should the cellVolume multiply a source term expression?
|
#1 |
Member
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3 |
Good day community,
I have seen implementations of fvOptions in OpenFOAM ESI, for scalarFields (TKE, epsilon, omega...) and vectorFields (U), where the theorethical expressions of the source terms we want to apply, there is no addition of product with cell volume, BUT, some solutions (files of source termns) from some users of CFD Online forum, they do consider to add the product of the cell volume to the theorethical expression. For example, lets say in our code we define: const scalarField& cellsV = mesh().V(); Then we make a loop over the cells of the cellSet or domain where the source term must be applied: forAll(celli : cells_) { eqn.source()[celli] = TheorethicalFormula * cellV[celli]; } There are ocassions where 'formula' is defined explicitly, and sometimes implicitly, and it is itself ONLY. Some coded sources I've seen in this blog (made by users), they add the volume of the cell just like the code I pasted above.... So, when would you recommend to consider or not cellV? maybe does it depend of the type of field we are handling with? Big thanks for any info, |
|
September 13, 2024, 13:06 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 745
Rep Power: 14 |
Correct - it's just for ease of use. Sometimes you know that you want to apply a total amount of the variable into the source cells, and you will use an absolute amount (e.g. 100W for the whole source). Sometimes the value you want to apply is the per-volume amount (e.g. 20W/m3).
Note that the two approaches are identical, since if you supply a total (absolute) source amount, rather than a specific (per-volume) amount, the code just calculates the per-volume amount anyway and uses that. For example, in https://cpp.openfoam.org/v8/semiImpl...8C_source.html we have: Code:
// Explicit source function for the field UIndirectList<Type>(Su, cells_) = fieldSu_[fieldi].value<Type>(t)/VDash_; .... // Implicit source function for the field UIndirectList<scalar>(Sp, cells_) = fieldSp_[fieldi].value(t)/VDash_; Code:
Foam::fv::semiImplicitSource::semiImplicitSource ( const word& name, const word& modelType, const dictionary& dict, const fvMesh& mesh ) : cellSetOption(name, modelType, dict, mesh), volumeMode_(volumeMode::absolute), VDash_(1) { read(dict); } Code:
// Set volume normalisation if (volumeMode_ == volumeMode::absolute) { VDash_ = V_; } |
|
Tags |
fvoption, openfoam, source terms |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Tabulated thermophysicalProperties library | chriss85 | OpenFOAM Community Contributions | 62 | October 2, 2022 04:50 |
[Other] How to use finite area method in official OpenFOAM 2.2.0? | Detian Liu | OpenFOAM Meshing & Mesh Conversion | 4 | November 3, 2015 04:04 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 11:59 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |