createNonConformalCouples: Put non-conformal couple settings in a sub dictionary

Settings for the individual non-conformal couples can now be put in a
"nonConformalCouples" sub-dictionary of the
system/createNonConformalCouplesDict. For example:

    fields  no;

    nonConformalCouples // <-- new sub-dictionary
    {
        nonConformalCouple_none
        {
            patches         (nonCouple1 nonCouple2);
            transform       none;
        }

        nonConformalCouple_30deg
        {
            patches         (nonCoupleBehind nonCoupleAhead);
            transform       rotational;
            rotationAxis    (-1 0 0);
            rotationCentre  (0 0 0);
            rotationAngle   30;
        }
    }

This permits settings to be #include-d from files that themselves
contain sub-dictionaries without the utility treating those
sub-dictionaries as if they specify a non-conformal coupling. It also
makes the syntax more comparable to that of createBafflesDict.

The new "nonConformalCouples" sub-dictionary is optional, so this change
is backwards compatible. The new syntax is recommended, however, and all
examples have been changed accordingly.
This commit is contained in:
Will Bainbridge
2022-08-10 14:12:02 +01:00
parent 65b7979147
commit b1d6e64d02
5 changed files with 112 additions and 97 deletions

View File

@ -357,7 +357,10 @@ int main(int argc, char *argv[])
fields = dict.lookupOrDefault<bool>("fields", false); fields = dict.lookupOrDefault<bool>("fields", false);
forAllConstIter(dictionary, dict, iter) const dictionary& couplesDict =
dict.optionalSubDict("nonConformalCouples");
forAllConstIter(dictionary, couplesDict, iter)
{ {
if (!iter().isDict()) continue; if (!iter().isDict()) continue;

View File

@ -14,12 +14,17 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Each couple has its own entry in this file. Entries take the following form: // Whether or not to add boundary conditions for the added patch to the fields
fields no;
/* // The list of non-conformal couples to be created. Each entry in this section
// Unique name used to generate the name of the coupled patches // creates a single non-conformal coupling.
<name> nonConformalCouples
{ {
/*
// Unique name used to generate the name of the coupled patches
<name>
{
// Name of the two patches between which to create the coupling // Name of the two patches between which to create the coupling
patches (<patch1> <patch2>); patches (<patch1> <patch2>);
@ -28,42 +33,40 @@ FoamFile
// Additional transformation settings (if any) // Additional transformation settings (if any)
... ...
} }
*/ */
// Example: Create a non-conformal couple with no transformation
// Examples: nonConformalCouple_none
{
// Create a non-conformal couple with no transformation
nonConformalCouple_none
{
patches (nonCouple1 nonCouple2); patches (nonCouple1 nonCouple2);
transform none; transform none;
} }
// Create a non-conformal couple with a 30 degree rotational transformation // Example: Create a non-conformal couple with a 30 degree rotational
nonConformalCouple_30deg // transformation
{ nonConformalCouple_30deg
{
patches (nonCoupleBehind nonCoupleAhead); patches (nonCoupleBehind nonCoupleAhead);
transform rotational; transform rotational;
rotationAxis (-1 0 0); rotationAxis (-1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
rotationAngle 30; rotationAngle 30;
} }
// Create a non-conformal couple with a 2 metre translational transformation // Example: Create a non-conformal couple with a 2 metre translational
nonConformalCouple_2m // transformation
{ nonConformalCouple_2m
{
patches (nonCoupleBack nonCoupleFront); patches (nonCoupleBack nonCoupleFront);
transform translational; transform translational;
separation (0 2 0); separation (0 2 0);
}
} }
// Note that in rare cases it may be appropriate to create multiple couplings // Note that in rare cases it may be appropriate to create multiple couplings
// between the same two patches. That can be achieved with multiple entries // between the same two patches. That can be achieved with multiple entries
// with the same patches specified. See the // with the same patches specified. See the
// incompressible/pimpleFoam/RAS/impeller tutorial for an example of this. // incompressible/pimpleFoam/RAS/impeller tutorial for an example of this.
// ************************************************************************* // // ************************************************************************* //

View File

@ -16,10 +16,13 @@ FoamFile
fields true; fields true;
NCC nonConformalCouples
{ {
NCC
{
patches (nonCouple1 nonCouple2); patches (nonCouple1 nonCouple2);
transform none; transform none;
}
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -16,10 +16,13 @@ FoamFile
fields true; fields true;
NCC nonConformalCouples
{ {
NCC
{
patches (nonCouple1 nonCouple2); patches (nonCouple1 nonCouple2);
transform none; transform none;
}
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -14,56 +14,59 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nonConformalCoupleIn0 nonConformalCouples
{ {
nonConformalCoupleIn0
{
patches (nonCoupleIn1 nonCoupleIn2); patches (nonCoupleIn1 nonCoupleIn2);
transform none; transform none;
} }
nonConformalCoupleIn30 nonConformalCoupleIn30
{ {
$nonConformalCoupleIn0; $nonConformalCoupleIn0;
transform rotational; transform rotational;
rotationAxis (-1 0 0); rotationAxis (-1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
rotationAngle 30; rotationAngle 30;
} }
nonConformalCoupleIn60 { $nonConformalCoupleIn30; rotationAngle 60; } nonConformalCoupleIn60 { $nonConformalCoupleIn30; rotationAngle 60; }
nonConformalCoupleIn90 { $nonConformalCoupleIn30; rotationAngle 90; } nonConformalCoupleIn90 { $nonConformalCoupleIn30; rotationAngle 90; }
nonConformalCoupleIn120 { $nonConformalCoupleIn30; rotationAngle 120; } nonConformalCoupleIn120 { $nonConformalCoupleIn30; rotationAngle 120; }
nonConformalCoupleIn150 { $nonConformalCoupleIn30; rotationAngle 150; } nonConformalCoupleIn150 { $nonConformalCoupleIn30; rotationAngle 150; }
nonConformalCoupleIn180 { $nonConformalCoupleIn30; rotationAngle 180; } nonConformalCoupleIn180 { $nonConformalCoupleIn30; rotationAngle 180; }
nonConformalCoupleIn210 { $nonConformalCoupleIn30; rotationAngle 210; } nonConformalCoupleIn210 { $nonConformalCoupleIn30; rotationAngle 210; }
nonConformalCoupleIn240 { $nonConformalCoupleIn30; rotationAngle 240; } nonConformalCoupleIn240 { $nonConformalCoupleIn30; rotationAngle 240; }
nonConformalCoupleIn270 { $nonConformalCoupleIn30; rotationAngle 270; } nonConformalCoupleIn270 { $nonConformalCoupleIn30; rotationAngle 270; }
nonConformalCoupleIn300 { $nonConformalCoupleIn30; rotationAngle 300; } nonConformalCoupleIn300 { $nonConformalCoupleIn30; rotationAngle 300; }
nonConformalCoupleIn330 { $nonConformalCoupleIn30; rotationAngle 330; } nonConformalCoupleIn330 { $nonConformalCoupleIn30; rotationAngle 330; }
nonConformalCoupleOut0 nonConformalCoupleOut0
{ {
patches (nonCoupleOut1 nonCoupleOut2); patches (nonCoupleOut1 nonCoupleOut2);
transform none; transform none;
} }
nonConformalCoupleOut30 nonConformalCoupleOut30
{ {
patches (nonCoupleOut1 nonCoupleOut2); patches (nonCoupleOut1 nonCoupleOut2);
transform rotational; transform rotational;
rotationAxis (-1 0 0); rotationAxis (-1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
rotationAngle -30; rotationAngle -30;
}
nonConformalCoupleOut60 { $nonConformalCoupleOut30; rotationAngle -60; }
nonConformalCoupleOut90 { $nonConformalCoupleOut30; rotationAngle -90; }
nonConformalCoupleOut120 { $nonConformalCoupleOut30; rotationAngle -120; }
nonConformalCoupleOut150 { $nonConformalCoupleOut30; rotationAngle -150; }
nonConformalCoupleOut180 { $nonConformalCoupleOut30; rotationAngle -180; }
nonConformalCoupleOut210 { $nonConformalCoupleOut30; rotationAngle -210; }
nonConformalCoupleOut240 { $nonConformalCoupleOut30; rotationAngle -240; }
nonConformalCoupleOut270 { $nonConformalCoupleOut30; rotationAngle -270; }
nonConformalCoupleOut300 { $nonConformalCoupleOut30; rotationAngle -300; }
nonConformalCoupleOut330 { $nonConformalCoupleOut30; rotationAngle -330; }
} }
nonConformalCoupleOut60 { $nonConformalCoupleOut30; rotationAngle -60; }
nonConformalCoupleOut90 { $nonConformalCoupleOut30; rotationAngle -90; }
nonConformalCoupleOut120 { $nonConformalCoupleOut30; rotationAngle -120; }
nonConformalCoupleOut150 { $nonConformalCoupleOut30; rotationAngle -150; }
nonConformalCoupleOut180 { $nonConformalCoupleOut30; rotationAngle -180; }
nonConformalCoupleOut210 { $nonConformalCoupleOut30; rotationAngle -210; }
nonConformalCoupleOut240 { $nonConformalCoupleOut30; rotationAngle -240; }
nonConformalCoupleOut270 { $nonConformalCoupleOut30; rotationAngle -270; }
nonConformalCoupleOut300 { $nonConformalCoupleOut30; rotationAngle -300; }
nonConformalCoupleOut330 { $nonConformalCoupleOut30; rotationAngle -330; }
// ************************************************************************* // // ************************************************************************* //