diff --git a/examples/exec_scripts/exec_cfx.py b/examples/exec_scripts/exec_cfx.py index 891bd1b35..171f993fe 100644 --- a/examples/exec_scripts/exec_cfx.py +++ b/examples/exec_scripts/exec_cfx.py @@ -64,6 +64,16 @@ def execute(self): inputs["cfx_startMethod"] = self.context.execution_context.get("cfx_startMethod", None) inputs["cfx_runName"] = self.context.execution_context.get("cfx_runName", None) + cclFile = next((f for f in self.context.input_files if f["name"] == "ccl"), None) + if cclFile != None: + inputs["cfx_cclFile"] = cclFile["path"] + log.info("ccl file path: " + cclFile["path"]) + + defFile = next((f for f in self.context.input_files if f["name"] == "def"), None) + if defFile != None: + inputs["cfx_definitionFile"] = defFile["path"] + log.info("def file path: " + defFile["path"]) + self.publish_to_default_log( "Task inputs after applying default values to missing inputs:" ) @@ -142,8 +152,9 @@ def execute(self): # Create command line # Add parallel options - cmd = [exe] - cmd.extend(["-fullname", self.active_run_name]) + cmd = [os.path.basename(exe)] + cmd.append("-fullname") + cmd.append(self.active_run_name) cmd.append("-batch") cmd.append("-serial") @@ -162,10 +173,11 @@ def execute(self): for opt, i in sorted(options_arg.items()): k = "cfx_" + i if not inputs[k] == None: - cmd.extend([opt, inputs[k]]) + cmd.append(opt) + cmd.append(inputs[k]) # Add additional options - if not inputs["cfx_additionalArgs"] == "": + if not inputs["cfx_additionalArgs"] == "" and not inputs["cfx_additionalArgs"] == None: cmd.extend(shlex.split(inputs["cfx_additionalArgs"])) # Start the solver @@ -174,7 +186,13 @@ def execute(self): rc = None self.CFXOutputFile = None self.CFXMonFile = None - with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as self.proc: + cfx_env = os.environ.copy() + + with subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=cfx_env, executable=exe + ) as self.proc: + if self.proc == None: + raise Exception("CFX Solver did not start") self.publish_to_default_log("CFX solver started\npid:" + format(self.proc.pid)) t1 = _thread.start_new_thread(self.process_output, (self.proc,)) t2 = _thread.start_new_thread(self.process_error, (self.proc,)) diff --git a/examples/exec_scripts/exec_fluent.py b/examples/exec_scripts/exec_fluent.py index 074cd4782..41063415a 100644 --- a/examples/exec_scripts/exec_fluent.py +++ b/examples/exec_scripts/exec_fluent.py @@ -62,7 +62,6 @@ def execute(self): "fluent_otherEnvironment", "{}" ) inputs["fluent_UDFBat"] = self.context.execution_context.get("fluent_UDFBat", None) - inputs["fluent_jouFile"] = self.context.execution_context.get("fluent_jouFile", None) inputs["fluent_useGUI"] = self.context.execution_context.get("fluent_useGUI", False) inputs["fluent_additionalArgs"] = self.context.execution_context.get( "fluent_additionalArgs", "" @@ -106,8 +105,11 @@ def execute(self): for f in files: log.info(" " + f) - if not os.path.isfile(inputs["fluent_jouFile"]): - raise Exception("File " + inputs["fluent_jouFile"] + " does not exist!") + jouFile = next((f for f in self.context.input_files if f["name"] == "jou"), None) + log.info("journal file path: " + jouFile["path"]) + + if jouFile == None or not os.path.isfile(jouFile["path"]): + raise Exception("File " + jouFile["path"] + " does not exist!") # Add " around exe if needed for Windows exe = app["executable"] # should already be platform specific @@ -137,7 +139,7 @@ def execute(self): args += " -mpi=" + format(inputs["fluent_MPIType"]) if inputs["fluent_numGPGPUsPerMachine"] > 0: args += " -gpgp=" + format(inputs["fluent_numGPGPUsPerMachine"]) - args += " -i " + inputs["fluent_jouFile"] + args += " -i " + jouFile["path"] # args+= cnf if not noGuiOptions == None: args += noGuiOptions diff --git a/examples/fluent_nozzle/project_setup.py b/examples/fluent_nozzle/project_setup.py index b9d0afc49..1e3bc76fe 100644 --- a/examples/fluent_nozzle/project_setup.py +++ b/examples/fluent_nozzle/project_setup.py @@ -137,7 +137,6 @@ def create_project(client, name, num_jobs=20, version=__external_version__): "fluent_numGPGPUsPerMachine": 0, "fluent_MPIType": "intel", "fluent_otherEnvironment": "{}", - "fluent_jouFile": "solve.jou", "fluent_useGUI": False, }, max_execution_time=50.0,