[Scons-users] SCons for Ansys APDL Analysis

Bill Deegan bill at baddogconsulting.com
Mon Oct 17 13:01:41 EDT 2022


How are dependencies specified?
Is there some syntax in the source file?

There's no fundamental reason SCons wouldn't be able to help with your
workflow.

BTW why use tools=['mingw'] ?


On Mon, Oct 17, 2022 at 7:34 AM Hubley, Christopher (GE Aerospace, US) <
Christopher.Hubley at ge.com> wrote:

> Hello,
> I've been researching the use of SCons for engineering analysis with Ansys
> Parametric Design Language (APDL).
>
> APDL is a Fortran-like scripting language, used for performing finite
> element analysis with the Ansys software.
>
> We typically generate analyses written in APDL which have complex sets of
> dependencies, and I'm hoping SCons will be able to help manage those.
>
> "Dependencies 1"                "Dependencies 2"
>     |                              |
>     |              +--Some files-->+              +--Some files-->+
>     |              |               |              |
>     v              |               v              |
> "Compile 1" --> "Results 1"     "Compile 2" --> "Results 2" ... and so on
> a hundred more times
>
> (this diagram will only be readable if you use a monospace font)
>
> It's not uncommon to edit dependencies for a load step ("compile") in the
> middle of a long analysis. It'd be great if we had a build tool which could
> detect changes to inputs and only compile load steps which have changed.
>
> I've managed to write a Builder using the Command() function, and it seems
> to work... but only just so.
>
> I find it difficult to share the output from one build as an input to the
> next build. Part of the problem might be that I'm new to the software and
> I've had a hard time wrapping my head around what Scons is doing under the
> hood for file management.
>
> What I'd like to do is run/build my each load step in a target directory,
> and then remove the dependencies from the build directory. I'm hoping SCons
> could decide whether to run a load step based on whether the input files
> have been updated.
>
> Here's an example of what I think the SCons scripts might look like:
>
> # SConstruct
> from site_scons import run_ansys
>
> ansys_version = '19.2'
>
> env = Environment(tools=['mingw'])
> env.Decider('timestamp-newer')
> env.AddMethod(ansys_runner, 'Ansys')
>
>
> # Frictionless Assembly
> assy_mu0_dir = Path('results/assembly_mu0').resolve()
> SConscript(
>     'analysis/assembly_mu0/SConscript',
>     variant_dir = str(assy_mu0_dir),
>     duplicate = True,
>     exports = ['env', 'assy_mu0_dir', 'ansys_version'],
> )
> # Import linked dependencies
> env.Import('assy_mu0_restart')
>
>
> # Frictional Assembly (restart from frictionless) assy_dir =
> Path('results/assembly').resolve()
> SConscript(
>     'analysis/assembly/SConscript',
>     variant_dir = str(assy_dir),
>     duplicate = True,
>     exports = ['env', 'ansys_version', 'assy_dir', 'assy_mu0_restart'],
> )
>
> .
> .
> .
>
> # analysis/assembly/SConscript (example of SConscript)
> from pathlib import Path
>
> Import('env', 'ansys_version', 'assy_dir', 'assy_mu0_restart')
>
> assy = 'HPC_2D_ASSY'
> assy_restart = tuple(
>     str(assy_mu0_dir / f'{assy}.{ext}')
>     for ext in ('db', 'emat', 'esav')
> )
> env.Ansys(
>     input_file = 'assy.inp',
>     output_files = (*assy_restart, f'{assy}.out'),
>     jobname = assy,
>     restart_files = assy_mu0_restart,
>     ansys_version = ansys_version,
> )
> env.Export('assy_restart')
>
>
> I suppose that my question is whether anyone has done this kind of thing
> with SCons before?
> And is the tool appropriate for that? Or am I just trying to push a rope?
>
> As I started laying it out, it seemed like I was writing a lot more code
> than I was anticipating to get it working.
>
> If this has been done before... are there any examples out in the world
> which I might be able to leverage?
>
>
> Christopher K. Hubley
> Senior Engineer, TFTJ Fan & Compressor
> GE Aviation
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20221017/90d87112/attachment-0001.htm>


More information about the Scons-users mailing list