total node number considered for solver

General discussion about Elmer
Post Reply
spacedout
Posts: 34
Joined: 30 Mar 2020, 23:27
Antispam: Yes

total node number considered for solver

Post by spacedout »

Here is another riddle:

If Body 1 and Body 2 are different with a mesh encompassing both but the Solver1 is only to be executed on Body 1:

......

Body 1
Target Bodies(1) = 1
Name = "Body 1"
Equation = 1
Material = 1
End

Equation 1
Name = "whatever"
Active Solvers(1) = 1
End

Body 2
Target Bodies(1) = 2
Name = "Body 1"
Equation = 2
Material = 2
End

Equation 2
Name = "whatever"
Active Solvers(1) = 2
End


Solver 1
Equation = "mu"
Variable = "none"
Variable DOFs = 1

Exported Variable 1 = mu

Procedure = "flnm" "GetMu"

.........

Solver 2

.....

SUBROUTINE GetMu( Model,Solver,dt,TransientSimulation )
USE DefUtils

......

TYPE(Variable_t), POINTER :: muVar

muVar => VariableGet( Solver % Mesh % Variables,'mu')
mu => muVar % Values

Print *, SIZE(mu)

........

I presume the standard Elmer solvers will only consider mesh nodes that belong to Body 1 and not Body 2. Print *, SIZE(mu) would then display the number of nodes in Body 1 (assuming mu is a scalar field variable)


But now if I replace Active Solvers(1) = 2 by Active Solvers(1) = 1 for Equation 2 above I would expect Solver1 to be executed for both bodies

So what should be expected to be displayed by

Print *, SIZE(mu)

For some mysterious reason, this display does not change from when Solver1 was being executed only on Body 1
mika
Posts: 174
Joined: 15 Sep 2009, 07:44

Re: total node number considered for solver

Post by mika »

A variable (of type Variable_t) is associated with a permutation array showing whether this variable is active at a node and how the entries are mapped in the assembly. To see the number of DOFs which are active one may test

Code: Select all

COUNT( muVar % Perm > 0)
-- Mika
spacedout
Posts: 34
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: total node number considered for solver

Post by spacedout »

Thanks a lot for the reply. I have now greater understanding of the code and as a byproduct, I now know that when I write a new solver, I need to add an if statement to skip the current index in a loop over all nodes of a given mesh:

muPerm => muVar % Perm

DO i=1,Model % NumberOfNodes

IF( muPerm(i) == 0 ) CYCLE

..............

END DO
Post Reply