From 68ea3fd0b86ddb8d3b4f1eb632267542f93fcc79 Mon Sep 17 00:00:00 2001
From: shion <106575883+shishiousan@users.noreply.github.com>
Date: Sat, 16 Mar 2024 17:46:03 +0900
Subject: [PATCH 1/2] Updates in ScalarField_Class

- Working in progress
---
 .../ScalarField/src/ScalarField_Class@SetMethods.F90   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/submodules/ScalarField/src/ScalarField_Class@SetMethods.F90 b/src/submodules/ScalarField/src/ScalarField_Class@SetMethods.F90
index 425c84ef9..60fe0a434 100644
--- a/src/submodules/ScalarField/src/ScalarField_Class@SetMethods.F90
+++ b/src/submodules/ScalarField/src/ScalarField_Class@SetMethods.F90
@@ -369,8 +369,8 @@
 CHARACTER(*), PARAMETER :: myName = "obj_SetByFunction()"
 LOGICAL(LGT) :: istimes, problem
 INTEGER(I4B) :: ttime, returnType, nsd, tnodes, ii, globalNode(1)
-REAL(DFP), ALLOCATABLE :: xij(:, :)
-REAL(DFP) :: args(4), VALUE
+REAL(DFP), ALLOCATABLE :: xij(:, :), args(:)
+REAL(DFP) :: VALUE
 INTEGER(I4B), PARAMETER :: needed_returnType = Scalar
 CLASS(Domain_), POINTER :: dom
 
@@ -382,11 +382,15 @@
 istimes = PRESENT(times)
 problem = .FALSE.
 
-args = 0.0_DFP
 IF (istimes) THEN
+  ALLOCATE (args(4))
+  args = 0.0_DFP
   ttime = SIZE(times)
   args(4) = times(1)
   problem = ttime .NE. 1_I4B
+ELSE
+  ALLOCATE (args(3))
+  args = 0.0_DFP
 END IF
 
 IF (problem) THEN

From 821102e48af7f2a2146a1e8d760497b2e482da9f Mon Sep 17 00:00:00 2001
From: shion <shimizu.shion819@gmail.com>
Date: Tue, 4 Jun 2024 18:18:02 +0900
Subject: [PATCH 2/2] Updates in classes

- minor changes
---
 src/modules/AbstractKernel/src/AbstractKernel_Class.F90   | 2 ++
 src/modules/AbstractMesh/src/ElemData_Class.F90           | 8 ++++----
 src/modules/FPL/src/FPL_Method.F90                        | 2 +-
 .../src/AbstractKernel_Class@ConstructorMethods.F90       | 1 +
 src/submodules/AbstractMesh/src/AbstractMeshUtility.F90   | 2 +-
 .../src/AbstractMesh_Class@EdgeDataMethods.F90            | 6 +++---
 .../src/AbstractMesh_Class@ElementDataMethods.F90         | 2 +-
 .../src/AbstractMesh_Class@FaceDataMethods.F90            | 8 ++++----
 .../AbstractMesh/src/AbstractMesh_Class@GetMethods.F90    | 6 +++---
 src/submodules/RefElement/src/Topology_Class@Methods.F90  | 8 ++++++++
 10 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/src/modules/AbstractKernel/src/AbstractKernel_Class.F90 b/src/modules/AbstractKernel/src/AbstractKernel_Class.F90
index dbada5f09..417d5eee0 100644
--- a/src/modules/AbstractKernel/src/AbstractKernel_Class.F90
+++ b/src/modules/AbstractKernel/src/AbstractKernel_Class.F90
@@ -151,6 +151,8 @@ MODULE AbstractKernel_Class
   !! algorithm
   INTEGER(I4B) :: vtkOutputFreq = 0
   !! frequency of output with WriteData_vtk
+  INTEGER(I4B) :: hdfOutputFreq = 0
+  !! frequency of output with WriteData_vtk
   TYPE(String) :: name
   !! This is the name of the kernel. It can be anything you want.
   TYPE(String) :: engine
diff --git a/src/modules/AbstractMesh/src/ElemData_Class.F90 b/src/modules/AbstractMesh/src/ElemData_Class.F90
index 4c3d94975..19b8aa8b3 100644
--- a/src/modules/AbstractMesh/src/ElemData_Class.F90
+++ b/src/modules/AbstractMesh/src/ElemData_Class.F90
@@ -18,8 +18,8 @@
 MODULE ElemData_Class
 USE GlobalData, ONLY: I4B, DFP, LGT, INT8
 USE Display_Method, ONLY: Display
-USE ReferenceElement_Method, ONLY: REFELEM_MAX_FACES,  &
-  & REFELEM_MAX_POINTS, RefElemGetGeoParam, ElementName
+USE ReferenceElement_Method, ONLY: PARAM_REFELEM_MAX_FACES,  &
+  & PARAM_REFELEM_MAX_POINTS, RefElemGetGeoParam, ElementName
 USE ReferenceQuadrangle_Method, ONLY: HelpFaceData_Quadrangle,  &
   & FaceShapeMetaData_Quadrangle
 USE SortUtility
@@ -439,8 +439,8 @@ SUBROUTINE ElemData_GetGlobalFaceCon(obj, globalFaceCon, localFaceCon)
   INTEGER(I4B), INTENT(INOUT) :: globalFaceCon(:, :)
   INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: localFaceCon(:, :)
 
-  INTEGER(I4B) :: tFaces, tNodes, localFaces0(4_I4B, REFELEM_MAX_FACES),  &
-    & faceElemType(REFELEM_MAX_FACES), tFaceNodes(REFELEM_MAX_FACES),  &
+  INTEGER(I4B) :: tFaces, tNodes, localFaces0(4_I4B, PARAM_REFELEM_MAX_FACES),  &
+    & faceElemType(PARAM_REFELEM_MAX_FACES), tFaceNodes(PARAM_REFELEM_MAX_FACES),  &
     & iface, face_temp(4), aint
 
   CALL RefElemGetGeoParam(elemType=obj%name,  &
diff --git a/src/modules/FPL/src/FPL_Method.F90 b/src/modules/FPL/src/FPL_Method.F90
index e50910117..6fe03dc75 100644
--- a/src/modules/FPL/src/FPL_Method.F90
+++ b/src/modules/FPL/src/FPL_Method.F90
@@ -630,7 +630,7 @@ SUBROUTINE fpl_Get_Bool(obj, prefix, key, VALUE)
   TYPE(ParameterList_), INTENT(IN) :: obj
   CHARACTER(*), INTENT(IN) :: prefix
   CHARACTER(*), INTENT(IN) :: key
-  LOGICAL(LGT), INTENT(OUT) :: VALUE
+  LOGICAL(LGT), INTENT(INOUT) :: VALUE
   ! Internal variable
   INTEGER(I4B) :: ierr
   TYPE(String) :: varname
diff --git a/src/submodules/AbstractKernel/src/AbstractKernel_Class@ConstructorMethods.F90 b/src/submodules/AbstractKernel/src/AbstractKernel_Class@ConstructorMethods.F90
index ba672ecc7..74fc18500 100644
--- a/src/submodules/AbstractKernel/src/AbstractKernel_Class@ConstructorMethods.F90
+++ b/src/submodules/AbstractKernel/src/AbstractKernel_Class@ConstructorMethods.F90
@@ -777,6 +777,7 @@
 CALL AbstractMeshFieldDeallocate(obj%Cijkl)
 CALL AbstractMeshFieldDeallocate(obj%stress)
 CALL AbstractMeshFieldDeallocate(obj%strain)
+CALL AbstractMeshFieldDeallocate(obj%scalarCoefficient)
 
 NULLIFY (obj%bodySourceFunc)
 
diff --git a/src/submodules/AbstractMesh/src/AbstractMeshUtility.F90 b/src/submodules/AbstractMesh/src/AbstractMeshUtility.F90
index 0b2346454..5c3e85a44 100644
--- a/src/submodules/AbstractMesh/src/AbstractMeshUtility.F90
+++ b/src/submodules/AbstractMesh/src/AbstractMeshUtility.F90
@@ -58,7 +58,7 @@ SUBROUTINE InitiateElementToElements3D(elementData, tFaceInMesh, showTime)
   CHARACTER(*), PARAMETER :: myName = "obj_InitiateElementToElements3D()"
   LOGICAL(LGT) :: problem, isok1, isok2, isbndy
   INTEGER(I4B) :: telems, iel, aint, bint, tfaces, ii, jj, &
-    & temp1(3 * REFELEM_MAX_FACES), cint, bndyflag(REFELEM_MAX_FACES)
+ & temp1(3 * PARAM_REFELEM_MAX_FACES), cint, bndyflag(PARAM_REFELEM_MAX_FACES)
   INTEGER(I4B), ALLOCATABLE :: face2elem(:, :)
   LOGICAL(LGT), ALLOCATABLE :: amask(:)
   TYPE(CPUTime_) :: TypeCPUTime
diff --git a/src/submodules/AbstractMesh/src/AbstractMesh_Class@EdgeDataMethods.F90 b/src/submodules/AbstractMesh/src/AbstractMesh_Class@EdgeDataMethods.F90
index 83e39b3c0..2f378938f 100644
--- a/src/submodules/AbstractMesh/src/AbstractMesh_Class@EdgeDataMethods.F90
+++ b/src/submodules/AbstractMesh/src/AbstractMesh_Class@EdgeDataMethods.F90
@@ -16,8 +16,8 @@
 !
 
 SUBMODULE(AbstractMesh_Class) EdgeDataMethods
-USE ReferenceElement_Method, ONLY: REFELEM_MAX_EDGES,  &
-  & REFELEM_MAX_POINTS, RefElemGetGeoParam
+USE ReferenceElement_Method, ONLY: PARAM_REFELEM_MAX_EDGES,  &
+  & PARAM_REFELEM_MAX_POINTS, RefElemGetGeoParam
 USE ReferenceLine_Method, ONLY: MaxOrder_Line
 USE ReallocateUtility, ONLY: Reallocate
 USE EdgeData_Class
@@ -34,7 +34,7 @@
 MODULE PROCEDURE obj_InitiateEdgeConnectivity
 CHARACTER(*), PARAMETER :: myName = "obj_InitiateEdgeConnectivity()"
 INTEGER(I4B) :: tElements, iel, elemType, tEdges,  &
-  & localEdges(MaxOrder_Line + 1, REFELEM_MAX_EDGES), &
+  & localEdges(MaxOrder_Line + 1, PARAM_REFELEM_MAX_EDGES), &
   & edge(2), sorted_edge(2), &
   & tNodes, tsize1, tsize2, iedge
 LOGICAL(LGT) :: problem
diff --git a/src/submodules/AbstractMesh/src/AbstractMesh_Class@ElementDataMethods.F90 b/src/submodules/AbstractMesh/src/AbstractMesh_Class@ElementDataMethods.F90
index e8a1d57c7..be37fb910 100644
--- a/src/submodules/AbstractMesh/src/AbstractMesh_Class@ElementDataMethods.F90
+++ b/src/submodules/AbstractMesh/src/AbstractMesh_Class@ElementDataMethods.F90
@@ -18,7 +18,7 @@
 SUBMODULE(AbstractMesh_Class) ElementDataMethods
 USE ReallocateUtility
 USE Display_Method
-USE ReferenceElement_Method, ONLY: REFELEM_MAX_FACES
+USE ReferenceElement_Method, ONLY: PARAM_REFELEM_MAX_FACES
 USE AbstractMeshUtility, ONLY: InitiateElementToElements3D, &
   & InitiateElementToElements2D, &
   & InitiateElementToElements1D
diff --git a/src/submodules/AbstractMesh/src/AbstractMesh_Class@FaceDataMethods.F90 b/src/submodules/AbstractMesh/src/AbstractMesh_Class@FaceDataMethods.F90
index 1996fc7c7..4ce22605a 100644
--- a/src/submodules/AbstractMesh/src/AbstractMesh_Class@FaceDataMethods.F90
+++ b/src/submodules/AbstractMesh/src/AbstractMesh_Class@FaceDataMethods.F90
@@ -16,8 +16,8 @@
 !
 
 SUBMODULE(AbstractMesh_Class) FaceDataMethods
-USE ReferenceElement_Method, ONLY: REFELEM_MAX_FACES,  &
-  & REFELEM_MAX_POINTS,  &
+USE ReferenceElement_Method, ONLY: PARAM_REFELEM_MAX_FACES,  &
+  & PARAM_REFELEM_MAX_POINTS,  &
   & RefElemGetGeoParam,  &
   & IsQuadrangle
 
@@ -40,9 +40,9 @@
 MODULE PROCEDURE obj_InitiateFaceConnectivity
 CHARACTER(*), PARAMETER :: myName = "obj_InitiateFaceConnectivity()"
 INTEGER(I4B) :: tElements, iel, elemType, tFaces,  &
-  & localFaces(4_I4B, REFELEM_MAX_FACES), face(4), sorted_face(4),  &
+  & localFaces(4_I4B, PARAM_REFELEM_MAX_FACES), face(4), sorted_face(4),  &
   & tNodes, tsize1, tsize2, iface,  &
-  & faceElemType(REFELEM_MAX_FACES), tFaceNodes(REFELEM_MAX_FACES),  &
+  & faceElemType(PARAM_REFELEM_MAX_FACES), tFaceNodes(PARAM_REFELEM_MAX_FACES),  &
   & aint, faceOrient(3_I4B)
 LOGICAL(LGT) :: problem, abool
 TYPE(FaceDataBinaryTree_) :: faceTree
diff --git a/src/submodules/AbstractMesh/src/AbstractMesh_Class@GetMethods.F90 b/src/submodules/AbstractMesh/src/AbstractMesh_Class@GetMethods.F90
index 78700f116..f0e29b41f 100644
--- a/src/submodules/AbstractMesh/src/AbstractMesh_Class@GetMethods.F90
+++ b/src/submodules/AbstractMesh/src/AbstractMesh_Class@GetMethods.F90
@@ -21,7 +21,7 @@
 USE BoundingBox_Method
 USE InputUtility
 USE Display_Method
-USE ReferenceElement_Method, ONLY: REFELEM_MAX_FACES, &
+USE ReferenceElement_Method, ONLY: PARAM_REFELEM_MAX_FACES, &
   & GetEdgeConnectivity,  &
   & GetFaceConnectivity,  &
   & ElementOrder, &
@@ -1315,8 +1315,8 @@
 #endif
 
 INTEGER(I4B) :: iel, temp4(4), elemType, order,  &
-  & con(MaxNodesInElement, REFELEM_MAX_FACES), &
-  & ii, tFaceNodes(REFELEM_MAX_FACES)
+  & con(MaxNodesInElement, PARAM_REFELEM_MAX_FACES), &
+  & ii, tFaceNodes(PARAM_REFELEM_MAX_FACES)
 
 iel = obj%GetLocalElemNumber(globalElement, islocal=islocal)
 
diff --git a/src/submodules/RefElement/src/Topology_Class@Methods.F90 b/src/submodules/RefElement/src/Topology_Class@Methods.F90
index c1e1b1b48..96e2d63fb 100644
--- a/src/submodules/RefElement/src/Topology_Class@Methods.F90
+++ b/src/submodules/RefElement/src/Topology_Class@Methods.F90
@@ -231,6 +231,14 @@
   ans(4)%nptrs = nptrs([4, 1, 8])
   ans(1:)%xidimension = 1
   ans(1:)%name = line3
+CASE (Quadrangle16)
+  ! ALLOCATE (ans(4))
+  ans(1)%nptrs = nptrs([1, 2, 5, 6])
+  ans(2)%nptrs = nptrs([2, 3, 7, 8])
+  ans(3)%nptrs = nptrs([3, 4, 9, 10])
+  ans(4)%nptrs = nptrs([4, 1, 11, 12])
+  ans(1:)%xidimension = 1
+  ans(1:)%name = line4
 CASE (Quadrangle8)
   ! ALLOCATE (ans(4))
   ans(1)%nptrs = nptrs([1, 2, 5])