View Issue Details

IDProjectCategoryView StatusLast Update
0003728OpenFOAMBugpublic2021-09-16 21:54
Reporterhussam Assigned Tohenry  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version15.04
Product Versiondev 
Summary0003728: If multiple meanVelocityForce entries are specified in cellZones only the first entry will be considered..
Descriptionif there are multiple entries of type meanVelocityForce on different cellZones within a region, only the first entry will be handled. All further entries will be neglected, at least according to the log file.
Steps To ReproduceUse the tutorial channel395 and replace fvConstraints and controlDict with the files in attachments. Additionally use attached topoSetDict to create the cellZones. for automated workflow you can use the attached Allrun and Allclean. By checking log.pimpleFoam it turned out the only first entry will be considered:
 
..
smoothSolver: Solving for Uz, Initial residual = 0.760481, Final residual = 8.02892e-06, No Iterations 4
Pressure gradient source: uncorrected Ubar = 0.177755, pressure gradient = 0.514522
GAMG: Solving for p, Initial residual = 0.181495, Final residual = 0.00635363, No Iterations 3

..
Additional Informationthe problem occured by openfoam 9 and openfoam dev. Same problem does not appear for openfoam 7 or openfoam 8.
same output using openfoam 8 :

..
smoothSolver: Solving for Uz, Initial residual = 0.0589522, Final residual = 9.65879e-06, No Iterations 3
Pressure gradient source: uncorrected Ubar = 0.13368, pressure gradient = 0.336155
Pressure gradient source: uncorrected Ubar = 0.133691, pressure gradient = -0.000968907
GAMG: Solving for p, Initial residual = 0.657319, Final residual = 0.0327464, No Iterations 2
..
TagsNo tags attached.

Activities

hussam

2021-09-15 22:25

reporter  

topoSetDict (1,175 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    {
        name    zone1;
        type    cellSet;
        action  new;
        source	boxToCell;
	box	(0 0 0) (0.5 2 2);

    }
    
    {
    	name	cz1;
    	type	cellZoneSet;
    	action	new;
    	source	setToCellZone;
    	set	zone1;
    }
    
    {
        name    zone2;
        type    cellSet;
        action  new;
        source  boxToCell;
	box	(2 0 0) (2.5 2 2);
        

    }
    
    {
    	name	cz2;
    	type	cellZoneSet;
    	action	new;
    	source	setToCellZone;
    	set	zone2;
    }
    
);

// ************************************************************************* //
topoSetDict (1,175 bytes)   
controlDict (1,040 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     pimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         1;

deltaT          0.2;

writeControl    timeStep;

writeInterval   200;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

functions
{
}

// ************************************************************************* //
controlDict (1,040 bytes)   
fvConstraints (965 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvConstraints;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
momentumForce1
{
    type            meanVelocityForce;
    selectionMode   cellZone;
    cellZone       cz1;
    Ubar            (0.2 0 0);
}

momentumForce2
{
    type            meanVelocityForce;
    selectionMode   cellZone;
    cellZone       cz2;
    Ubar            (0.1335 0 0);
}

// ************************************************************************* //
fvConstraints (965 bytes)   
Allrun (368 bytes)   
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# Get application directory
application=$(getApplication)

runApplication blockMesh
runApplication topoSet 

#- Run serial
runApplication $application


#------------------------------------------------------------------------------
Allrun (368 bytes)   
Allclean (177 bytes)   
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory


rm -r constant/polyMesh
rm log.*


#------------------------------------------------------------------------------
Allclean (177 bytes)   

tniemi

2021-09-16 19:45

reporter   ~0012192

It seems that in fvConstraintsTemplates.C, there is a check

constrained =
                constrained || constraint.constrain(field);

in both eqn and field constrain-functions.

If constrained is true, the "constraint.constrain(field)" is never evaluated. The first U-constraint sets constrained to true for field U and then the second call to constrain the same field will not be evaluated.

henry

2021-09-16 21:54

manager   ~0012193

Thanks for investigating Timo

Resolved in OpenFOAM-9 by commit f8d11b03103d5472d856c91903c230c1e7f07848
Resolved in OpenFOAM-dev by commit 102149135e74805e24ed144217a8fdb75752bb90

Issue History

Date Modified Username Field Change
2021-09-15 22:25 hussam New Issue
2021-09-15 22:25 hussam File Added: topoSetDict
2021-09-15 22:25 hussam File Added: controlDict
2021-09-15 22:25 hussam File Added: fvConstraints
2021-09-15 22:25 hussam File Added: Allrun
2021-09-15 22:25 hussam File Added: Allclean
2021-09-16 19:45 tniemi Note Added: 0012192
2021-09-16 21:54 henry Assigned To => henry
2021-09-16 21:54 henry Status new => resolved
2021-09-16 21:54 henry Resolution open => fixed
2021-09-16 21:54 henry Fixed in Version => 9
2021-09-16 21:54 henry Note Added: 0012193