52 patchVSubDict.readEntry<wordList>(
"patches", patchNames);
55 Info <<
"DAInputPatchVelocity. " << endl;
56 Info <<
"Setting UMag = " << input[0] <<
" AoA = " << input[1] <<
" degs at " << patchNames << endl;
60 word flowAxis = patchVSubDict.getWord(
"flowAxis");
61 word normalAxis = patchVSubDict.getWord(
"normalAxis");
62 scalar UMag = input[0];
64 HashTable<label> axisIndices;
65 axisIndices.set(
"x", 0);
66 axisIndices.set(
"y", 1);
67 axisIndices.set(
"z", 2);
68 label flowAxisIndex = axisIndices[flowAxis];
69 label normalAxisIndex = axisIndices[normalAxis];
71 volVectorField&
U =
const_cast<volVectorField&
>(
mesh_.thisDb().lookupObject<volVectorField>(
"U"));
73 scalar aoaRad = input[1] * constant::mathematical::pi / 180.0;
74 scalar UxNew = UMag * cos(aoaRad);
75 scalar UyNew = UMag * sin(aoaRad);
80 word patchName = patchNames[idxI];
81 label patchI =
mesh_.boundaryMesh().findPatchID(patchName);
82 if (
mesh_.boundaryMesh()[patchI].size() > 0)
84 if (
U.boundaryField()[patchI].type() ==
"fixedValue")
86 forAll(
U.boundaryField()[patchI], faceI)
88 U.boundaryFieldRef()[patchI][faceI][flowAxisIndex] = UxNew;
89 U.boundaryFieldRef()[patchI][faceI][normalAxisIndex] = UyNew;
92 else if (
U.boundaryField()[patchI].type() ==
"inletOutlet")
94 mixedFvPatchField<vector>& inletOutletPatch =
95 refCast<mixedFvPatchField<vector>>(
U.boundaryFieldRef()[patchI]);
97 forAll(
U.boundaryField()[patchI], faceI)
99 inletOutletPatch.refValue()[faceI][flowAxisIndex] = UxNew;
100 inletOutletPatch.refValue()[faceI][normalAxisIndex] = UyNew;
105 FatalErrorIn(
"DAInputPatchVelocity::run")
106 <<
"patch type not valid! only support fixedValue or inletOutlet"
111 U.correctBoundaryConditions();