Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way for AdvancedExtruderGenerator (and other ExtruderGenerators) to report extrusion layering scheme #27985

Open
lewisgross1296 opened this issue Jun 25, 2024 · 1 comment
Labels
C: Meshing MeshGenerator system, mesh loading T: task An enhancement to the software.

Comments

@lewisgross1296
Copy link

Motivation

I'm currently experimenting with non-uniform z-layering in my mesh, and I want to be able to make plots of my VPPs as a function of z. Here's an example of my z-layering scheme using the AdvancedExtruderGenerator

  [extrude]
    type = AdvancedExtruderGenerator
    input = 'bundle'
    heights    = '0.1 0.1 0.1 1.4 0.1 0.1 0.1'
    num_layers = '3    6    6     36 6     6    3'
    direction = '0 0 1'
    subdomain_swaps = '1 6 2 6;
                       1 6 2 6;
                      ;
                      ;
                      ;
                      1 6 2 6; 
                      1 6 2 6'
  []

I'm currently trying to use an AuxVariable + ParsedAux to compute the z of each element with an ElementValueSampler VPP to generate a CSV of z-heights, but it's kind of clunky -- and requiring me to do more post processing to delete the duplicates from each element.

It would be nice to have a way to take the information from the mesh generator and generate a layering scheme (in my case in the z-direction), but it could be arbitrary for the direction parameter for the x,y, and z unit vectors.

Design

Here's the python code I wrote to do this, which accepts heights and num_layers (just as is used in AdvancedExtruderGenerator)

def compute_mesh_z_positions(layers, heights, z_min = 0):
    try:
        len(layers) == len(heights)
    except ValueError:
        print(f"The length of layers ({len(layers)}) and heights ({len(heights)}) must be the same")

    z_bounds = [z_min]
    for layer,height in zip(layers,heights):
        for i in range(layer):
            z_bounds.append(z_bounds[-1] + height)

    z_centers = [0.5*(z_bounds[i+1]+z_bounds[i]) for i in range(len(z_bounds)-1)]

    return z_bounds, z_centers

Impact

While I'm pretty sure my python code works, it would be great from a QC standpoint to have MOOSE output the z corresponding to each VPP value in a way that doesn't require removing duplicates (like w ElementValueSampler)

@lewisgross1296 lewisgross1296 added the T: task An enhancement to the software. label Jun 25, 2024
@lindsayad lindsayad added the C: Meshing MeshGenerator system, mesh loading label Jun 25, 2024
@lewisgross1296
Copy link
Author

Oh a note about my python code. I define my heights a little differently than the AdvancedExtruderGenerator, but converting between them isn't too bad.

E.g., where I specify (0.1, 3) for the first (height, num_layers) pair in my list of heights and layers in the mesh generation script, the python would actually want (0.1/3, 3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Meshing MeshGenerator system, mesh loading T: task An enhancement to the software.
Projects
None yet
Development

No branches or pull requests

2 participants