Check if element is active in other solver

Numerical methods and mathematical models of Elmer
Post Reply
Franz Pichler
Posts: 196
Joined: 29 Sep 2011, 12:25
Antispam: Yes

Check if element is active in other solver

Post by Franz Pichler »

Hi there,

i would like to perform some calculations in teh element assembly loop only if a certain element is active also in another solver.

What would you think is the best way to check that?

My first (very slow) solution would be something like

Code: Select all

otherSolver => GETOTHERSOLVER

DO t1=1,GetNOfActive()
   Element1 => GetActiveElement(t1)
   DO t2=1,GetNOfActive(OtherSolver)
       Element2 => GetActiveElement(t2)
       if (Element1%ElementIndex==Element2%ElementIndex) then
            PERFORM STUFF
       end if
    end do
end do 
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Check if element is active in other solver

Post by raback »

Hi

I would (for nodal fields) do something like this:

Code: Select all

DO t1=1,GetNOfActive()
   Element1 => GetActiveElement(t1)
   IF( ANY( Solver2 % Variable % Perm( Element1 % NodeIndexes ) == 0 ) ) CYCLE
   ! PERFORM STUFF
END DO
There are many ways to do this....

-Peter
Post Reply