Skip to content

binField: coordinate system is read but not applied

Summary

In the binField function object, it is possible to define a coordinate system. This coordinate system seems to be read since it is printed at solver startup but the values reported in the forceBin.dat file are not updated to use this coordinate system.

Steps to reproduce

Define 2 binField functions: The first one using the case coordinate system:

binField_caseCoord
{
    type                    binField;
    libs                    (fieldFunctionObjects);
    fields                  (force);
    patches                 (motorBikeGroup);
 	
    binModel                singleDirectionUniformBin;
    decomposePatchValues    false;
    writeControl            timeStep;
	
    CofR                    (0 0 0);

    binData
    {
        nBin        10;          // output data into 20 bins
        direction   (1 0 0);     // bin direction
        cumulative  yes;
    }
}

Second one using a user specified coordinate system:

binField_customCoord
{
    type					binField;
    libs                    (fieldFunctionObjects);
    fields                  (force);
    patches                 (motorBikeGroup);
 	
    binModel		    singleDirectionUniformBin;
    decomposePatchValues    false;
    writeControl            timeStep;
	
    coordinateSystem
    {
	type        cartesian;
	origin      (0 0 0);
	rotation
	{
		type	axes;
		e1	(0.9848 0 0.1736);
		e3	(-0.1736 0 0.9848);
	}
    }
    binData
    {
        nBin        10;          // output data into 20 bins
        direction   (1 0 0);     // bin direction
        cumulative  yes;
    }
}

Both functions use a force field computed by a forces function object:

totalForces
{
    type            forces;
    libs            (forces);
    executeControl  timeStep;	
    writeControl    writeTime;
    log             yes;
    patches         (motorBikeGroup);
    CofR            (0 0 0);	
    rho             rhoInf;      // Indicates incompressible
    rhoInf          1;           // Required when rho = rhoInf
    writeFields	    yes;
}

Example case

A test case based on the motorbike tutorial is attached to reproduce the bug. motorBike_binField_bug.zip

What is the current bug behaviour?

The coordinate system seems to be properly defined according to the solver output:

forces totalForces:
    rho: rhoInf
    Freestream density (rhoInf) set to 1
    Not including porosity effects
    Fields will be written

binField binField_caseCoord:
    Activating a set of single-direction bins
    Employing 10 bins
    - cumulative    : 1
    - decomposePatchValues    : 0
    - direction     : (1 0 0)

binField binField_customCoord:
Setting co-ordinate system:
    - type          : 
    - origin        : (0 0 0)
    - e3            : (-0.173603 0 0.984816)
    - e1            : (0.984816 0 0.173603)
    Activating a set of single-direction bins
    Employing 10 bins
    - cumulative    : 1
    - decomposePatchValues    : 0
    - direction     : (1 0 0)

However, both binField functions report the exact same values in the forceBin.dat files.

What is the expected correct behavior?

forceBin.dat files should report different values, as the force field should be expressed in a different coordinate system.

Environment information

  • OpenFOAM version : v2306|v2212
  • Operating system : ubuntu | windows WSL