First commit for average scheme

New module defined that will take care of averaging the output in the
nodes.
This commit is contained in:
Jorge Gonzalez 2022-12-14 16:22:59 +01:00
commit b2eb7c5622
6 changed files with 151 additions and 9 deletions

View file

@ -1,9 +1,19 @@
!Contains information about output
MODULE moduleOutput
IMPLICIT NONE
!Output for each node
TYPE outputNode
TYPE, PUBLIC:: outputNode
REAL(8):: den = 0.D0, mom(1:3) = 0.D0, tensorS(1:3,1:3) = 0.D0
CONTAINS
PROCEDURE, PASS(self), PRIVATE:: copyOutputNode
PROCEDURE, PASS(self), PRIVATE:: addOutputNode
PROCEDURE, PASS(self), PRIVATE:: subOutputNode
PROCEDURE, PASS(self), PRIVATE:: divOutputNode_int
GENERIC, PUBLIC :: ASSIGNMENT(=) => copyOutputNode
GENERIC, PUBLIC :: OPERATOR(+) => addOutputNode
GENERIC, PUBLIC :: OPERATOR(-) => subOutputNode
GENERIC, PUBLIC :: OPERATOR(/) => divOutputNode_int
END TYPE
@ -32,16 +42,56 @@ MODULE moduleOutput
LOGICAL:: emOutput = .FALSE.
CONTAINS
FUNCTION tensorTrace(a) RESULT(t)
PURE SUBROUTINE copyOutputNode(self, from)
IMPLICIT NONE
REAL(8), DIMENSION(1:3,1:3):: a
REAL(8):: t
CLASS(outputNode), INTENT(inout):: self
CLASS(outputNode), INTENT(in):: from
t = 0.D0
t = a(1,1)+a(2,2)+a(3,3)
self%den = from%den
self%mom = from%mom
self%tensorS = from%tensorS
END FUNCTION tensorTrace
END SUBROUTINE copyOutputNode
PURE FUNCTION addOutputNode(self, that) RESULT(total)
IMPLICIT NONE
CLASS(outputNode), INTENT(in):: self
CLASS(outputNode), INTENT(in):: that
TYPE(outputNode):: total
total%den = self%den + that%den
total%mom = self%mom + that%mom
total%tensorS = self%tensorS + that%tensorS
END FUNCTION addOutputNode
PURE FUNCTION subOutputNode(self, that) RESULT(total)
IMPLICIT NONE
CLASS(outputNode), INTENT(in):: self
CLASS(outputNode), INTENT(in):: that
TYPE(outputNode):: total
total%den = self%den - that%den
total%mom = self%mom - that%mom
total%tensorS = self%tensorS - that%tensorS
END FUNCTION subOutputNode
PURE FUNCTION divOutputNode_int(self, that) RESULT(total)
IMPLICIT NONE
CLASS(outputNode), INTENT(in):: self
INTEGER, INTENT(in):: that
TYPE(outputNode):: total
total%den = self%den / REAL(that)
total%mom = self%mom / REAL(that)
total%tensorS = self%tensorS / REAL(that)
END FUNCTION divOutputNode_int
SUBROUTINE calculateOutput(rawValues, formatValues, nodeVol, speciesIn)
USE moduleConstParam