|
[Sponsors] |
June 25, 2022, 09:37 |
passive scalar
|
#1 |
Member
Junting Chen
Join Date: Feb 2016
Location: Ontario Canada
Posts: 38
Rep Power: 10 |
Hello, I am wondering if anyone has help me on this issue.
I am trying to use scalarCodedSource to inject some particles in the domain and transport these particles in a transient simulation. The issue I'm experiencing is the selectionMode setting (cellSet) in scalarCodedSourceCoeffs does not allow me to only apply the source to selected cell set. When using mesh.C() or mesh.V(), the entire mesh got selected. Code:
nox_01 { type scalarTransport; libs ("libsolverFunctionObjects.so"); field nox; D 1e-5; log no; writeControl writeTime; fvOptions { noxSource { type scalarCodedSource; name noxSource; scalarCodedSourceCoeffs { selectionMode cellSet; cellSet nox; fields (nox); name noxSource; codeInclude #{ #include "OFstream.H" #include "fvMesh.H" #include "fvMatrices.H" #include "DimensionedField.H" #include "fvm.H" #}; codeCorrect #{ //Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ const Time& time = mesh().time(); const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); scalarField& heSource = eqn.source(); Pout<<V.size(); forAll(C, i) { heSource[i] += 10; }; #}; codeConstrain #{ //Pout<< "**codeConstrain**" << endl; #}; } } } } Im also uploading my test case here if anyone wants to do a test run. |
|
June 25, 2022, 11:42 |
|
#2 |
Member
Junting Chen
Join Date: Feb 2016
Location: Ontario Canada
Posts: 38
Rep Power: 10 |
I guess the only way to select cells is still using cellZone like this...
Code:
const label zoneID = mesh_.cellZones().findZoneID("nox"); const cellZone& zone = mesh_.cellZones()[zoneID]; const cellZoneMesh& zoneMesh = zone.zoneMesh(); const labelList& cellsZone = zoneMesh[zoneID]; volScalarField Flg_ ( IOobject ( "Flg_", mesh_.time().timeName(), mesh_ ), mesh_, dimensionedScalar("Flg_", dimensionSet(0,0,-1,0,0,0,0), 0.0) ); forAll(cellsZone, cI) { Flg_[cellsZone[cI]] += 1.0 * 10; } eqn += Flg_; Last edited by chen112p; June 25, 2022 at 12:44. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Peng Robinson Equation of state | shock77 | OpenFOAM Running, Solving & CFD | 0 | November 18, 2021 05:48 |
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' | muth | OpenFOAM Running, Solving & CFD | 3 | August 27, 2018 05:18 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
Diverging solution in transonicMRFDyMFoam | tsalter | OpenFOAM Running, Solving & CFD | 30 | July 7, 2014 07:20 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |