CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Technical] Negative labels in faceProcAddressing

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2011, 06:56
Default Negative labels in faceProcAddressing
  #1
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi

I am working a bit with the procAddressing, because I have a submesh, which is generated inside the solver, so it has no *procAddressing files attached to it, which means I need to generate these prior to be able to use

reconstrucPar -region submesh

One question, however, is that in faceProcAddressing some of the labels are negative. These labels correspond to boundary labels on a procBoundary<N>to<M>. These negative labels, are they reflecting the fact that the corresponding boundary procBoundary<M>to<N> is the owner of the faces and the latter boundary is "neighbouring" those same faces?

Thanks

Niels
ngj is offline   Reply With Quote

Old   February 21, 2011, 04:42
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Hi Niels,

As a matter of fact, I have recently finished the parallel mesh+field reconstruction tool that works without addressing from decomposition - it is needed for parallelised topological changes. It unfortunately requires changes in the library, so it will come out with the next release.

As for negative labels, I have just been looking at that - have a look at decomposePar source code and search for "turning index" comments. This is one of mine, and the date (one of those deleted from the source code by Henry Weller and OpenCFD) is 5/Dec/2001. This is how it works:

- since the processor boundary represents the same internal face twice, we need to remember whether the face has been flipped or not. For a flipped face, the index is negative;
- however, the complete numbering needs to offset by one to account for flipping of face zero.
- take the sign: if it is negative, the face is flipped
- calculate mag(addressingIndex) - 1 and you will get the global face index.

Enjoy,

Hrv
fumiya and serles like this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 21, 2011, 05:21
Default
  #3
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Hrv

Perfect! Thanks for that explanation, it solved one of my headaches in the faceProcAddressing, as I have completed a small matlab script which generates all the addressing on my submesh, but I could not understand why the indices where off by 1 and especially why index 0 where not their at all in any available faceProcAddressing.

BTW: Are you planning to give a summer school in Zagreb this year?

Thanks,

Niels
ngj is offline   Reply With Quote

Old   February 21, 2011, 05:29
Default
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Good hunting, Niels.

Since you already have the global addressing indices and local-to-global mesh mapping, you can easily sort out the other ones.

The Summer School will happen in Zagreb as usual - the announcement is my "birthday present", so please wait for it for a few days.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 21, 2011, 05:34
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Okay, I will await the announcement patiently. Pre-congratulations

/ Niels
ngj is offline   Reply With Quote

Old   February 23, 2011, 18:30
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Guide: Reconstructing parallel processed runtime generated submeshes.

As seen above, the files {point,face,cell}ProcAddressing in connected to submeshes are not generated soforth the submesh is generated runtime. This means that as of present no tools are available to reconstruct the submesh. I have created a Matlab routine to generated these, and the guideline is as follows:

1. On the global (non-decomposed mesh), write the {point,face,cell}Maps, which can be obtained from fvMeshSubset.H.

2. Load these into your favourite language. I have used Matlab, so note that it start indexing on 1! The maps are called pm, fm and cm.

3. Loop over each processors. In these load the {point,face,cell}ProcAddressing for the decomposed mesh in processor*/constant/polyMesh. For both cells and points the method is straight forward. These ProcAddressings are called: ppa, fpa, cpa.

Code:
// Cell:
count = 0;
for j=1:length(cpa)
    I = find(cm == cpa(j))
    if ~isempty(I)
          count = count + 1; subcpa(count) = I - 1;
    end
end
subcpa = subcpa(1:count)

// Point:
count = 0;
for j=1:length(ppa)
    I = find(pm == ppa(j))
    if ~isempty(I)
          count = count + 1; subppa(count) = I - 1;
    end
end
subppa = subppa(1:count)
The method for faceProcAddressing is a bit more complex. Do as follows remembering that faceProcAddressing can be negative and is offset by 1. See Hrv's post above.

Code:
fpa = sign(fpa) .* ( abs(fpa) - 1);

for j=1:length(fpa)
    I = find(fm == abs(fpa(j)));
    
    if ~isempty(I)
        count = count + 1;
        if fpa(j) == 0 // sign(0) = 0, so not good ;)
            subfpa(count) = I;
        else
            subfpa(count) = sign(fpa(j)) * (I);
        end
    end
end
subfpa = subfpa(1:count);
This, however, is not sufficiently, as a submesh will typically have gotten some new boundaries, hence faces on the top level mesh being internal are now boundary face and they might appear some arbitrary place in subpfa. So:

a. Look in the boundary file for the non-decomposed submesh and locate the startFace for the problematic boundary (assuming only one such boundary in this description). Call this integer: nStart.

b. In the processor directory locate the number of faces, say N, following the problematic boundary. There will always be some, at least procBoundary<N>to<M> type boundaries.

c. Do the following index swapping in subfpa:

Code:
I             = find( subfpa >= nStart + 1); // Offset by 1!
bcs         = subfpa(I);
subfpa(I) = [];
subfpa    = [subfpa(1:end-N); bcs; subfpa(end-N+1:end)];
4. Write the {point,face,cell}ProcAddressing files to
processor*/constant/submeshName/polyMesh/.

I hope this can help someone.

Best regards,

Niels
ngj is offline   Reply With Quote

Old   March 29, 2011, 15:54
Default
  #7
Member
 
Matthew J. Churchfield
Join Date: Nov 2009
Location: Boulder, Colorado, USA
Posts: 49
Rep Power: 18
mchurchf is on a distinguished road
Hrv,

Will the next release also include a parallel mesh+field decomposition tool?

Matt
mchurchf is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


All times are GMT -4. The time now is 17:39.