Skip to content

Commit

Permalink
change funtofem.out file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-engelstad committed Nov 2, 2023
1 parent b78f72b commit 98b3453
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions funtofem/model/funtofem_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,17 +917,16 @@ def write_functions_file(
# Print the function name
func_value = func.value.real if func.value is not None else None
if full_precision:
data += f"func {func.full_name} = {func_value}\n"
data += f"func {func.full_name} {func_value}\n"
else:
data += f"func {func.full_name} = {func_value:.5e}\n"
data += f"func {func.full_name} {func_value:.5e}\n"

for var in variables:
derivative = float(func.derivatives[var])
if full_precision:
data += f"\t{var.full_name} = {func.derivatives[var].real}\n"
data += f"\t{var.full_name} {derivative}\n"
else:
data += (
f"\t{var.full_name} = {func.derivatives[var].real:.5e}\n"
)
data += f"\t{var.full_name} {derivative:.5e}\n"

with open(filename, "w") as fp:
fp.write(data)
Expand Down

0 comments on commit 98b3453

Please sign in to comment.