pablo_fil |
April 18, 2017 12:49 |
cellSet volume in fvOptions
Hi all!
I'll try to explain my case briefly. I want to use a vectorCodedSource fvOptions file, and two of the variables I have to use are volume of a cellSet and volume of each cell in that volume. The cellSet is an small box inside a larger box.
I'm having trouble with it as I'm not able to select JUST the cells in my cellSet.
This is my fvOptions file:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
velocitySource
{
type vectorCodedSource;
active true;
selectionMode cellSet;
cellSet selectedCells;
name velocitySource;
vectorCodedSourceCoeffs
{
fields (U);
selectionMode cellSet;
cellSet selectedCells;
name velocitySource;
codeInclude
#{
#};
codeCorrect
#{
#};
codeAddSup
#{
const scalarField& V = mesh_.V();
const vectorField& C = mesh_.C();
scalar V_ = 0.0;
forAll(C, i)
{
V_ += V[i];
}
reduce(V_, sumOp<scalar>());
Info<< indent
<< "- selected " << returnReduce(C.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << endl;
#};
codeSetValue
#{
#};
code
#{
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
velocitySourceCoeffs
{
}
}
// ************************************************************************* //
When I start the solver (simpleFoam in this case) I get the following log.
Code:
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 4.1
Exec : simpleFoam
Date : Apr 18 2017
Time : 18:31:45
Host : "pablo-K52Jr"
PID : 23352
Case : /home/pablo/misCasosFE/bloques
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create mesh for time = 0
SIMPLE: convergence criteria
field U tolerance 0.0001
field p tolerance 0.001
field "(k|epsilon|omega)" tolerance 0.001
Reading field p
Reading field U
Reading/calculating face flux field phi
Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
kOmegaSSTCoeffs
{
alphaK1 0.85;
alphaK2 1;
alphaOmega1 0.5;
alphaOmega2 0.856;
gamma1 0.55555556;
gamma2 0.44;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
a1 0.31;
b1 1;
c1 10;
F3 false;
}
No MRF models present
Creating finite volume options from "system/fvOptions"
Selecting finite volume options model type vectorCodedSource
Source: velocitySource
- selecting cells using cellSet selectedCells
- selected 90 cell(s) with volume 0.30424486
Starting time loop
Time = 1
Using dynamicCode for fvOption:: velocitySource at line 20 in "/home/pablo/misCasosFE/bloques/system/fvOptions.velocitySource.vectorCodedSourceCoeffs"
Creating new library in "dynamicCode/velocitySource/platforms/linux64GccDPInt32Opt/lib/libvelocitySource_ba8e2470764f35c431307b63ebef6c2a4b610dc8.so"
Invoking "wmake -s libso /home/pablo/misCasosFE/bloques/dynamicCode/velocitySource"
'/home/pablo/misCasosFE/bloques/dynamicCode/velocitySource/../platforms/linux64GccDPInt32Opt/lib/libvelocitySource_ba8e2470764f35c431307b63ebef6c2a4b610dc8.so' is up to date.
Selecting finite volume options model type velocitySource
Source: velocitySource
- selected 245760 cell(s) with volume 2400
smoothSolver: Solving for Ux, Initial residual = 0.99999999, Final residual = 0.00056604347, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver: Solving for Uz, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG: Solving for p, Initial residual = 1, Final residual = 0.069625931, No Iterations 4
time step continuity errors : sum local = 3.3696411e-05, global = -7.2204088e-06, cumulative = -7.2204088e-06
smoothSolver: Solving for omega, Initial residual = 0.00040862179, Final residual = 3.5476531e-07, No Iterations 1
smoothSolver: Solving for k, Initial residual = 1, Final residual = 0.00077749877, No Iterations 1
ExecutionTime = 5.03 s ClockTime = 10 s
Time = 2
- selected 245760 cell(s) with volume 2400
smoothSolver: Solving for Ux, Initial residual = 0.26881031, Final residual = 0.00013096311, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.77932555, Final residual = 0.0011502071, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.63576559, Final residual = 0.00068403217, No Iterations 1
GAMG: Solving for p, Initial residual = 0.063295736, Final residual = 0.0031233036, No Iterations 4
time step continuity errors : sum local = 8.1311918e-05, global = -1.6413664e-05, cumulative = -2.3634073e-05
smoothSolver: Solving for omega, Initial residual = 0.0009977819, Final residual = 1.9905606e-06, No Iterations 1
smoothSolver: Solving for k, Initial residual = 0.26501268, Final residual = 0.00026149791, No Iterations 1
ExecutionTime = 7.15 s ClockTime = 12 s
As you can see, I select 90 cell(s) with volume 0.30424486, but my fvOptions file gives me 245760 cell(s) with volume 2400, wich is wrong. But, the last values match the whole domains cell number and volume.
I think my error is in the C cell selection, but I'm quite lost. I've read all the documentation available as well as every single post here.
Could someone help me please?:)
|