Skip to content

Commit

Permalink
rename section; fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobEliasWagner committed Jan 9, 2024
1 parent 6faac4e commit 7a48073
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions src/data/helmholtz/domain_properties/file_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def read_crystal(config: configparser.ConfigParser) -> CrystalDescription:
Returns: A description of a crystal.
"""
grid_size = float(config["CRYSTALS"][""])
n_x = int(config["CRYSTALS"]["n_x"])
n_y = int(config["CRYSTALS"]["n_y"])
cut = bool(config["CRYSTALS"]["cut"])
ref_index = float(config["CRYSTALS"]["ref_index"])
grid_size = float(config["CRYSTAL"]["grid_size"])
n_x = int(config["CRYSTAL"]["n_x"])
n_y = int(config["CRYSTAL"]["n_y"])
cut = bool(config["CRYSTAL"]["cut"])
ref_index = float(config["CRYSTAL"]["ref_index"])

return CrystalDescription("Crystal", grid_size, n_x, n_y, cut, ref_index)

Expand All @@ -108,7 +108,7 @@ def read_cylindrical_crystal(config: configparser.ConfigParser) -> List[CrystalD
Returns: list, all possible crystal descriptions described by config.
"""
radii_tuple = str_set_to_tuple(config["CRYSTALS-CYLINDRICAL"]["radius"])
radii_tuple = str_set_to_tuple(config["CRYSTAL-CYLINDRICAL"]["radius"])
radii = sample(*radii_tuple)

c = read_crystal(config)
Expand All @@ -132,13 +132,13 @@ def read_c_shaped_crystal(config: configparser.ConfigParser) -> List[CrystalDesc
c = read_crystal(config)

# c-shape
outer_radii_tuple = str_set_to_tuple(config["CRYSTALS-C-SHAPED"]["outer_radius"])
outer_radii_tuple = str_set_to_tuple(config["CRYSTAL-C-SHAPED"]["outer_radius"])
outer_radii = sample(*outer_radii_tuple)

inner_radii_tuple = str_set_to_tuple(config["CRYSTALS-C-SHAPED"]["inner_radius"])
inner_radii_tuple = str_set_to_tuple(config["CRYSTAL-C-SHAPED"]["inner_radius"])
inner_radii = sample(*inner_radii_tuple)

gap_widths_tuple = str_set_to_tuple(config["CRYSTALS-C-SHAPED"]["gap_width"])
gap_widths_tuple = str_set_to_tuple(config["CRYSTAL-C-SHAPED"]["gap_width"])
gap_widths = sample(*gap_widths_tuple)

# all permutations
Expand Down Expand Up @@ -168,7 +168,7 @@ def read_config(file: pathlib.Path) -> List[Description]:
config.read(file)

# crystal
crystal_type = config["CRYSTALS"]["type"]
crystal_type = config["CRYSTAL"]["type"]
if crystal_type == "None":
read_func = read_none_crystal
elif crystal_type == "Cylindrical":
Expand Down Expand Up @@ -200,7 +200,7 @@ def read_config(file: pathlib.Path) -> List[Description]:
# indices
domain_index_start = int(config["DOMAIN"]["cell_index_start"])
absorber_index_start = int(config["ABSORBER"]["cell_index_start"])
crystal_index_start = int(config["CRYSTALS"]["cell_index_start"])
crystal_index_start = int(config["CRYSTAL"]["cell_index_start"])

# assemble descriptions - currently only crystal descriptions need to be taken into account
# as grid_size is constant the mesh generation will always generate the same mesh
Expand Down
14 changes: 7 additions & 7 deletions src/data/helmholtz/domain_properties/input_file_template.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ on_bottom = False
on_left = False
cell_index_start = 20000

[CRYSTALS]
[CRYSTAL]
# type can be None, Cylindrical, C-Shaped
type = None
type = C-Shaped
# keep const. for now
grid_size = -1
n_x = -1in
n_x = -1
n_y = -1
# when the crystal is not cut from the domain the wave number is modified accordingly
cut = True
ref_index = -1
cell_index_start = 3000
[CRYSTAL-NONE]
[CRYSTAL-CYLINDRICAL]
radius = (1., -1, 1, linspace)
radius = (1., 1.5, 3, linspace)
[CRYSTAL-C-SHAPED]
outer_radius = (1., -1, 1, linspace)
outer_radius = (1., 1.5, 3, linspace)
# in relation to outer radius (1. is exactly outer radius)
inner_radius = (1., -1, 1, linspace)
inner_radius = (0.5, 0.9, 4, linspace)
# in relation to outer radius (can be bigger than 1. but needs to be smaller than 2.)
gap_width = (1., -1, 1, linspace)
gap_width = (.2, .4, 5, linspace)

0 comments on commit 7a48073

Please sign in to comment.