Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional input for heat flux boundaries in ELMER runs #52

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions source/elmer/HFReaderModule.f90
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!-------------------------------------------------------------------------------
!> File: HFReaderModule.f90
!> Engineer: TL
!> Date: 20240201
!> Reads a comma delimited csv file with columns (nodeId, heatFlux[W]) and
!> Engineer: TL/AR
!> Date: 20240924
!> Reads a comma delimited csv file with columns (nodeId, heatFlux[W/m2]) and
!> assigns the heat flux to the appropriate node in the Elmer mesh
!> Takes the node number, n, and the timestep, t, and
!> then reads the variable nodalHFprefix from the Boundary Condition
Expand All @@ -26,8 +26,8 @@
!> if your timestep is larger than 99999s, you will need to increase the 15
!> in the format specification.
!>
!> The nodehf.dat file should contain two columns, (nodeId, heat flux [W]),
!> and should be comma delimited. A few example lines:
!> The nodehf.dat file should contain two columns, (nodeId, heat flux [W/m2]),
!> and should be comma delimited. A few exaple lines:
!> 7.597000000E+03, 2.001488694E+07
!> 7.598000000E+03, 2.086694988E+07
!> 7.599000000E+03, 1.944927053E+07
Expand Down Expand Up @@ -95,7 +95,7 @@ FUNCTION heatFluxOnNodes(Model, n, t) RESULT(hf)
IMPLICIT NONE
TYPE(Model_t) :: Model
INTEGER :: n
REAL(KIND=dp) :: t, hf
REAL(KIND=dp) :: t, hf, q_flow
Logical :: GotIt
TYPE(ValueList_t), POINTER :: BC
Character(LEN=255) :: f
Expand All @@ -107,6 +107,7 @@ FUNCTION heatFluxOnNodes(Model, n, t) RESULT(hf)

!Load the boundary condition with variable for filename
BC => GetBC()

nodalPrefix = getString(BC, 'nodalHFprefix', GotIt)
write(timeString, '(F15.9)') t
f = TRIM(nodalPrefix) // '_' // TRIM(ADJUSTL(timeString)) // '.dat'
Expand All @@ -129,7 +130,17 @@ FUNCTION heatFluxOnNodes(Model, n, t) RESULT(hf)
print *, "Found negative HF value..."
hf = 0.0
ENDIF


! Read the heat flux value (q_flow) from the boundary condition
q_flow = getConstReal(BC, 'q_flow', GotIt)
IF (.NOT. GotIt) THEN
print *, "q_flow not found in boundary condition"
q_flow = 0.0
END IF

! Add constant heat flux to boundary
hf = hf + q_flow

Andimagandi marked this conversation as resolved.
Show resolved Hide resolved
END FUNCTION heatFluxOnNodes

SUBROUTINE ReadCSV(filename, data, numLines)
Expand Down Expand Up @@ -185,4 +196,3 @@ SUBROUTINE SplitString(str, splitStr)
splitStr(2) = str(endPos+1:)

END SUBROUTINE SplitString

Binary file modified tests/integrationTests/nstxuTestCase/nstx/elmer/HEATLibrary.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Boundary Condition 1
Name = "HFreader"
Heat Flux = Variable Time
Real Procedure "HEATLibrary" "heatfluxonnodes"
q_flow = Real 0.0
nodalHFprefix = String nodehf
End