View Issue Details

IDProjectCategoryView StatusLast Update
0003623OpenFOAMFeaturepublic2021-02-09 09:59
Reporterjp Assigned Tohenry  
PrioritylowSeverityfeatureReproducibilityalways
Status closedResolutionunable to reproduce 
PlatformGNU/LinuxOSUbuntuOS Version20.04
Summary0003623: Scale factor for surface field without additional operation
DescriptionA surfaceFieldValue can be used to compute fluxes of fields through a patch.
Special operations can be performed on the patch: sum, average, max, areaIntegrate and "none", among others.
An optional additional parameter may be provided to scale the result, for example, to change units or account for different depth in a 2D model.
If an operation, like "sum" is performed, the user can apply a scaleFactor on the result.
If the operation "none" is selected, no scaling is applied by the software (which sounds reasonable).
However, the user may only be interested in scaling the result (without performing any kind of reduction like max, sum, etc.).
A reasonable workaround would be to include a dummy operation "scale", that would allow for the scaling operation without any additional reduction operation.

The scaling operation is guarded by:
if (operation_ != operationType::none)
Steps To ReproduceAdd the following to the control dict, scales the result:

movingWallPatch
{
    type surfaceFieldValue;
    libs ("libfieldFunctionObjects.so");

    log true;
    writeControl writeTime;
    writeFields true;

    regionType patch;
    name movingWall;

    operation areaAverage;
    scaleFactor 2;

    fields
    (
        p
        phi
        U
    );
}

but this does not:
movingWallPatch
{
    type surfaceFieldValue;
    libs ("libfieldFunctionObjects.so");

    log true;
    writeControl writeTime;
    writeFields true;

    regionType patch;
    name movingWall;

    operation none;
    scaleFactor 2;

    fields
    (
        p
        phi
        U
    );
}
Additional InformationAdd a new "scale" or "scaleOnly" operation on line 226 of surfaceFieldValue.H.

In this way, no additional operation will be performed on the switch of processSameTypeValues() in surfaceFieldValueTemplates.C for this case, but as (operation_ != operationType::none) in line 366 of surfaceFieldValueTemplates.C, the operation: values *= scaleFactor_; will be executed.
TagsNo tags attached.

Activities

will

2021-02-05 13:41

manager   ~0011864

What's the point of enabling the execution of `values *= scaleFactor_;` if the values aren't then going to be used to generate a result?

henry

2021-02-05 13:45

manager   ~0011865

Have you tested your proposal?

henry

2021-02-05 13:47

manager   ~0011866

With

    operation none;
    scaleFactor 2;

what "values" is scaleFactor applied to, i.e. in the statement

    values *= scaleFactor_;

what are the values?

jp

2021-02-06 04:38

reporter   ~0011867

Perhaps what I'm doing is not the most efficient way, and definitely not the best example... sorry for that!

The idea was to export the scaled data on the patch:

    example
    {
        type surfaceFieldValue;
        libs ("libfieldFunctionObjects.so");

        name outlet;
        fields (phi);
        writeFields true;
        regionType patch;
        operation none;
        scaleFactor 1000;
        surfaceFormat raw;
    }

I get the same result with:
    example
    {
        type surfaceFieldValue;
        libs ("libfieldFunctionObjects.so");

        name outlet;
        fields (phi);
        writeFields true;
        regionType patch;
        operation none;
        surfaceFormat raw;
    }

I may also want to export the results in vtk instead of raw format...

Although no condensation operation takes place, it may still be useful to be able to scale the result...

henry

2021-02-06 08:22

manager   ~0011868

Have you tested your proposal?

henry

2021-02-09 09:59

manager   ~0011871

The proposed change does not appear to work as the reporter intended and insufficient information provided.

Issue History

Date Modified Username Field Change
2021-02-05 03:09 jp New Issue
2021-02-05 13:41 will Note Added: 0011864
2021-02-05 13:45 henry Note Added: 0011865
2021-02-05 13:47 henry Note Added: 0011866
2021-02-06 04:38 jp Note Added: 0011867
2021-02-06 08:22 henry Note Added: 0011868
2021-02-09 09:59 henry Assigned To => henry
2021-02-09 09:59 henry Status new => closed
2021-02-09 09:59 henry Resolution open => unable to reproduce
2021-02-09 09:59 henry Note Added: 0011871