|
[Sponsors] | |||||
How to modify field variables using fvOptions |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
Member
Divyaprakash
Join Date: Jun 2014
Posts: 77
Rep Power: 13 ![]() |
I have a few question regarding fvOptions. My question has two parts.
PART 1: In the following code Code:
codedSource
{
...
codeAddSup // source term
#{
const labelList& cells = this->cells();
vectorField& USource = eqn.source();
for(auto cell : cells) {
USource[cell].x() = 1.0;
USource[cell].y() = 0.0;
USource[cell].z() = 0.0;
}
Info << USource << endl;
Info << eqn.source() << endl;
#};
...
}
PART 2: I also have a query below. Let's say I have modified my equation as below in mySolver.C by adding mySource, which I have also added in createFields.H Code:
fvVectorMatrix UEqn
(
fvm::ddt(U) + fvm::div(phi, U)
+ MRF.DDt(U)
+ turbulence->divDevReff(U)
+ mySource
==
fvOptions(U)
);
I tried the following but it didn't work. Code:
codedSource
{
type vectorCodedSource;
selectionMode cellSet;
cellSet box1;
fields (mySource);
name sourceTime;
codeConstrain //constrain
#{
return;
#};
codeCorrect //correct
#{
const labelList& cells = this->cells();
for(auto cell : cells)
{
fld[cell].x() = 1.0;
}
#};
" Source codedSource defined for field mySource but never use". Thank you! |
|
|
|
|
|
![]() |
| Tags |
| add source, fvoption, source |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
| Odd problem linking variables with field functions | JRosser_Purdue | STAR-CCM+ | 1 | December 12, 2022 13:31 |
| [Other] dynamicTopoFVMesh and pointDisplacement | RandomUser | OpenFOAM Meshing & Mesh Conversion | 6 | April 26, 2018 08:30 |
| potential flows, helmholtz decomposition and other stuffs | pigna | Main CFD Forum | 1 | October 26, 2017 09:34 |
| Creating new variables and modify existing eqn in porousSimpleFoam | AJAY BHANDARI | OpenFOAM Programming & Development | 3 | December 2, 2015 03:17 |