adjointSpalartAllmaras.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 FOSS GP
10  Copyright (C) 2019-2020 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "adjointSpalartAllmaras.H"
32 #include "wallDist.H"
33 #include "wallFvPatch.H"
36 #include "coupledFvPatch.H"
37 #include "ATCModel.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace incompressibleAdjoint
44 {
45 namespace adjointRASModels
46 {
47 
48 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
49 
50 defineTypeNameAndDebug(adjointSpalartAllmaras, 0);
52 (
53  adjointRASModel,
54  adjointSpalartAllmaras,
55  dictionary
56 );
57 
58 
59 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
60 
61 // * * * * * * * * * * * * Primal Spalart - Allmaras * * * * * * * * * * * * //
62 
64 {
65  return nuTilda()/nu();
66 }
67 
68 
70 {
71  const volScalarField chi3(pow3(chi));
72  return chi3/(chi3 + pow3(Cv1_));
73 }
74 
75 
77 (
78  const volScalarField& chi,
79  const volScalarField& fv1
80 ) const
81 {
82  return 1.0 - chi/(1.0 + chi*fv1);
83 }
84 
85 
87 (
88  const volScalarField& chi,
89  const volScalarField& fv1
90 ) const
91 {
92  volScalarField Omega(::sqrt(2.0)*mag(skew(gradU_)));
93 
94  return
95  (
96  max
97  (
98  Omega
99  + fv2(chi, fv1)*nuTilda()/sqr(kappa_*y_),
100  Cs_*Omega
101  )
102  );
103 }
104 
105 
107 (
108  const volScalarField& Stilda
109 ) const
110 {
112  (
113  new volScalarField
114  (
115  min
116  (
117  nuTilda()/(max(Stilda, minStilda_)*sqr(kappa_*y_)),
118  scalar(10)
119  )
120  )
121  );
122  tr.ref().boundaryFieldRef() == Zero;
123 
124  return tr;
125 }
126 
127 
129 (
130  const volScalarField& Stilda
131 ) const
132 {
133  const volScalarField g(r_ + Cw2_*(pow6(r_) - r_));
134 
135  return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0);
136 }
137 
138 
140 {
141  return tmp<volScalarField>
142  (
143  new volScalarField("DnuTildaEff", (nuTilda() + this->nu())/sigmaNut_)
144  );
145 }
146 
147 
149 {
150  return primalVars_.RASModelVariables()().TMVar1();
151 }
152 
153 
155 {
156  return primalVars_.RASModelVariables()().nutRef();
157 }
158 
159 
160 // * * * * * * * * * * * Adjoint Spalart - Allmaras * * * * * * * * * * * * //
161 
163 (
164  const volScalarField& chi
165 ) const
166 {
167  volScalarField chi3(pow3(chi));
168 
169  return 3.0*pow3(Cv1_)*sqr(chi/(chi3+pow3(Cv1_)));
170 }
171 
172 
174 (
175  const volScalarField& chi,
176  const volScalarField& fv1,
177  const volScalarField& dFv1dChi
178 ) const
179 {
180  return (chi*chi*dFv1dChi - 1.)/sqr(1. + chi*fv1);
181 }
182 
183 
185 (
186  const volScalarField& Omega,
187  const volScalarField& fv2
188 ) const
189 {
190  volScalarField fieldSwitch
191  (
192  Omega + fv2*nuTilda()/sqr(kappa_*y_) - Cs_*Omega
193  );
194 
195  return pos(fieldSwitch) + neg(fieldSwitch)*Cs_;
196 }
197 
198 
200 (
201  const volScalarField& Omega,
202  const volScalarField& fv2,
203  const volScalarField& dFv2dChi
204 ) const
205 {
206  volScalarField invDenom(1./sqr(kappa_*y_));
207  volScalarField fieldSwitch(Omega + fv2*nuTilda()*invDenom - Cs_*Omega);
208 
209  return pos(fieldSwitch)*(dFv2dChi*nuTilda()*invDenom/nu() + fv2*invDenom);
210 }
211 
212 
214 (
215  const volScalarField& Omega,
216  const volScalarField& fv2
217 ) const
218 {
219  volScalarField aux(fv2*nuTilda()/sqr(kappa_*y_));
220  volScalarField fieldSwitch(Omega + aux - Cs_*Omega);
221 
222  return - 2.*pos(fieldSwitch)*aux/y_;
223 }
224 
225 
227 (
228  const volScalarField& Stilda
229 ) const
230 {
231  tmp<volScalarField> tdrdNutilda
232  (
233  1./(max(Stilda, minStilda_)*sqr(kappa_*y_))
234  *(scalar(10) - r_)/(scalar(10) - r_ + SMALL)
235  );
236  tdrdNutilda.ref().boundaryFieldRef() == Zero;
237 
238  return tdrdNutilda;
239 }
240 
241 
243 (
244  const volScalarField& Stilda
245 ) const
246 {
247  tmp<volScalarField> tdrdStilda
248  (
249  - nuTilda()/sqr(max(Stilda, minStilda_)*kappa_*y_)
250  *(scalar(10) - r_)/(scalar(10) - r_ + SMALL)
251  );
252  tdrdStilda.ref().boundaryFieldRef() == Zero;
253 
254  return tdrdStilda;
255 }
256 
257 
259 (
260  const volScalarField& Stilda
261 ) const
262 {
263  tmp<volScalarField> tdrdDelta
264  (
265  -2.*nuTilda()/(max(Stilda, minStilda_)*sqr(kappa_*y_)*y_)
266  *(scalar(10) - r_)/(scalar(10) - r_ + SMALL)
267  );
268  tdrdDelta.ref().boundaryFieldRef() == Zero;
269 
270  return tdrdDelta;
271 }
272 
273 
275 (
276  const volScalarField& Stilda
277 ) const
278 {
279  volScalarField g(r_ + Cw2_*(pow6(r_) - r_));
280 
281  dimensionedScalar pow6Cw3 = pow6(Cw3_);
282  volScalarField pow6g(pow6(g));
283 
284  return pow6Cw3/(pow6g + pow6Cw3)
285  *pow((1.0 + pow6Cw3)/(pow6g + pow6Cw3), 1.0/6.0)
286  *(1.0 + Cw2_*(6.0*pow5(r_) - 1.0));
287 }
288 
289 
291 (
292  const volScalarField& Stilda,
293  const volScalarField& dfwdr,
294  const volScalarField& dStildadNuTilda
295 ) const
296 {
297  volScalarField invDenom(1./sqr(kappa_*y_));
298 
299  return
300  dfwdr*(dr_dNuTilda(Stilda) + dr_dStilda(Stilda)*dStildadNuTilda);
301 }
302 
303 
305 (
306  const volScalarField& Stilda,
307  const volScalarField& dfwdr,
308  const volScalarField& dStildadOmega
309 ) const
310 {
311  return dfwdr*dr_dStilda(Stilda)*dStildadOmega;
312 }
313 
314 
316 (
317  const volScalarField& Stilda,
318  const volScalarField& dfwdr,
319  const volScalarField& dStildadDelta
320 ) const
321 {
322  return dfwdr*(dr_dDelta(Stilda) + dr_dStilda(Stilda)*dStildadDelta);
323 }
324 
325 
327 (
328  const volScalarField& fw,
329  const volScalarField& dfwdNuTilda
330 ) const
331 {
332  return Cw1_*(nuTilda()*dfwdNuTilda + fw)/sqr(y_);
333 }
334 
335 
337 (
338  const volScalarField& dStildadNuTilda
339 ) const
340 {
341  return - Cb1_*dStildadNuTilda;
342 }
343 
344 
346 (
347  const volScalarField& fv1,
348  const volScalarField& dFv1dChi
349 ) const
350 {
351  return dFv1dChi*nuTilda()/nu() + fv1;
352 }
353 
354 
356 {
357  // Store boundary field of the conservative part,
358  // for use in adjoint outlet boundary conditions
359  forAll(mesh_.boundary(), pI)
360  {
361  const fvPatch& patch = mesh_.boundary()[pI];
362  if(!isA<coupledFvPatch>(patch))
363  {
364  vectorField nf(patch.nf());
367  *nuaTilda().boundaryField()[pI];
368  }
369  }
370 
372 }
373 
374 
376 {
378  {
379  Info<< "Updating primal-based fields of the adjoint turbulence "
380  << "model ..." << endl;
381 
382  // Grab references
383  const volVectorField& U = primalVars_.U();
384 
385  // Update gradient fields
386  gradU_ = mask_*fvc::grad(U, "gradUStilda");
388 
389  const volScalarField Omega(::sqrt(2.0)*mag(skew(gradU_)));
390 
391  // Primal SA fields
392  volScalarField chi(this->chi());
393  volScalarField fv1(this->fv1(chi));
394  volScalarField fv2(this->fv2(chi, fv1));
395  Stilda_ = Stilda(chi, fv1);
396  r_ = r(Stilda_);
397  fw_ = this->fw(Stilda_);
398 
399  // Derivatives of primal fields wrt to nuTilda
400  volScalarField dFv1_dChi(this->dFv1_dChi(chi));
403  (this->dStilda_dNuTilda(Omega, fv2, dFv2_dChi));
406  (this->dfw_dNuTilda(Stilda_, dfw_dr, dStilda_dNuTilda));
407 
408  // Fields to be used in the nuaTilda equation
410  symm(mask_*fvc::grad(U, "adjointProductionU"));
411 
413  nuTilda()
414  *(
417  );
418 
420 
421  // Constant multiplier in the adjoint momentum source term
424  (this->dfw_dOmega(Stilda_, dfw_dr, dStilda_dOmega));
425 
427  2.*skew(gradU_)
428  /(Omega + dimensionedScalar("SMALL", Omega.dimensions(), SMALL))
429  *(
432  );
433 
434  // Set changedPrimalSolution_ to false to avoid recomputing these
435  // fields unless the primal has changed
436  changedPrimalSolution_ = false;
437  }
438 }
439 
440 
442 {
443  tmp<volScalarField> mask;
445  {
447  }
448  else
449  {
450  mask = tmp<volScalarField>
451  (
452  new volScalarField
453  (
454  IOobject
455  (
456  "unitMask",
457  mesh_.time().timeName(),
458  mesh_,
461  ),
462  mesh_,
463  dimensionedScalar("unit", dimless, scalar(1))
464  )
465  );
466  }
467 
468  return mask;
469 }
470 
471 
472 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
473 
474 adjointSpalartAllmaras::adjointSpalartAllmaras
475 (
476  incompressibleVars& primalVars,
478  objectiveManager& objManager,
479  const word& adjointTurbulenceModelName,
480  const word& modelName
481 )
482 :
484  (
485  modelName,
486  primalVars,
487  adjointVars,
488  objManager,
489  adjointTurbulenceModelName
490  ),
491 
492  sigmaNut_
493  (
495  (
496  "sigmaNut",
497  this->coeffDict_,
498  0.66666
499  )
500  ),
501  kappa_
502  (
504  (
505  "kappa",
506  this->coeffDict_,
507  0.41
508  )
509  ),
510 
511  Cb1_
512  (
514  (
515  "Cb1",
516  this->coeffDict_,
517  0.1355
518  )
519  ),
520  Cb2_
521  (
523  (
524  "Cb2",
525  this->coeffDict_,
526  0.622
527  )
528  ),
529  Cw1_(Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_),
530  Cw2_
531  (
533  (
534  "Cw2",
535  this->coeffDict_,
536  0.3
537  )
538  ),
539  Cw3_
540  (
542  (
543  "Cw3",
544  this->coeffDict_,
545  2.0
546  )
547  ),
548  Cv1_
549  (
551  (
552  "Cv1",
553  this->coeffDict_,
554  7.1
555  )
556  ),
557  Cs_
558  (
560  (
561  "Cs",
562  this->coeffDict_,
563  0.3
564  )
565  ),
566 
567  limitAdjointProduction_
568  (
569  coeffDict_.getOrDefault("limitAdjointProduction", true)
570  ),
571 
572  y_(primalVars_.RASModelVariables()().d()),
573 
574  mask_(allocateMask()),
575 
576  symmAdjointProductionU_
577  (
578  IOobject
579  (
580  "symmAdjointProductionU",
581  runTime_.timeName(),
582  mesh_,
585  ),
586  mesh_,
588  ),
589 
590  productionDestructionSource_
591  (
592  IOobject
593  (
594  "productionDestructionSource",
595  runTime_.timeName(),
596  mesh_,
599  ),
600  mesh_,
602  ),
603 
604  Stilda_
605  (
606  IOobject
607  (
608  "Stilda",
609  runTime_.timeName(),
610  mesh_,
613  ),
614  mesh_,
616  ),
617 
618  r_
619  (
620  IOobject
621  (
622  "r",
623  runTime_.timeName(),
624  mesh_,
627  ),
628  mesh_,
630  ),
631 
632  fw_
633  (
634  IOobject
635  (
636  "fw",
637  runTime_.timeName(),
638  mesh_,
641  ),
642  mesh_,
644  ),
645 
646  Cdnut_
647  (
648  IOobject
649  (
650  "Cdnut",
651  runTime_.timeName(),
652  mesh_,
655  ),
656  mesh_,
658  ),
659 
660  momentumSourceMult_
661  (
662  IOobject
663  (
664  "momentumSourceMult",
665  runTime_.timeName(),
666  mesh_,
669  ),
670  mesh_,
672  ),
673 
674  gradU_(fvc::grad(primalVars.U())),
675  gradNuTilda_(fvc::grad(nuTilda())),
676  minStilda_("SMALL", Stilda_.dimensions(), SMALL)
677 {
678  // Read nuaTilda field and reset pointer to the first
679  // adjoint turbulence model variable
681  (
682  adjointTMVariable1Ptr_,
683  mesh_,
684  "nuaTilda",
685  adjointVars.solverName(),
686  adjointVars.useSolverNameForFields()
687  );
688 
689  setMeanFields();
690 
691  // Set the includeDistance to true, to allow for the automatic solution
692  // of the adjoint eikonal equation when computing sensitivities
693  includeDistance_ = true;
694 
695  // Update the primal related fields here so that functions computing
696  // sensitivities have the updated fields in case of continuation
697  updatePrimalRelatedFields();
698 }
699 
700 
701 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
702 
704 {
705  const volVectorField& Ua = adjointVars_.UaInst();
706  return devReff(Ua);
707 }
708 
709 
711 (
712  const volVectorField& U
713 ) const
714 {
715  return
717  (
718  IOobject
719  (
720  "devRhoReff",
721  runTime_.timeName(),
722  mesh_,
725  ),
726  -nuEff()*dev(twoSymm(fvc::grad(U)))
727  );
728 }
729 
730 
732 {
733  tmp<volScalarField> tnuEff(nuEff());
734  const volScalarField& nuEff = tnuEff();
735 
736  return
737  (
738  - fvm::laplacian(nuEff, Ua)
739  - fvc::div(nuEff*dev(fvc::grad(Ua)().T()))
740  );
741 }
742 
743 
745 {
746  // cm formulation
747  //return (- nuTilda()*fvc::grad(nuaTilda() - conservativeMomentumSource());
748 
749  // ncm formulation
751 }
752 
753 
755 {
756  volScalarField chi(this->chi());
757  volScalarField fv1(this->fv1(chi));
758  volScalarField dFv1_dChi(this->dFv1_dChi(chi));
759 
760  return dnut_dNuTilda(fv1, dFv1_dChi);
761 }
762 
763 
765 {
766  tmp<scalarField> tdiffCoeff
767  (
768  new scalarField(mesh_.boundary()[patchI].size(), Zero)
769  );
770 
771  scalarField& diffCoeff = tdiffCoeff.ref();
772 
773  diffCoeff =
774  (nuTilda().boundaryField()[patchI] + nu()().boundaryField()[patchI])
775  /sigmaNut_.value();
776 
777  return tdiffCoeff;
778 }
779 
780 
781 const boundaryVectorField&
783 {
784  // Computed in conservativeMomentumSource
785  return adjMomentumBCSourcePtr_();
786 }
787 
788 
790 {
792 
793  forAll(mesh_.boundary(), patchI)
794  {
795  const fvPatch& patch = mesh_.boundary()[patchI];
796 
797  tmp<vectorField> tnf(patch.nf());
798  const vectorField& nf = tnf();
799  if (isA<wallFvPatch>(patch) && patch.size() != 0)
800  {
801  wallShapeSens[patchI] =
802  - nuaTilda().boundaryField()[patchI].snGrad()
803  * diffusionCoeffVar1(patchI)()
804  * nuTilda().boundaryField()[patchI].snGrad() * nf;
805  }
806  }
807 
808  return wallShapeSens;
809 }
810 
811 
813 {
815 
816  forAll(mesh_.boundary(), patchI)
817  {
818  tmp<vectorField> tnf = mesh_.boundary()[patchI].nf();
819  const vectorField& nf = tnf();
820 
821  wallFloCoSens[patchI] =
822  nuaTilda().boundaryField()[patchI]
823  * nuTilda().boundaryField()[patchI] * nf;
824  }
825 
826  return wallFloCoSens;
827 }
828 
829 
831 {
832  const volVectorField& U = primalVars_.U();
833  const volVectorField& Ua = adjointVars_.Ua();
834 
835  // Primal SA fields
836  volScalarField chi(this->chi());
837  volScalarField fv1(this->fv1(chi));
838  volScalarField fv2(this->fv2(chi, fv1));
839  volScalarField Omega(::sqrt(2.0)*mag(gradU_));
840 
841  // Derivatives of primal fields wrt to nuTilda
842  volScalarField dFv1_dChi(this->dFv1_dChi(chi));
847  (this->dfw_dDelta(Stilda_, dfw_dr, dStilda_dDelta));
848 
849 
850  tmp<volScalarField> tadjointEikonalSource
851  (
852  new volScalarField
853  (
854  "adjointEikonalSource" + type(),
855  (
857  + Cw1_*sqr(nuTilda()/y_)*(dfw_dDelta - 2.*fw_/y_)
858  )*nuaTilda()
859  )
860  );
861  volScalarField& adjointEikonalSource = tadjointEikonalSource.ref();
862 
863  // if wall functions are used, add appropriate source terms
865  SAwallFunctionPatchField;
866 
867  const volScalarField::Boundary& nutBoundary = nut().boundaryField();
868  const scalarField& V = mesh_.V().field();
869 
870  tmp<volScalarField> tnuEff = nuEff();
871  const volScalarField& nuEff = tnuEff();
872 
873  forAll(nutBoundary, patchi)
874  {
875  const fvPatch& patch = mesh_.boundary()[patchi];
876  if
877  (
878  isA<SAwallFunctionPatchField>(nutBoundary[patchi])
879  && patch.size() != 0
880  )
881  {
882  const scalar kappa_(0.41);
883  const scalar E_(9.8);
884  const tmp<vectorField> tnf(patch.nf());
885  const vectorField& nf = tnf();
886  const scalarField& magSf = patch.magSf();
887 
888  const fvPatchVectorField& Up = U.boundaryField()[patchi];
889  const fvPatchVectorField& Uap = Ua.boundaryField()[patchi];
890  const vectorField Uc(Up.patchInternalField());
891  const vectorField Uc_t(Uc - (Uc & nf)*nf);
892 
893  // By convention, tf has the direction of the tangent
894  // PRIMAL velocity at the first cell off the wall
895  const vectorField tf(Uc_t/mag(Uc_t));
896 
897  const scalarField nuw(nuEff.boundaryField()[patchi]);
898  const scalarField nu(this->nu()().boundaryField()[patchi]);
899  const fvPatchScalarField& yC = y()[patchi];
900 
901  const scalarField magGradU(mag(Up.snGrad()));
902 
903  // Note: What happens in separation?? sign change needed
904  const scalarField vtau(sqrt(nuw*magGradU));
905 
906  // Note: mag for positive uPlus
907  const scalarField uPlus(mag(Uc)/vtau);
908 
909  const scalarField yPlus(yC*vtau/nu);
910  const scalarField kUu(min(kappa_*uPlus, scalar(50)));
911  const scalarField auxA
912  ((kappa_/E_)*(exp(kUu) - 1 - kUu - 0.5*kUu*kUu));
913  const scalarField Cwf_d(sqr(vtau)/nu/(yPlus+uPlus*(1 + auxA)));
914 
915  // Tangential components are according to tf
916  autoPtr<boundaryAdjointContribution> boundaryContrPtr
917  (
919  (
920  "objectiveManager" + objectiveManager_.adjointSolverName(),
922  "incompressible",
923  patch
924  )
925  );
926  tmp<vectorField> tsource(boundaryContrPtr->normalVelocitySource());
927 
928  const scalarField rt(tsource() & tf);
929  const scalarField Uap_t(Uap & tf);
930 
931  const labelList& faceCells = patch.faceCells();
932  forAll(faceCells, faceI)
933  {
934  label cellI = faceCells[faceI];
935  adjointEikonalSource[cellI] -=
936  2.*( rt[faceI] + Uap_t[faceI] )
937  * vtau[faceI]*Cwf_d[faceI]*magSf[faceI]
938  / V[cellI]; // Divide with cell volume since the term
939  // will be used as a source term in the
940  // adjoint eikonal equation
941  }
942  }
943  }
944 
945  return tadjointEikonalSource;
946 }
947 
948 
950 {
951  const volVectorField& U = primalVars_.U();
952 
953  volTensorField gradU(fvc::grad(U));
954  volVectorField gradNuTilda(fvc::grad(nuTilda()));
955  volVectorField gradNuaTilda(fvc::grad(nuaTilda()));
956 
957  // Explicitly correct the boundary gradient to get rid of
958  // the tangential component
959  forAll(mesh_.boundary(), patchI)
960  {
961  const fvPatch& patch = mesh_.boundary()[patchI];
962  if (isA<wallFvPatch>(patch))
963  {
964  tmp<vectorField> tnf(patch.nf());
965  const vectorField& nf = tnf();
966  // gradU:: can cause problems in zeroGradient patches for U
967  // and zero fixedValue for nuTilda.
968  // S becomes 0 and is used as a denominator in G
969  //gradU.boundaryField()[patchI] =
970  // nf * U_.boundaryField()[patchI].snGrad();
971  gradNuTilda.boundaryFieldRef()[patchI] =
972  nf * nuTilda().boundaryField()[patchI].snGrad();
973  gradNuaTilda.boundaryFieldRef()[patchI] =
974  nf * nuaTilda().boundaryField()[patchI].snGrad();
975  }
976  }
977 
978  // delta vorticity
979  volScalarField Omega(::sqrt(2.0)*mag(skew(gradU)));
980  volTensorField deltaOmega
981  (
982  (
983  (gradU & gradU)().T() //jk
984  - (gradU & gradU.T()) //symmetric
985  )
986  /(Omega + dimensionedScalar("SMALL", Omega.dimensions(), SMALL))
987  );
988 
989  volScalarField chi(this->chi());
990  volScalarField fv1(this->fv1(chi));
991  volScalarField fv2(this->fv2(chi, fv1));
992 
996  (this->dfw_dOmega(Stilda_, dfw_dr, dStilda_dOmega));
997 
998  // Assemply of the return field
999  tmp<volTensorField> tvolSensTerm
1000  (
1001  new volTensorField
1002  (
1003  "volSensTerm",
1004  // jk, cm formulation for the TM model convection
1005  - (nuaTilda() * (U * gradNuTilda))
1006  // jk, symmetric in theory
1007  + nuaTilda()*fvc::grad(DnuTildaEff() * gradNuTilda)().T()
1008  // jk
1009  - DnuTildaEff() * (gradNuaTilda * gradNuTilda)
1010  // symmetric
1011  + 2.*nuaTilda()*Cb2_/sigmaNut_ * (gradNuTilda * gradNuTilda)
1012  + (
1015  )
1016  * nuaTilda() * deltaOmega // jk
1017  )
1018  );
1019 
1020  return tvolSensTerm;
1021 }
1022 
1023 
1025 {
1027 }
1028 
1029 
1031 {
1032  if (!adjointTurbulence_)
1033  {
1034  return;
1035  }
1036 
1038 
1040 
1042  const volVectorField& Ua = adjointVars_.UaInst();
1043 
1045  volScalarField gradUaR
1046  (
1047  2.0*fvc::grad(Ua,"adjointProductionUa") && symmAdjointProductionU_
1048  );
1049 
1050  dimensionedScalar oneOverSigmaNut = 1./sigmaNut_;
1051 
1052  nuaTilda().storePrevIter();
1053 
1054  tmp<fvScalarMatrix> nuaTildaEqn
1055  (
1056  fvm::ddt(nuaTilda())
1057  + fvm::div(-phi, nuaTilda())
1059  // Note: Susp
1061  + fvc::laplacian(2.0*Cb2_*oneOverSigmaNut*nuaTilda(), nuTilda())
1062  + gradNua*oneOverSigmaNut
1063  ==
1064  // always a negative contribution to the lhs. No Sp used!
1066  //always a positive contribution to the lhs. no need for SuSp
1067  - fvm::Sp(Cw1_*fw_*nuTilda()/sqr(y_), nuaTilda())
1068  - Cdnut_*gradUaR
1069  );
1070 
1071  // Add sources from the objective functions
1072  objectiveManager_.addTMEqn1Source(nuaTildaEqn.ref());
1073 
1074  nuaTildaEqn.ref().relax();
1075  solve(nuaTildaEqn);
1077  nuaTilda().relax();
1078 
1080  {
1081  scalar maxDeltaNuaTilda =
1082  gMax(mag(nuaTilda() - nuaTilda().prevIter())());
1083  dimensionedScalar maxNuaTilda = max(mag(nuaTilda()));
1084  Info<< "Max mag of nuaTilda = " << maxNuaTilda.value() << endl;
1085  Info<< "Max mag of delta nuaTilda = " << maxDeltaNuaTilda << endl;
1086  }
1087 }
1088 
1089 
1091 {
1092  if (adjointRASModel::read())
1093  {
1095  kappa_.readIfPresent(this->coeffDict());
1096 
1097  Cb1_.readIfPresent(this->coeffDict());
1098  Cb2_.readIfPresent(this->coeffDict());
1099  Cw1_ = Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_;
1100  Cw2_.readIfPresent(this->coeffDict());
1101  Cw3_.readIfPresent(this->coeffDict());
1102  Cv1_.readIfPresent(this->coeffDict());
1103  Cs_.readIfPresent(this->coeffDict());
1104 
1105  return true;
1106  }
1107  else
1108  {
1109  return false;
1110  }
1111 }
1112 
1113 
1114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1115 
1116 } // End namespace adjointRASModels
1117 } // End namespace incompressibleAdjoint
1118 } // End namespace Foam
1119 
1120 // ************************************************************************* //
Foam::variablesSet::useSolverNameForFields
bool useSolverNameForFields() const
Append solver name to fields?
Definition: variablesSet.C:90
Foam::fvPatchField< vector >
wallDist.H
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::kappa_
dimensionedScalar kappa_
Definition: adjointSpalartAllmaras.H:107
Foam::incompressibleAdjointMeanFlowVars
Manages the adjoint mean flow fields and their mean values.
Definition: incompressibleAdjointMeanFlowVars.H:51
Foam::fvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: fvPatchField.C:225
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::objectiveManager
class for managing incompressible objective functions.
Definition: objectiveManager.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cdnut_
volScalarField Cdnut_
Definition: adjointSpalartAllmaras.H:139
Foam::variablesSet::solverName
const word & solverName() const
Return solver name.
Definition: variablesSet.C:84
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:84
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::fv1
tmp< volScalarField > fv1(const volScalarField &chi) const
Definition: adjointSpalartAllmaras.C:69
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::gradNuTilda_
volVectorField gradNuTilda_
Definition: adjointSpalartAllmaras.H:142
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::r
tmp< volScalarField > r(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:107
Foam::incompressibleAdjoint::adjointRASModel::wallShapeSensitivitiesPtr_
autoPtr< boundaryVectorField > wallShapeSensitivitiesPtr_
Wall sensitivity term for shape optimisation.
Definition: adjointRASModel.H:129
Foam::incompressibleAdjoint::adjointRASModel::y
const nearWallDist & y() const
Return the near wall distances.
Definition: adjointRASModel.H:213
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
ATCModel.H
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cv1_
dimensionedScalar Cv1_
Definition: adjointSpalartAllmaras.H:114
Foam::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:138
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::dimensionedSymmTensor
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedSymmTensor.H:50
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::incompressibleAdjoint::adjointRASModel::coeffDict_
dictionary coeffDict_
Model coefficients dictionary.
Definition: adjointRASModel.H:107
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dStilda_dNuTilda
tmp< volScalarField > dStilda_dNuTilda(const volScalarField &Omega, const volScalarField &fv2, const volScalarField &dFv2dChi) const
Definition: adjointSpalartAllmaras.C:200
boundaryAdjointContribution.H
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::sigmaNut_
dimensionedScalar sigmaNut_
Definition: adjointSpalartAllmaras.H:106
Foam::incompressibleAdjoint::adjointTurbulenceModel::nuEff
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity.
Definition: adjointTurbulenceModel.H:167
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::fv2
tmp< volScalarField > fv2(const volScalarField &chi, const volScalarField &fv1) const
Definition: adjointSpalartAllmaras.C:77
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::adjointMeanFlowSource
virtual tmp< volVectorField > adjointMeanFlowSource()
Definition: adjointSpalartAllmaras.C:744
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cw1_
dimensionedScalar Cw1_
Definition: adjointSpalartAllmaras.H:111
wallFvPatch.H
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dStilda_dOmega
tmp< volScalarField > dStilda_dOmega(const volScalarField &Omega, const volScalarField &fv2) const
Definition: adjointSpalartAllmaras.C:185
Foam::incompressibleVars::phi
const surfaceScalarField & phi() const
Return const reference to volume flux.
Definition: incompressibleVars.C:357
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:49
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dnut_dNuTilda
tmp< volScalarField > dnut_dNuTilda(const volScalarField &fv1, const volScalarField &dFv1dChi) const
Definition: adjointSpalartAllmaras.C:346
uPlus
scalar uPlus
Definition: evaluateNearWall.H:18
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dfw_dOmega
tmp< volScalarField > dfw_dOmega(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadOmega) const
Definition: adjointSpalartAllmaras.C:305
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::adjointMomentumBCSource
virtual const boundaryVectorField & adjointMomentumBCSource() const
Definition: adjointSpalartAllmaras.C:782
Foam::incompressibleAdjoint::adjointRASModel::wallFloCoSensitivitiesPtr_
autoPtr< boundaryVectorField > wallFloCoSensitivitiesPtr_
Wall sensitivity term for flow control optimisation.
Definition: adjointRASModel.H:132
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dfw_dDelta
tmp< volScalarField > dfw_dDelta(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadDelta) const
Definition: adjointSpalartAllmaras.C:316
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dr_dNuTilda
tmp< volScalarField > dr_dNuTilda(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:227
Foam::incompressibleAdjoint::adjointRASModel::changedPrimalSolution_
bool changedPrimalSolution_
Has the primal solution changed?
Definition: adjointRASModel.H:139
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::fw_
volScalarField fw_
Definition: adjointSpalartAllmaras.H:138
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dFv2_dChi
tmp< volScalarField > dFv2_dChi(const volScalarField &chi, const volScalarField &fv1, const volScalarField &dFv1dChi) const
Definition: adjointSpalartAllmaras.C:174
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::distanceSensitivities
virtual tmp< volScalarField > distanceSensitivities()
Definition: adjointSpalartAllmaras.C:830
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::incompressibleVars::RASModelVariables
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
Definition: incompressibleVars.C:444
Foam::incompressibleAdjoint::adjointRASModel::read
virtual bool read()
Read adjointRASProperties dictionary.
Definition: adjointRASModel.C:226
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dr_dDelta
tmp< volScalarField > dr_dDelta(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:259
coupledFvPatch.H
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::gradU_
volTensorField gradU_
Definition: adjointSpalartAllmaras.H:141
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::nuaTilda
volScalarField & nuaTilda()
Access to the adjoint Spalart - Allmaras field.
Definition: adjointSpalartAllmaras.H:279
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dfw_dNuTilda
tmp< volScalarField > dfw_dNuTilda(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadNuTilda) const
Definition: adjointSpalartAllmaras.C:291
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dfw_dr
tmp< volScalarField > dfw_dr(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:275
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:47
Foam::incompressibleAdjoint::adjointTurbulenceModel::mesh_
const fvMesh & mesh_
Definition: adjointTurbulenceModel.H:93
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cb2_
dimensionedScalar Cb2_
Definition: adjointSpalartAllmaras.H:110
Foam::variablesSet::nullifyField
static void nullifyField(GeometricField< Type, PatchField, GeoMesh > &fieldPtr)
Nullify field and old times, if present.
Definition: variablesSetTemplates.C:347
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::read
virtual bool read()
Read adjointRASProperties dictionary.
Definition: adjointSpalartAllmaras.C:1090
Foam::fvm::SuSp
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::pow6
dimensionedScalar pow6(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:122
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::symmAdjointProductionU_
volSymmTensorField symmAdjointProductionU_
Definition: adjointSpalartAllmaras.H:134
Foam::solverControl::printMaxMags
bool printMaxMags() const
Print max mags of solver fields.
Definition: solverControlI.H:45
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::Field< vector >
Foam::dimensioned::readIfPresent
bool readIfPresent(const dictionary &dict)
Definition: dimensionedType.C:483
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::conservativeMomentumSource
tmp< volVectorField > conservativeMomentumSource()
Conservative source term for the adjoint momentum equations.
Definition: adjointSpalartAllmaras.C:355
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dD_dNuTilda
tmp< volScalarField > dD_dNuTilda(const volScalarField &fw, const volScalarField &dfwdNuTilda) const
Definition: adjointSpalartAllmaras.C:327
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:48
Foam::incompressibleAdjoint::adjointRASModel::adjMomentumBCSourcePtr_
autoPtr< boundaryVectorField > adjMomentumBCSourcePtr_
Definition: adjointRASModel.H:126
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::fvPatchField::patchInternalField
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:233
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::FISensitivityTerm
virtual tmp< volTensorField > FISensitivityTerm()
Term contributing to the computation of FI-based sensitivities.
Definition: adjointSpalartAllmaras.C:949
Foam::solve
SolverPerformance< Type > solve(faMatrix< Type > &, Istream &)
Solve returning the solution statistics given convergence tolerance.
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::nuTilda
const volScalarField & nuTilda() const
References to the primal turbulence model variables.
Definition: adjointSpalartAllmaras.C:148
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::incompressibleVars::U
const volVectorField & U() const
Return const reference to velocity.
Definition: incompressibleVars.C:331
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::nullify
virtual void nullify()
Nullify all adjoint turbulence model fields and their old times.
Definition: adjointSpalartAllmaras.C:1024
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::diffusionCoeffVar1
virtual tmp< scalarField > diffusionCoeffVar1(label patchI) const
Definition: adjointSpalartAllmaras.C:764
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::r_
volScalarField r_
Definition: adjointSpalartAllmaras.H:137
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cs_
dimensionedScalar Cs_
Definition: adjointSpalartAllmaras.H:115
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::nut
const volScalarField & nut() const
Return the turbulence viscosity.
Definition: adjointSpalartAllmaras.C:154
Foam::incompressibleAdjointMeanFlowVars::Ua
const volVectorField & Ua() const
Return const reference to velocity.
Definition: incompressibleAdjointMeanFlowVars.C:173
Foam::incompressibleAdjoint::adjointRASModel::adjointTurbulence_
Switch adjointTurbulence_
Turbulence on/off flag.
Definition: adjointRASModel.H:101
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::y_
const volScalarField & y_
Wall distance.
Definition: adjointSpalartAllmaras.H:126
Foam::variablesSet::setField
static void setField(autoPtr< GeometricField< Type, fvPatchField, volMesh >> &fieldPtr, const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
Read vol fields.
Definition: variablesSetTemplates.C:222
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cw3_
dimensionedScalar Cw3_
Definition: adjointSpalartAllmaras.H:113
Foam::nutUSpaldingWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutUSpaldingWallFunctionFvPatchScalarField.H:145
Foam::pow5
dimensionedScalar pow5(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:111
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::incompressibleAdjoint::adjointTurbulenceModel::correct
virtual void correct()=0
Solve the adjoint turbulence equations.
Definition: adjointTurbulenceModel.C:129
Foam::dimensioned< scalar >
Foam::incompressibleAdjoint::adjointRASModel
Abstract base class for incompressible turbulence models.
Definition: adjointRASModel.H:77
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:26
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressibleAdjointMeanFlowVars::getSolverControl
const solverControl & getSolverControl() const
Return const reference to solverControl.
Definition: incompressibleAdjointMeanFlowVars.C:267
Foam::incompressibleAdjoint::adjointRASModel::objectiveManager_
objectiveManager & objectiveManager_
Reference to the objectiveManager.
Definition: adjointRASModel.H:98
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dFv1_dChi
tmp< volScalarField > dFv1_dChi(const volScalarField &chi) const
Definition: adjointSpalartAllmaras.C:163
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::allocateMask
tmp< volScalarField > allocateMask()
Allocate the mask field.
Definition: adjointSpalartAllmaras.C:441
Foam::GeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Definition: GeometricField.C:940
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dr_dStilda
tmp< volScalarField > dr_dStilda(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:243
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cw2_
dimensionedScalar Cw2_
Definition: adjointSpalartAllmaras.H:112
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:685
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Stilda
tmp< volScalarField > Stilda(const volScalarField &chi, const volScalarField &fv1) const
Definition: adjointSpalartAllmaras.C:87
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::nutJacobianTMVar1
virtual tmp< volScalarField > nutJacobianTMVar1() const
Jacobian of nut wrt the first turbulence model variable.
Definition: adjointSpalartAllmaras.C:754
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::fw
tmp< volScalarField > fw(const volScalarField &Stilda) const
Definition: adjointSpalartAllmaras.C:129
Foam::GeometricField::storePrevIter
void storePrevIter() const
Store the field as the previous iteration value.
Definition: GeometricField.C:900
Foam::incompressibleAdjoint::adjointRASModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(adjointRASModel, adjointLaminar, dictionary)
Foam::fvm::ddt
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:48
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::momentumSourceMult_
volTensorField momentumSourceMult_
Definition: adjointSpalartAllmaras.H:140
Foam::GeometricField::Boundary
The boundary fields.
Definition: GeometricField.H:115
Foam::incompressibleAdjoint::adjointRASModels::defineTypeNameAndDebug
defineTypeNameAndDebug(adjointLaminar, 0)
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::updatePrimalRelatedFields
void updatePrimalRelatedFields()
Update the constant primal-related fields.
Definition: adjointSpalartAllmaras.C:375
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::GeometricField::boundaryFieldRef
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Definition: GeometricField.C:783
Foam::List< label >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::chi
tmp< volScalarField > chi() const
Definition: adjointSpalartAllmaras.C:63
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Cb1_
dimensionedScalar Cb1_
Definition: adjointSpalartAllmaras.H:109
Foam::ATCModel::createLimiter
static tmp< volScalarField > createLimiter(const fvMesh &mesh, const dictionary &dict)
Definition: ATCModel.C:221
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::incompressibleAdjoint::adjointTurbulenceModel::adjointVars_
incompressibleAdjointMeanFlowVars & adjointVars_
Definition: adjointTurbulenceModel.H:91
nutUSpaldingWallFunctionFvPatchScalarField.H
Foam::incompressibleAdjoint::adjointRASModel::coeffDict
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: adjointRASModel.H:219
adjointSpalartAllmaras.H
Foam::GeometricField::relax
void relax(const scalar alpha)
Relax field (for steady-state solution).
Definition: GeometricField.C:972
Foam::incompressibleAdjoint::adjointTurbulenceModel::primalVars_
incompressibleVars & primalVars_
Definition: adjointTurbulenceModel.H:90
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::limitAdjointProduction_
bool limitAdjointProduction_
Definition: adjointSpalartAllmaras.H:119
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::devReff
virtual tmp< volSymmTensorField > devReff() const
Return the effective stress tensor including the laminar stress.
Definition: adjointSpalartAllmaras.C:703
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dP_dNuTilda
tmp< volScalarField > dP_dNuTilda(const volScalarField &dStildadNuTilda) const
Definition: adjointSpalartAllmaras.C:337
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::mask_
volScalarField mask_
Field for masking (convergence enhancement)
Definition: adjointSpalartAllmaras.H:129
Foam::objectiveManager::addTMEqn1Source
virtual void addTMEqn1Source(fvScalarMatrix &adjTMEqn1)=0
Add contribution to first adjoint turbulence model PDE.
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
yPlus
scalar yPlus
Definition: evaluateNearWall.H:16
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::divDevReff
virtual tmp< fvVectorMatrix > divDevReff(volVectorField &U) const
Return the diffusion term for the momentum equation.
Definition: adjointSpalartAllmaras.C:731
Foam::incompressibleAdjoint::adjointTurbulenceModel::nu
tmp< volScalarField > nu() const
Return the laminar viscosity.
Definition: adjointTurbulenceModel.H:155
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::dStilda_dDelta
tmp< volScalarField > dStilda_dDelta(const volScalarField &Omega, const volScalarField &fv2) const
Definition: adjointSpalartAllmaras.C:214
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::wallShapeSensitivities
virtual const boundaryVectorField & wallShapeSensitivities()
Sensitivity terms for shape optimisation, emerging from.
Definition: adjointSpalartAllmaras.C:789
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::correct
virtual void correct()
Solve the adjoint turbulence equations.
Definition: adjointSpalartAllmaras.C:1030
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::productionDestructionSource_
volScalarField productionDestructionSource_
Definition: adjointSpalartAllmaras.H:135
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::DnuTildaEff
tmp< volScalarField > DnuTildaEff() const
Definition: adjointSpalartAllmaras.C:139
Foam::objectiveManager::adjointSolverName
const word & adjointSolverName() const
Return name of the adjointSolver.
Definition: objectiveManager.C:308
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::fvm::div
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:48
Foam::neg
dimensionedScalar neg(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:199
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::dimensionedTensor
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedTensor.H:52
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::Stilda_
volScalarField Stilda_
Definition: adjointSpalartAllmaras.H:136
Foam::incompressibleAdjointMeanFlowVars::UaInst
const volVectorField & UaInst() const
Return const reference to velocity.
Definition: incompressibleAdjointMeanFlowVars.C:237
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:592
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54
Foam::boundaryAdjointContribution::New
static autoPtr< boundaryAdjointContribution > New(const word &managerName, const word &adjointSolverName, const word &simulationType, const fvPatch &patch)
Return a reference to the selected turbulence model.
Definition: boundaryAdjointContribution.C:59
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189
Foam::incompressibleAdjoint::adjointRASModels::adjointSpalartAllmaras::wallFloCoSensitivities
virtual const boundaryVectorField & wallFloCoSensitivities()
Sensitivity terms for flow control, emerging from the.
Definition: adjointSpalartAllmaras.C:812
Foam::fvMesh::V
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
Definition: fvMeshGeometry.C:179
Foam::dev
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:106
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177