16 #beginMacro setTemperatureBC(tc,NAME,BCNAME,OPTION)
17 if( assignTemperature )
19 #If #OPTION == "dirichlet" || #OPTION == "mixed" || #OPTION == "extrapolateGhost"
21 Overture::abort(
"ERROR in calling setTemperatureBC macro with option=OPTION");
24 FILE *& debugFile = parameters.dbase.get<FILE* >(
"debugFile");
25 FILE *& pDebugFile = parameters.dbase.get<FILE* >(
"pDebugFile");
44 realSerialArray
uLocal; getLocalArrayWithGhostBoundaries(
u,uLocal);
46 const realSerialArray & uLocal =
u;
50 getBoundaryIndex(
mg.gridIndexRange(),
side,
axis,Ib1,Ib2,Ib3);
51 bool ok = ParallelUtility::getLocalArrayBounds(
u,uLocal,Ib1,Ib2,Ib3);
55 printP(
"NAME:applyBC: apply a mixed BC on the interface (side,axis,grid)=(%i,%i,%i) %f*T + %f*T.n \n",
56 side,axis,
grid,
mixedCoeff(
tc,
side,axis,
grid),
mixedNormalCoeff(
tc,
side,axis,
grid));
58 fprintf(pDebugFile,
"NAME:applyBC: apply a mixed BC on the interface (side,axis,grid)=(%i,%i,%i) %f*T + %f*T.n \n",
59 side,axis,
grid,
mixedCoeff(
tc,
side,axis,
grid),
mixedNormalCoeff(
tc,
side,axis,
grid));
60 if( pBoundaryData[
side][axis]==NULL )
63 fprintf(pDebugFile,
" NAME:applyBC on T: pBoundaryData[side][axis] == NULL! \n");
65 fprintf(pDebugFile,
" NAME:applyBC on T: ERROR: pBoundaryData[side][axis] == NULL! \n");
77 if( ok && pBoundaryData[
side][axis]==NULL )
82 RealArray & bd = parameters.getBoundaryData(
side,axis,
grid,
mg);
86 const RealArray &
normal =
mg.vertexBoundaryNormalArray(
side,axis);
88 const RealArray & normal =
mg.vertexBoundaryNormal(
side,axis);
95 MappedGridOperators & op = *(
u.getOperators());
97 RealArray
ux(Ib1,Ib2,Ib3,N),
uy(Ib1,Ib2,Ib3,N);
98 op.derivative(MappedGridOperators::xDerivative,uLocal,
ux,Ib1,Ib2,Ib3,N);
99 op.derivative(MappedGridOperators::yDerivative,uLocal,uy,Ib1,Ib2,Ib3,N);
100 if(
mg.numberOfDimensions()==2 )
102 bd(Ib1,Ib2,Ib3,
tc)=a1*(
normal(Ib1,Ib2,Ib3,0)*
ux(Ib1,Ib2,Ib3,
tc)+
107 RealArray
uz(Ib1,Ib2,Ib3,N);
108 op.derivative(MappedGridOperators::zDerivative,uLocal,uz,Ib1,Ib2,Ib3,N);
109 bd(Ib1,Ib2,Ib3,
tc)=a1*(
normal(Ib1,Ib2,Ib3,0)*
ux(Ib1,Ib2,Ib3,
tc)+
114 const bool twilightZoneFlow = parameters.dbase.get<
bool >(
"twilightZoneFlow");
115 if(
false && twilightZoneFlow )
117 fprintf(pDebugFile,
" NAME:applyBC on T: ********** Set TRUE value for bd at t=%8.2e ************\n",t);
118 const bool rectangular=
mg.isRectangular() && !twilightZoneFlow;
120 realArray &
x=
mg.center();
122 realSerialArray xLocal;
123 if( !rectangular || twilightZoneFlow )
124 getLocalArrayWithGhostBoundaries(x,xLocal);
126 const realSerialArray & xLocal =
x;
129 OGFunction &
e = *(parameters.dbase.get<OGFunction* >(
"exactSolution"));
130 realSerialArray
ue(Ib1,Ib2,Ib3),
uex(Ib1,Ib2,Ib3),
uey(Ib1,Ib2,Ib3);
131 e.gd(
ue ,xLocal,
mg.numberOfDimensions(),rectangular,0,0,0,0,Ib1,Ib2,Ib3,
tc,t);
132 e.gd(
uex,xLocal,
mg.numberOfDimensions(),rectangular,0,1,0,0,Ib1,Ib2,Ib3,
tc,t);
133 e.gd( uey,xLocal,
mg.numberOfDimensions(),rectangular,0,0,1,0,Ib1,Ib2,Ib3,
tc,t);
136 if(
mg.numberOfDimensions()==2 )
138 bd(Ib1,Ib2,Ib3,tc)=a1*(
normal(Ib1,Ib2,Ib3,0)*
uex(Ib1,Ib2,Ib3)+
139 normal(Ib1,Ib2,Ib3,1)*
uey(Ib1,Ib2,Ib3)) + a0*
ue(Ib1,Ib2,Ib3);
143 realSerialArray uez(Ib1,Ib2,Ib3);
144 e.gd( uez,xLocal,
mg.numberOfDimensions(),rectangular,0,0,0,1,Ib1,Ib2,Ib3,
tc,t);
145 bd(Ib1,Ib2,Ib3,tc)=a1*(
normal(Ib1,Ib2,Ib3,0)*
uex(Ib1,Ib2,Ib3)+
147 normal(Ib1,Ib2,Ib3,2)*uez(Ib1,Ib2,Ib3)) + a0*
ue(Ib1,Ib2,Ib3);
154 if( pBoundaryData[
side][axis]!=NULL )
155 u.getOperators()->setTwilightZoneFlow(
false );
158 if( t>0. || debug() & 4 )
161 printP(
"$$$$ NAME:applyBC:INFO:interface but no boundaryData, t=%9.3e\n",t);
168 printF(
"++++NAME: BCNAME: (grid,side,axis)=(%i,%i,%i) : "
169 " BC for T: %3.2f*T+%3.2f*T.n=%3.2f, \n"
170 " BC: u: %3.2f*u+%3.2f*u.n=%3.2f, v: %3.2f*v+%3.2f*v.n=%3.2f \n",
172 mixedCoeff(
tc,
side,
axis,
grid),
mixedNormalCoeff(
tc,
side,
axis,
grid),
mixedRHS(
tc,
side,
axis,
grid),
173 mixedCoeff(
uc,
side,
axis,
grid),
mixedNormalCoeff(
uc,
side,
axis,
grid),
mixedRHS(
uc,
side,
axis,
grid),
174 mixedCoeff(
vc,
side,
axis,
grid),
mixedNormalCoeff(
vc,
side,
axis,
grid),
mixedRHS(
vc,
side,
axis,
grid)
195 #If #OPTION == "dirichlet"
198 #Elif #OPTION == "extrapolateGhost"
199 u.applyBoundaryCondition(
tc,extrapolate,BCTypes::boundary(
side,
axis),0.,t);
204 else if( bd.hasVariableCoefficientBoundaryCondition(
side,
axis) )
208 printF(
"setTemperatureBC:INFO: grid=%i (side,axis)=(%i,%i) HAS a var coeff. temperature BC!\n",
214 RealArray & varCoeff = bd.getVariableCoefficientBoundaryConditionArray(
217 bcParams.setVariableCoefficientsArray(&varCoeff);
219 u.applyBoundaryCondition(
tc,mixed,BCTypes::boundary(
side,
axis),bcData,pBoundaryData,t,
222 bcParams.setVariableCoefficientsArray(NULL);
230 #If #OPTION == "mixed"
236 if( a0==0. && a1==1. )
239 printF(
"++++NAME: BCNAME:adiabaticWall: (grid,side,axis)=(%i,%i,%i) : apply neumannBC\n",
250 u.applyBoundaryCondition(
tc,extrapolate,BCTypes::boundary(
side,
axis),0.,t);
254 u.applyBoundaryCondition(
tc,neumann,BCTypes::boundary(
side,
axis),bcData,pBoundaryData,t,
263 fPrintF(pDebugFile,
"++++NAME:BCNAME:adiabaticWall: (grid,side,axis)=(%i,%i,%i) : "
264 "Mixed BC for T: %3.2f*T+%3.2f*T.n=%3.2f (t=%8.2e)\n",
271 getBoundaryIndex(
mg.gridIndexRange(),
side,
axis,Ib1,Ib2,Ib3);
272 RealArray & bd = parameters.getBoundaryData(
side,axis,
grid,
mg);
273 ::display(bd(Ib1,Ib2,Ib3,
tc),
"NAME:BCNAME:T: RHS for mixed BC: bd(Ib1,Ib2,Ib3,tc)",pDebugFile,
"%5.2f ");
277 ::display(
u(Ig1,Ig2,Ig3,
tc),
"NAME:BCNAME:T: BEFORE mixed BC: u(I1,I2,I3,tc)",pDebugFile,
"%5.2f ");
286 u.applyBoundaryCondition(
tc,extrapolate,BCTypes::boundary(
side,
axis),0.,t);
290 u.applyBoundaryCondition(
tc,mixed,BCTypes::boundary(
side,
axis),bcData,pBoundaryData,t,
300 ::display(
u(Ig1,Ig2,Ig3,
tc),
"NAME:BCNAME:T: AFTER mixed BC: u(I1,I2,I3,tc)",pDebugFile,
"%5.2f ");
312 u.getOperators()->setTwilightZoneFlow( parameters.dbase.get<
bool >(
"twilightZoneFlow") );