View Issue Details

IDProjectCategoryView StatusLast Update
0003804OpenFOAMBugpublic2022-02-15 18:31
ReporterMOGZ Assigned Tohenry  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version16.04
Summary0003804: problem with source term using fvOptions
DescriptionI used codedSource in fvOptions to add a volumic force in a specific position using points, the code function without problem but the force is applied into the entire domain not in the selectedCell only

this is the code:
volumicForce
{
type vectorCodedSource;
active true;
name volumicForce;
vectorCodedSourceCoeffs
{
selectionMode points;
   points
     (
          (0 0 0)
     );

fields (U);
fieldNames (U);

codeInclude
#{
#};

codeCorrect
#{
Pout<< "**CorrectCode**" << endl;
#};

codeAddSup
#{
const scalarField&V = mesh_.V();
vectorField& FSource = eqn.source();
const vectorField& C = mesh_.C();
vectorField F(mesh_.nCells(), vector(0, 0, 0.8)); // declare F
scalarField rho2(mesh_.nCells(), scalar(1000.0)); //declare rho2...
Info<<"eqn dimension "<<eqn.dimensions()<<nl; // to check the dimesnsions
                     forAll(C, i)
        {
              FSource[i] += F[i]/rho2[i];
        }
#};
codeSetValue
#{
Pout<< "**codeSetValue**" << endl;
#};
coded
#{
$codeInclude
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
volumicForceCoeffs
{
selectionMode all;
}
}

the cell is selected only in the iteration 0
Create mesh for time = 0

SIMPLE: convergence criteria
    field p tolerance 1e-06
    field U tolerance 1e-06
    field "(k|epsilon|omega|f|v2)" tolerance 0.001

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar
No MRF models present

Creating finite volume options from "constant/fvOptions"

Selecting finite volume options model type vectorCodedSource
    Source: volumicForce
    - selecting cells using points
    - selected 1 cell(s) with volume 4.212e-10

Starting time loop

Time = 1

Using dynamicCode for fvOption:: volumicForce at line 28 in "/home/mounaa/openFoam/Mouna/casLaminaireOpenFoam5Re350copy/constant/fvOptions.volumicForce.vectorCodedSourceCoeffs"
Selecting finite volume options model type volumicForce
    Source: volumicForce
eqn dimension [0 4 -2 0 0 0 0]
smoothSolver: Solving for Ux, Initial residual = 9.13317e-08, Final residual = 6.76336e-09, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 9.06367e-08, Final residual = 6.54825e-09, No Iterations 2
smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 0.0971097, No Iterations 11
**CorrectCode**
GAMG: Solving for p, Initial residual = 1, Final residual = 0.0279113, No Iterations 1000
time step continuity errors : sum local = 0.680353, global = -0.0836666, cumulative = -0.0836666
**CorrectCode**
ExecutionTime = 35.08 s ClockTime = 37 s

Time = 2

eqn dimension [0 4 -2 0 0 0 0]
smoothSolver: Solving for Ux, Initial residual = 0.814561, Final residual = 0.0641193, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 0.814696, Final residual = 0.064389, No Iterations 2
smoothSolver: Solving for Uz, Initial residual = 0.271216, Final residual = 0.0213594, No Iterations 3
**CorrectCode**
GAMG: Solving for p, Initial residual = 0.362467, Final residual = 0.00361601, No Iterations 844
time step continuity errors : sum local = 1.25929, global = -0.109627, cumulative = -0.193293
**CorrectCode**
ExecutionTime = 58.67 s ClockTime = 60 s
TagsNo tags attached.

Activities

henry

2022-02-15 18:31

manager   ~0012479

User support request

Issue History

Date Modified Username Field Change
2022-02-15 18:09 MOGZ New Issue
2022-02-15 18:31 henry Assigned To => henry
2022-02-15 18:31 henry Status new => closed
2022-02-15 18:31 henry Resolution open => fixed
2022-02-15 18:31 henry Note Added: 0012479