-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Su Tian
committed
Jul 22, 2021
1 parent
61d964b
commit cebeb86
Showing
3 changed files
with
274 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import platform | ||
import msgpi.analysis as sga | ||
import msgpi.logger as mlog | ||
import dakota.interfacing as di | ||
|
||
|
||
class CrossSectionJob(): | ||
|
||
def __init__(self, name="", design={}, job_args={}, logger=None): | ||
self.name = name | ||
self.design = design | ||
self.job_args = job_args | ||
|
||
if logger is None: | ||
self.logger = mlog.initLogger(__name__) | ||
else: | ||
self.logger = logger | ||
|
||
self.bp = None | ||
self.result = {} | ||
|
||
|
||
|
||
|
||
def run(self): | ||
self.logger.info(f'running analysis job for {self.name}...') | ||
|
||
analysis = self.job_args['analysis'] | ||
|
||
if platform.system() == 'Windows': | ||
ppcmd = self.job_args['prevabs_cmd_win'] | ||
elif platform.system() == 'Linux': | ||
ppcmd = self.job_args['prevabs_cmd_linux'] | ||
|
||
solver = self.job_args['solver'] | ||
integrated = False | ||
if 'integrated' in self.job_args.keys(): | ||
integrated = self.job_args['integrated'] | ||
timeout = 30 | ||
if 'timeout' in self.job_args.keys(): | ||
timeout = self.job_args['timeout'] | ||
scrnout = False | ||
if 'scrnout' in self.job_args.keys(): | ||
scrnout = self.job_args['scrnout'] | ||
|
||
|
||
|
||
# preVABS/VABS | ||
fn_main = self.design['fn_cs_main'] | ||
|
||
# print('\ncs_params') | ||
# pprt.pprint(cs_params) | ||
# print('\n') | ||
|
||
# Substitute parameters | ||
di.dprepro( | ||
template=self.design['fn_cs_temp'], output=fn_main, | ||
include=self.design | ||
) | ||
|
||
# Solve | ||
self.bp = sga.solve( | ||
fn_main, analysis, ppcmd, solver, integrated, | ||
timeout=timeout, scrnout=scrnout, logger=self.logger | ||
) | ||
|
||
# Extract beam properties | ||
self.logger.debug('extracting beam properties...') | ||
for n in self.job_args['beam_properties']: | ||
self.result[n] = self.bp.get(n) | ||
|
||
|
||
# self.cs_data['props'] = self.results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters