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

New radiation test cases #42

Merged
merged 173 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
afe038a
added symmetric hohlraum. Changed the way neumann cells work. ALl old…
ScSteffen Nov 15, 2023
d546b94
created lattice test case and mesh generator
ScSteffen Nov 16, 2023
154b6bb
startet new scalar outputs
ScSteffen Nov 17, 2023
848e640
first QOIs work
ScSteffen Nov 17, 2023
09537db
finished lattice QOI
ScSteffen Nov 17, 2023
b74991b
added hohlraum qois
ScSteffen Nov 21, 2023
14f4a7b
fixed small bug with openMP
ScSteffen Dec 5, 2023
49bbc03
fix bug with probing moments
ScSteffen Dec 5, 2023
5ad7df2
project restructrue
ScSteffen Dec 6, 2023
8b507af
debugging
ScSteffen Dec 6, 2023
666e353
started variation QOIs
ScSteffen Dec 6, 2023
70e072e
added variation QOI
ScSteffen Dec 6, 2023
fde64a6
startet incorporation of the UM-Bridge framework
ScSteffen Dec 18, 2023
6b980cb
setup um-bridge test case lattice - errror with network connection
ScSteffen Dec 18, 2023
136a4b5
added design parameters for the lattice test case
ScSteffen Dec 19, 2023
8ac831d
refactoring of problem specific QOIs. put to the corresponding proble…
ScSteffen Dec 19, 2023
9cacc49
included pointer to quadrature class to problem. WIll help reduce the…
ScSteffen Dec 19, 2023
73ebb70
made all qois and design parameters part of the corresponding problem…
ScSteffen Dec 20, 2023
d31fbb0
fixed compiler warning about included map
ScSteffen Dec 20, 2023
c4dd9d3
fix small bug
ScSteffen Dec 21, 2023
3b60ec2
fixed ninja compile bug
ScSteffen Dec 21, 2023
0ef1627
started hohlraum probing qoi
ScSteffen Dec 21, 2023
d10b6dc
fixed type conversion bug
ScSteffen Dec 21, 2023
016ea43
fixed compile problems. Added sampling line hohlraum test case
ScSteffen Dec 22, 2023
f28ff20
Merge branch 'new_radiation_test_cases' of https://github.com/CSMMLab…
ScSteffen Dec 22, 2023
7500974
added line variance
ScSteffen Dec 22, 2023
5d40cba
added green line scalar output
ScSteffen Dec 22, 2023
e9d2e97
Merge branch 'new_radiation_test_cases' of https://github.com/CSMMLab…
ScSteffen Dec 22, 2023
867d5d0
segfault somewhere in hohlraum
ScSteffen Dec 22, 2023
a96fe03
resordered meshing scripts. startet refined mesh for lattice
ScSteffen Dec 29, 2023
2bef853
mesh refinement for lattice
ScSteffen Dec 29, 2023
6e5c3fc
updated requirements
ScSteffen Dec 29, 2023
66344d8
fixed computation of the characteristic length in 2d
ScSteffen Dec 31, 2023
7d64549
Merge branch 'new_radiation_test_cases' of https://github.com/CSMMLab…
ScSteffen Dec 31, 2023
16e779e
Merge branch 'develop' of github.com:CSMMLab/KiT-RT into new_radiatio…
Jan 2, 2024
2715c02
mesh io verbose
Jan 2, 2024
45fafdb
mesh io verbose
Jan 2, 2024
1ead3a1
added folder for mesh files geo
ScSteffen Jan 2, 2024
bc40e88
Merge branch 'new_radiation_test_cases' of https://github.com/CSMMLab…
ScSteffen Jan 2, 2024
71fde4c
cascading file lattice
ScSteffen Jan 2, 2024
4e74a35
repaired lattice geo file
ScSteffen Jan 2, 2024
49c6967
fixed geo file
ScSteffen Jan 2, 2024
180f050
adapted cascade file
ScSteffen Jan 2, 2024
a6f2eef
added geo file for rectangular meshes
ScSteffen Jan 3, 2024
5247086
Merge branch 'new_radiation_test_cases' of https://github.com/CSMMLab…
ScSteffen Jan 3, 2024
a78c076
segfault introduced
ScSteffen Jan 3, 2024
6355876
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Jan 3, 2024
af16d75
fixed quad grid
ScSteffen Jan 3, 2024
2e1cabb
fixed segfault in hohlraum, linesource and checkerboard
ScSteffen Jan 3, 2024
8c6fd4d
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Jan 3, 2024
9ef4209
added singularity container support
ScSteffen Jan 3, 2024
1c27480
added lattice benchmark
ScSteffen Jan 3, 2024
1a32610
small change in lattice testcase file
ScSteffen Jan 3, 2024
7f9ddce
added solver output
Jan 3, 2024
bb3ad32
made progression for transfinite elements in lattice test case variable
ScSteffen Jan 4, 2024
d641538
added lattice meshing command
ScSteffen Jan 4, 2024
c9d431a
removed MPI and Python dependencies from KiT-RT
ScSteffen Jan 4, 2024
c3cc36e
added MPI singularity def file
ScSteffen Jan 4, 2024
e751a37
updated geo file
ScSteffen Jan 4, 2024
40e4313
new example file structure
Jan 4, 2024
5ec1dfa
changed mesh size to minimal size for example
ScSteffen Jan 4, 2024
d1b94d9
small speedup of mesh connectivity
ScSteffen Jan 5, 2024
7c9c30c
mesh has now access to config. io writer for connectiivty added
Jan 5, 2024
20c02a5
started to add connectivity loader
Jan 5, 2024
80182e4
added mesh connectivity reader from file for faster recomputation
Jan 5, 2024
b7e0232
increased cfl number
ScSteffen Jan 5, 2024
3781f61
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Jan 5, 2024
fee759f
update mn and pn solver to new, more memory efficient phhysics implem…
ScSteffen Jan 11, 2024
f6248ff
fixed bug in max absorption computation
ScSteffen Jan 18, 2024
d0ddd45
added config files
Jan 19, 2024
300984a
updated meshing scripts
Jan 19, 2024
940c3b7
updated meshing scripts
Jan 19, 2024
af2e669
updated runscript
Jan 19, 2024
41e4c01
useless merge
ScSteffen Jan 25, 2024
fca990e
fixed outpout of logfiles. part 1
ScSteffen Jan 25, 2024
53ff804
start debugging logger
ScSteffen Jan 25, 2024
30e254e
fixed logger filename bug
ScSteffen Jan 25, 2024
53d4d76
added cfg file
Jan 25, 2024
d278b61
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
Jan 25, 2024
8737ccc
update n80 meshfile to geo progression 0.5
Feb 1, 2024
b82de44
fixed bug in output verbosity
ScSteffen Feb 2, 2024
7d66319
merge
ScSteffen Feb 2, 2024
ee54312
added output verbosity
Feb 6, 2024
0c3e913
fixed scatter xs bug
ScSteffen Feb 6, 2024
03b3fd8
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Feb 6, 2024
50dee15
removed some compiler warnings. fixed test cases for new ghost cell i…
ScSteffen Feb 6, 2024
c969bd0
fixed several compile warning about unused variables. adapted referen…
ScSteffen Feb 7, 2024
b8e85b6
fixed all test cases locally. added unit test for mesh connectivity f…
ScSteffen Feb 7, 2024
1d9df0c
fixed a double defnition bug
ScSteffen Feb 7, 2024
7fda579
fixed mn test case
ScSteffen Feb 12, 2024
257711c
fixed screen output test case
ScSteffen Feb 12, 2024
168ea7f
changed workflow file
ScSteffen Feb 12, 2024
63f5786
small fix
ScSteffen Feb 12, 2024
b213715
small fix
ScSteffen Feb 12, 2024
22b3f85
revert changes to worklow
ScSteffen Feb 12, 2024
31b96cb
revert change in worklof yaml
ScSteffen Feb 12, 2024
3a64141
fix csv output formatting
ScSteffen Feb 13, 2024
870bd31
fix output validation test for new formatting
ScSteffen Feb 13, 2024
ae50221
changed license
ScSteffen Feb 14, 2024
6bbe3a1
fix
ScSteffen Feb 14, 2024
822492f
upped writeout precision
ScSteffen Feb 16, 2024
f745eed
upped output precifion for logger
ScSteffen Feb 16, 2024
709e923
change ??
ScSteffen Feb 26, 2024
fd0d323
loop unrolling sn solver
ScSteffen Feb 26, 2024
dfd5c24
added hpc examples sym_hohlraum
ScSteffen Feb 27, 2024
2945356
added sym_hohlraum cfg
ScSteffen Feb 27, 2024
0c90410
changed gitignore
ScSteffen Feb 27, 2024
d7b5999
fix segfault in 2d flux
ScSteffen Feb 27, 2024
5e56dec
temporarily changed mesh resolution
ScSteffen Feb 27, 2024
c3bbc7c
added quarterhohlraum
ScSteffen Feb 27, 2024
dd06ca9
added quarterhohlraum cfg and mesh files
ScSteffen Feb 27, 2024
5777303
added quarter hohlraum for high res simulation speedup
ScSteffen Feb 27, 2024
548ff16
added meshing functionality
ScSteffen Feb 27, 2024
57bc65e
added quarter hohlraum
ScSteffen Feb 28, 2024
da3e4d6
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Feb 28, 2024
3346237
reflecting boundary conditions for quarter hohlraum
ScSteffen Feb 28, 2024
4639f08
qois for quarter hohlraum
ScSteffen Feb 29, 2024
42efd7d
removed cout from main.cpp
ScSteffen Feb 29, 2024
370eab6
fix unit tests
ScSteffen Feb 29, 2024
a48185c
started hohlraum design params
ScSteffen Mar 1, 2024
5af1b34
accelerated sn solver by 25% through memory access optimization in Fl…
ScSteffen Mar 1, 2024
77e7bde
added half lattice benchmark
ScSteffen Mar 1, 2024
e2e1541
added half lattice bench
ScSteffen Mar 1, 2024
3fa7048
updates upwind flux
ScSteffen Mar 4, 2024
7ee9d64
fix logger unit test
ScSteffen Mar 4, 2024
1444272
Fixed Bug in 2nd order HPC SN solver (#47)
ScSteffen Apr 4, 2024
19cf20b
Memory optimization solver (#46)
ScSteffen Apr 4, 2024
4271d16
fixed small debug verbosity bugs
ScSteffen Apr 5, 2024
28dd911
fix unit tests
ScSteffen Apr 5, 2024
521d366
fix screen output test
ScSteffen Apr 5, 2024
a56feb6
fixed screen output test - accounting for extra time step to fill up …
ScSteffen Apr 8, 2024
c61900a
fixes csv logger test case
ScSteffen Apr 8, 2024
e601c55
fixed logger output now?
ScSteffen Apr 8, 2024
320f36c
another logger fix
ScSteffen Apr 8, 2024
f3cbcce
added container builder
ScSteffen Apr 8, 2024
ec09ef6
remove debug output
ScSteffen Apr 9, 2024
1f7fb8e
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Apr 9, 2024
b231dae
rename sy hohlruam cfg
ScSteffen Apr 9, 2024
6a1e4df
prepared for 2nd order in time
ScSteffen Apr 9, 2024
3415dfb
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Apr 9, 2024
5ddbf62
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Apr 9, 2024
cc090c2
updated hohlraum qois
ScSteffen Apr 9, 2024
6883136
added singularity install script kitrt
ScSteffen Apr 9, 2024
2fed9ac
changed flux limiter to venkatakrishnan
ScSteffen Apr 9, 2024
99b3837
Merge branch 'new_radiation_test_cases' of github.com:CSMMLab/KiT-RT …
ScSteffen Apr 9, 2024
c5ea287
quarter hohlraum now works
Apr 10, 2024
6a3b401
fix segfaults
Apr 10, 2024
b5a2786
fix race condition
Apr 10, 2024
f9226b9
added variable green region to hozhlraum
Apr 10, 2024
92cc249
variable red absorption region
Apr 10, 2024
f013929
fixed bug in boundary condition quarter hohlraum
ScSteffen Apr 15, 2024
fa59949
fixed vtk memory leak
ScSteffen May 2, 2024
96eb92f
updated hohlraum design params
ScSteffen May 23, 2024
a0fe9fd
update options
ScSteffen May 23, 2024
ae7561e
comment unused var out
ScSteffen May 23, 2024
7b5fac3
added lattice qois according to testbed v2
ScSteffen May 31, 2024
e3df2dc
updated quarter hohlraum test case
ScSteffen Jun 3, 2024
4a75efc
bugfix
ScSteffen Jun 3, 2024
756453a
parallel conmat (experimental)
ScSteffen Jun 7, 2024
1b7efb3
parallel mesh connectivity gives segfault
ScSteffen Jun 11, 2024
0fc96b5
mesh connectivity accelerated - experimental
ScSteffen Jun 12, 2024
893c03c
accelerated solver startup
ScSteffen Jun 13, 2024
64552d5
set forced connectivity wirte as an option
ScSteffen Jun 18, 2024
93c8b80
does not write connectivity file anymore when forced connectivity is …
ScSteffen Jun 23, 2024
40c1546
fixed bug in cell of coord identification
ScSteffen Jun 26, 2024
77dd9d2
added moment output for hpc sn solver
ScSteffen Jul 1, 2024
99afc44
fixed 2nd order solver
ScSteffen Aug 9, 2024
7d6591c
fixed bug in absorption calculation of the hohlraum center capsule
ScSteffen Aug 19, 2024
7d4efed
added total absorption as output field
ScSteffen Sep 3, 2024
ada0d55
fixed hohrlaum absorption coefficient
ScSteffen Sep 4, 2024
4837ccc
Mpi sn solver (#49)
ScSteffen Sep 10, 2024
cb85849
fix reference file for screen output
ScSteffen Sep 10, 2024
873c5da
remove meshing tests - not needed
ScSteffen Sep 10, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
- name: Run unit tests
run: |
cd build
./unit_tests
OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml
- name: Code coverage
run: |
cpp-coveralls -r . -b "build/" -i "src/" -i "include/" --exclude "ext/" --gcov-options "\-lp" --verbose
cpp-coveralls -r . -b "build/" -i "src/" -i "include/" --exclude "ext/" --gcov-options "\-lp" --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Project specific ###
*.con
*.cfg
bin/*
*.su2
Expand Down
40 changes: 10 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option( BUILD_DOC "builds Doxygen and Sphinx documentation" OFF )
option( BUILD_UNITY "enables unity build for faster compile times" ON )
option( BUILD_CODE_COV "enables compiler option required for code coverage analysis" OFF )
option( BUILD_ML "enables build with tensorflow backend access" OFF )
option( BUILD_MPI "enables build with MPI access" OFF )

#################################################

Expand All @@ -31,8 +32,10 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

find_package( OpenMP REQUIRED )

find_package( MPI REQUIRED )
include_directories( ${MPI_INCLUDE_PATH} )
if( BUILD_MPI )
find_package( MPI REQUIRED )
include_directories( ${MPI_INCLUDE_PATH} )
endif()

find_package( LAPACK REQUIRED )
include_directories( ${LAPACK_INCLUDE_DIR} )
Expand All @@ -41,9 +44,6 @@ find_package( BLAS )

find_package( VTK COMPONENTS vtkIOGeometry vtkFiltersCore REQUIRED )

find_package( Python3 COMPONENTS Interpreter Development NumPy REQUIRED )
include_directories( ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS} )

add_compile_definitions( KITRT_PYTHON_PATH="${CMAKE_SOURCE_DIR}/python" )
add_compile_definitions( BLAZE_USE_SHARED_MEMORY_PARALLELIZATION=0 )
message( STATUS "Blaze: Shared memory parallelization disabled" )
Expand All @@ -61,7 +61,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/ext/blaze )
include_directories( ${CMAKE_SOURCE_DIR}/ext/cpptoml/include )
include_directories( ${CMAKE_SOURCE_DIR}/ext/spdlog/include )

set( CORE_LIBRARIES ${Python3_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MPI_LIBRARIES} ${VTK_LIBRARIES} OpenMP::OpenMP_CXX -lstdc++fs )
if( BUILD_MPI )
set( CORE_LIBRARIES ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MPI_LIBRARIES} ${VTK_LIBRARIES} OpenMP::OpenMP_CXX -lstdc++fs )
else()
set( CORE_LIBRARIES ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${VTK_LIBRARIES} OpenMP::OpenMP_CXX -lstdc++fs )
endif()


#################################################
Expand Down Expand Up @@ -106,30 +110,6 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELWITHDEBINFO>
target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
#################################################


### BUILD ML ###################################
# Standalone ML Build (legacy)
#if( BUILD_ML )
# # Tensorflow
# include_directories( ${CMAKE_SOURCE_DIR}/ext/cppflow/include/ )
# find_library(TENSORFLOW_LIB tensorflow)
# add_executable( ${CMAKE_PROJECT_NAME} ${SRCS} ${EXT_SRCS} )
#
# # Specify Path for tensorflow models
# add_compile_definitions( TENSORFLOW_MODEL_PATH="${CMAKE_SOURCE_DIR}/tfmodels" )
#
# target_compile_definitions( ${CMAKE_PROJECT_NAME} PUBLIC BUILD_ML )
# target_link_libraries( ${CMAKE_PROJECT_NAME} ${CORE_LIBRARIES} ${TENSORFLOW_LIB})
# set_target_properties( ${CMAKE_PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin" )
#
# target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
# target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
# target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
#
#endif()
#################################################


### BUILD UNIT TESTS ############################
if( BUILD_TESTING )
include( CTest )
Expand Down
7 changes: 4 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Copyright 2020 Karlsruhe Institute of Technology - Steinbuch Centre for Computing
Copyright 2024 Steffen Schotthoefer, Pia Stammer, Jonas Kusch.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including the rights to use, copy, modify, merge, publish, the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
It is prohibited to sell copies of the software or use the software in any commerical context.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
123 changes: 123 additions & 0 deletions examples/cascade_lattice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import os
import subprocess


def main():
# Example usage:
quad_order = 19
cl_fine_vals = [0.02, 0.02, 0.01, 0.005]
cl_coarse = 0.05
cl_boundary = 0.2
length = 0.05

for i in range(len(cl_fine_vals)):
cl_fine = cl_fine_vals[i]
modify_and_run_geo_file(
cl_fine=cl_fine, cl_coarse=cl_coarse, cl_boundary=cl_boundary, length=length
)
modify_quad_order(quad_order=quad_order)
new_log_file, log_dir = modify_and_save_log_file(
quad_order, cl_fine, cl_coarse, cl_boundary, length
)
print(f"New log file name: {new_log_file}")
print(f"Log directory: {log_dir}")
run_cpp_program(config_file_path="lattice.cfg")

return 0


def modify_and_run_geo_file(cl_fine, cl_coarse, cl_boundary, length):
# Define the file path
geo_file_path = "meshes/geo_files/lattice_refined.geo"

# Read the contents of the .geo file
with open(geo_file_path, "r") as file:
lines = file.readlines()

# Modify the variables in the first 4 lines
lines[0] = f"cl_fine = {cl_fine};\n"
lines[1] = f"cl_coarse = {cl_coarse};\n"
lines[2] = f"cl_boundary = {cl_boundary};\n"
lines[3] = f"length = {length};\n"

# Save the modified .geo file
with open(geo_file_path, "w") as file:
file.writelines(lines)

# Execute the command
command = f"gmsh {geo_file_path} -2 -format su2 -save_all"
os.system(command)


def modify_quad_order(quad_order):
# Define the file path
cfg_file_path = "lattice.cfg"

# Read the contents of the lattice.cfg file
with open(cfg_file_path, "r") as file:
lines = file.readlines()

# Find the line containing "QUAD_ORDER" and modify it
for i, line in enumerate(lines):
if "QUAD_ORDER" in line:
lines[i] = f"QUAD_ORDER = {quad_order}\n"
break

# Save the modified lattice.cfg file
with open(cfg_file_path, "w") as file:
file.writelines(lines)


def modify_and_save_log_file(quad_order, cl_fine, cl_coarse, cl_boundary, length):
# Define the file path
cfg_file_path = "lattice.cfg"

# Read the contents of the lattice.cfg file
with open(cfg_file_path, "r") as file:
lines = file.readlines()

# Identify the lines containing "LOG_DIR" and "LOG_FILE"
log_dir_line = next(line for line in lines if "LOG_DIR" in line)
log_file_line = next(line for line in lines if "LOG_FILE" in line)
vtk_file_line = next(line for line in lines if "OUTPUT_FILE" in line)

print(log_file_line)
# Extract the current log directory and file name
current_log_dir = log_dir_line.split("=")[1].strip()
current_log_file = log_file_line.split("=")[1].strip()

# Construct the new log file name
new_log_file = f"lattice_quad_order_{quad_order}_cl_fine_{cl_fine}_cl_coarse_{cl_coarse}_cl_boundary_{cl_boundary}_length_{length}"
new_vtk_file = f"lattice_quad_order_{quad_order}_cl_fine_{cl_fine}_cl_coarse_{cl_coarse}_cl_boundary_{cl_boundary}_length_{length}"

# Update the log file name in the lines list
log_file_line_new = f"LOG_FILE = {new_log_file}\n"
vtk_file_line_new = f"OUTPUT_FILE = {new_vtk_file}\n"
lines[lines.index(log_file_line)] = log_file_line_new
lines[lines.index(vtk_file_line)] = vtk_file_line_new

# Save the modified lattice.cfg file
with open(cfg_file_path, "w") as file:
file.writelines(lines)

# Return the new log file name and log directory
return new_log_file, current_log_dir


def run_cpp_program(config_file_path):
# Define the path to the C++ program
cpp_program_path = "../build/KiT-RT"

# Construct the command to run the C++ program with the specified configuration file
command = [cpp_program_path, config_file_path]

try:
# Run the C++ program
subprocess.run(command, check=True)
print("C++ program executed successfully.")
except subprocess.CalledProcessError as e:
print(f"Error running C++ program: {e}")


if __name__ == "__main__":
main()
48 changes: 48 additions & 0 deletions examples/configs/lattice_SN.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lattice Benchmarking File SN %
% Author <Steffen Schotthöfer> %
% Date 08.01.2024 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% ----IO specification ----
%
OUTPUT_DIR = result_lattice
OUTPUT_FILE = lattice_quad_order_19_grid_20
LOG_DIR = result_lattice/logs
LOG_FILE = lattice_quad_order_19_grid_20
MESH_FILE = meshes/testcases/lattice/lattice_rectangular.su2
%
% --- Problem definition ---
%
PROBLEM = LATTICE
TIME_FINAL = 2.8
SPATIAL_DIM = 3
SOURCE_MAGNITUDE = 1.0
%
% ---- Solver specifications ----
%
% Solver type
SOLVER = SN_SOLVER
% CFL number
CFL_NUMBER = 0.95
% Reconstruction order
RECONS_ORDER = 2
%
% ---- Boundary Conditions ----
%
BC_NEUMANN = ( void )
%
% ----- Quadrature Specification ---
%
QUAD_TYPE = LEBEDEV
QUAD_ORDER = 19
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
VOLUME_OUTPUT_FREQUENCY = 0
SCREEN_OUTPUT = (ITER, MASS,RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, CUR_OUTFLOW, TOTAL_OUTFLOW, MAX_OUTFLOW, CUR_PARTICLE_ABSORPTION, TOTAL_PARTICLE_ABSORPTION, MAX_PARTICLE_ABSORPTION )
SCREEN_OUTPUT_FREQUENCY = 10
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, TOTAL_OUTFLOW, MAX_OUTFLOW, CUR_PARTICLE_ABSORPTION, TOTAL_PARTICLE_ABSORPTION, MAX_PARTICLE_ABSORPTION)
HISTORY_OUTPUT_FREQUENCY = 1
Loading
Loading