Skip to content

Commit

Permalink
Remove unnecessary tags as per benjamins suggestion (#51)
Browse files Browse the repository at this point in the history
* removed unnecessary tags as per benjamins suggestion

* Rename timestep-length to time-window-size

* Renamed max-timesteps to max-time-windows

---------

Co-authored-by: Toddelismyname <116207910+Toddelismyname@users.noreply.github.com>
  • Loading branch information
VanLaareN and Toddelismyname authored Jan 10, 2025
1 parent 014953b commit 1c27550
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
27 changes: 9 additions & 18 deletions controller_utils/precice_struct/PS_CouplingScheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def write_precice_xml_config(self, tag:etree, config): # config: PS_PreCICEConfi
""" write out the config XMl file """
coupling_scheme = self.write_participants_and_coupling_scheme( tag, config, "parallel-explicit" )

i = etree.SubElement(coupling_scheme, "max-timesteps", value=str(self.NrTimeStep))
attr = { "value": str(self.Dt), "valid-digits": "8"}
i = etree.SubElement(coupling_scheme, "timestep-length", attr)
i = etree.SubElement(coupling_scheme, "max-time-windows", value=str(self.NrTimeStep))
attr = { "value": str(self.Dt)}
i = etree.SubElement(coupling_scheme, "time-window-size", attr)

# write out the exchange but not the convergence (if empty it will not be written)
self.write_exchange_and_convergance(config, coupling_scheme, "")
Expand Down Expand Up @@ -180,9 +180,9 @@ def write_precice_xml_config(self, tag:etree, config): # config: PS_PreCICEConfi
""" write out the config XMl file """
coupling_scheme = self.write_participants_and_coupling_scheme( tag, config, "parallel-implicit" )

i = etree.SubElement(coupling_scheme, "max-timesteps", value = str(self.NrTimeStep))
attr = { "value": str(self.Dt), "valid-digits": "8"}
i = etree.SubElement(coupling_scheme, "timestep-length", attr)
i = etree.SubElement(coupling_scheme, "max-time-windows", value = str(self.NrTimeStep))
attr = { "value": str(self.Dt)}
i = etree.SubElement(coupling_scheme, "time-window-size", attr)
i = etree.SubElement(coupling_scheme, "max-iterations", value=str(self.maxIteration))
#i = etree.SubElement(coupling_scheme, "extrapolation-order", value=str(self.extrapolation_order))

Expand All @@ -202,25 +202,16 @@ def __init__(self):
# TODO: this should be configurable
self.name = "IQN-ILS"
self.precondition_type = "residual-sum"
self.initial_relaxation_value = 0.1
self.max_used_iterations_value = 50
self.timesteps_reused_value = 8
self.filter_type = "QR1"
self.filter_limit = 1E-6
self.post_process_quantities = {} # the quantities that are in the post-processing
self.post_process_quantities = {} # the quantities that are in the acceleration

def write_precice_xml_config(self, tag:etree, config, parent): # config: PS_PreCICEConfig
""" write out the config XMl file of the post-processing in case of implicit coupling
""" write out the config XMl file of the acceleration in case of implicit coupling
only for explicit coupling (one directional) this should not write out anything """

# TODO: make this configurable ?

post_processing = etree.SubElement(tag, "post-processing:"+ self.name)
post_processing = etree.SubElement(tag, "acceleration:"+ self.name)
#i = etree.SubElement(post_processing, "preconditioner", type=self.precondition_type)
i = etree.SubElement(post_processing, "filter", type=self.filter_type, limit=str(self.filter_limit))
i = etree.SubElement(post_processing, "initial-relaxation", value=str(self.initial_relaxation_value))
i = etree.SubElement(post_processing, "max-used-iterations", value=str(self.max_used_iterations_value))
i = etree.SubElement(post_processing, "timesteps-reused", value=str(self.timesteps_reused_value))
for q_name in config.coupling_quantities:
q = config.coupling_quantities[q_name]
i = etree.SubElement(post_processing, "data", name=q.instance_name, mesh=q.source_mesh_name)
Expand Down
12 changes: 1 addition & 11 deletions controller_utils/precice_struct/PS_PreCICEConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ def write_precice_xml_config(self, filename:str, log:UT_PCErrorLogging, sync_mod

precice_configuration_tag = etree.Element("precice-configuration", nsmap=nsmap)

# TODO: a the moment no logging config
log_tag = etree.SubElement(precice_configuration_tag, "log")
# possible configs
# sink_tag = etree.SubElement(log_tag, "sink", type="stream", output="stdout", enabled="true")

# write out:
# first get the dimensionality of the coupling
Expand All @@ -181,12 +177,6 @@ def write_precice_xml_config(self, filename:str, log:UT_PCErrorLogging, sync_mod
dimensionality = max ( dimensionality, solver.dimensionality )
pass

profiling_tag = etree.SubElement(precice_configuration_tag, "profiling",
attrib={"synchronize": str(self.sync_mode).lower(),
"mode": "off" if str(self.mode).lower() == "false" else str(self.mode).lower()
}
)

# 1 quantities
for coupling_quantities_name in self.coupling_quantities:
coupling_quantity = self.coupling_quantities[coupling_quantities_name]
Expand Down Expand Up @@ -317,7 +307,7 @@ def write_precice_xml_config(self, filename:str, log:UT_PCErrorLogging, sync_mod
for a,b in replace_only_list:
xml_string = xml_string.replace(a, b)
replace_list = [("data:", "data___"), ("mapping:nearest", "mapping___nearest"), ("m2n:", "m2n___" ),
("coupling-scheme:","coupling-scheme___"), ("post-processing:", "post-processing___")]
("coupling-scheme:","coupling-scheme___"), ("acceleration:", "acceleration___")]
for a,b in replace_list:
xml_string = xml_string.replace(a, b)

Expand Down
1 change: 1 addition & 0 deletions controller_utils/ui_struct/UI_SimulationInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def init_from_yaml(self, etree, mylog: UT_PCErrorLogging):
try:
self.steady = etree["steady-state"]
self.NrTimeStep = etree["timesteps"]
#TODO: Need to change this when Topology is ported
self.Dt = etree["timestep-length"]
self.accuracy = etree["accuracy"]
self.sync_mode = etree.get("synchronize", "on")
Expand Down

0 comments on commit 1c27550

Please sign in to comment.