Skip to content

Commit

Permalink
modify meshing script to save given meshing command
Browse files Browse the repository at this point in the history
  • Loading branch information
keiyamamo committed Sep 27, 2024
1 parent 8a6dcb2 commit 19030d3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/vasp/automatedPreprocessing/automated_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

import sys
import datetime
from pathlib import Path

import configargparse
Expand All @@ -29,6 +30,21 @@
from vasp.simulations.simulation_common import load_mesh_and_data


def save_command_to_file(file_path):
"""
Save the command-line arguments to a file.
Args:
file_path (str): Path to the file where the command-line arguments should be saved.
"""
# Join the command-line arguments into a single string
command = ' '.join(sys.argv)

# Open the file in append mode and write the command
with open(file_path, 'a') as f:
f.write(command + '\n')


def run_pre_processing(input_model, verbose_print, smoothing_method, smoothing_factor, smoothing_iterations,
meshing_method, refine_region, has_multiple_inlets, add_flow_extensions, visualize, config_path,
coarsening_factor, inlet_flow_extension_length, outlet_flow_extension_length,
Expand Down Expand Up @@ -90,6 +106,10 @@ def run_pre_processing(input_model, verbose_print, smoothing_method, smoothing_f
dir_path = input_model_path.parent
print(f"\n--- Working on case: {case_name} \n")

# Get unique time stamp and save given command to file
time_stamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
save_command_to_file(dir_path / f"commands_{time_stamp}.txt")

# Naming conventions
base_path = dir_path / case_name
file_name_centerlines = base_path.with_name(base_path.name + "_centerlines.vtp")
Expand Down

0 comments on commit 19030d3

Please sign in to comment.