|
[Sponsors] |
Do we need special treatment for empty patch? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 15, 2014, 22:58 |
Do we need special treatment for empty patch?
|
#1 |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 14 |
Hi, dear FOAMers,
I have problems to understand the way OF deal with empty patches when it loops over all patches of a field. For example in the following code: Code:
48 forAll(a.boundaryField(), patchi) 49 { 50 a.boundaryField().set(patchi, fvPatchField<scalar>::New("fixedGradient", mesh.boundary()[patchi], a)); 51 } 52 53 forAll(a.boundaryField(), patchi) 54 { 55 fixedGradientFvPatchField<scalar>& aPatch = 56 refCast<fixedGradientFvPatchField<scalar> >(a.boundaryField()[patchi]); 57 Info << aPatch << endl; 58 } 59 Howevre, the second loops leads to a run time error saying: Code:
--> FOAM FATAL ERROR: Attempt to cast type empty to type fixedGradient From function refCast<To>(From&) in file /home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/typeInfo.H at line 114. Why does the first forAll loop ignore the empty patch, while the second doesn't ? Best regards, Lianhua |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 114 | August 23, 2023 05:37 |
createPatch Segmentation Fault (CORE DUMPED) | sam.ho | OpenFOAM Pre-Processing | 2 | April 21, 2014 02:01 |
CheckMeshbs errors | ivanyao | OpenFOAM Running, Solving & CFD | 2 | March 11, 2009 02:34 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 08:19 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 05:12 |