Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "StandardWallInteraction.H"
00027
00028
00029
00030 template <class CloudType>
00031 Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
00032 (
00033 const dictionary& dict,
00034 CloudType& cloud
00035 )
00036 :
00037 PatchInteractionModel<CloudType>(dict, cloud, typeName),
00038 interactionType_
00039 (
00040 this->wordToInteractionType(this->coeffDict().lookup("type"))
00041 ),
00042 e_(0.0),
00043 mu_(0.0)
00044 {
00045 switch (interactionType_)
00046 {
00047 case PatchInteractionModel<CloudType>::itOther:
00048 {
00049 word interactionTypeName(this->coeffDict().lookup("type"));
00050
00051 FatalErrorIn
00052 (
00053 "StandardWallInteraction<CloudType>::StandardWallInteraction"
00054 "("
00055 "const dictionary&, "
00056 "CloudType& cloud"
00057 ")"
00058 ) << "Unknown interaction result type "
00059 << interactionTypeName
00060 << ". Valid selections are:" << this->interactionTypeNames_
00061 << endl << exit(FatalError);
00062
00063 break;
00064 }
00065 case PatchInteractionModel<CloudType>::itRebound:
00066 {
00067 e_ = this->coeffDict().lookupOrDefault("e", 1.0);
00068 mu_ = this->coeffDict().lookupOrDefault("mu", 0.0);
00069 break;
00070 }
00071 default:
00072 {
00073
00074 }
00075 }
00076 }
00077
00078
00079
00080
00081 template <class CloudType>
00082 Foam::StandardWallInteraction<CloudType>::~StandardWallInteraction()
00083 {}
00084
00085
00086
00087
00088 template<class CloudType>
00089 bool Foam::StandardWallInteraction<CloudType>::active() const
00090 {
00091 return true;
00092 }
00093
00094
00095 template <class CloudType>
00096 bool Foam::StandardWallInteraction<CloudType>::correct
00097 (
00098 const polyPatch& pp,
00099 const label faceId,
00100 bool& keepParticle,
00101 bool& active,
00102 vector& U
00103 ) const
00104 {
00105 if (isA<wallPolyPatch>(pp))
00106 {
00107 switch (interactionType_)
00108 {
00109 case PatchInteractionModel<CloudType>::itEscape:
00110 {
00111 keepParticle = false;
00112 active = false;
00113 U = vector::zero;
00114 break;
00115 }
00116 case PatchInteractionModel<CloudType>::itStick:
00117 {
00118 keepParticle = true;
00119 active = false;
00120 U = vector::zero;
00121 break;
00122 }
00123 case PatchInteractionModel<CloudType>::itRebound:
00124 {
00125 keepParticle = true;
00126 active = true;
00127
00128 vector nw = pp.faceAreas()[pp.whichFace(faceId)];
00129 nw /= mag(nw);
00130
00131 scalar Un = U & nw;
00132 vector Ut = U - Un*nw;
00133
00134 if (Un > 0)
00135 {
00136 U -= (1.0 + e_)*Un*nw;
00137 }
00138
00139 U -= mu_*Ut;
00140
00141 break;
00142 }
00143 default:
00144 {
00145 FatalErrorIn
00146 (
00147 "bool StandardWallInteraction<CloudType>::correct"
00148 "("
00149 "const polyPatch&, "
00150 "const label, "
00151 "bool&, "
00152 "vector&"
00153 ") const"
00154 ) << "Unknown interaction type "
00155 << this->interactionTypeToWord(interactionType_)
00156 << "(" << interactionType_ << ")" << endl
00157 << abort(FatalError);
00158 }
00159 }
00160
00161 return true;
00162 }
00163
00164 return false;
00165 }
00166
00167
00168