helppyFormex - Support: sr #109152, CFD: Creating a cell layer...

 
 

sr #109152: CFD: Creating a cell layer thickness growth routine?

Submitted by:  Klaus Burkart <klausb>
Submitted on:  Mon 26 Sep 2016 04:04:17 PM UTC  
 
Category:  Open discussion Priority:  5 - Normal
Severity:  3 - Normal Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 26 Sep 2016 07:04:55 PM UTC, comment #1: 

This is a typical Python indentation error, probably caused by mixing TABs and spaces for indentation. Try to use only spaces for indentation. Mpst people typically use 4space indentation. (A TAB only counts for 1 character!).

Also, the returning of the list should not have the [].
Thus:

# boundary layer, cell layer thickness growth
def bl_growth(wall_dist,nbl,gr):
    n_layers=[0.0,wall_dist]       # starting on the airfoil surface, first layer thickness = wall distance, following layers grow with a rate of gr e.g. 1.12
    growth=wall_dist
    for i in range(3, nbl):
        growth=growth*gr
        n_layers.append(growth)
    return(n_layers)

And you probably want to add a cumsum() before applying the computed values in the connectCurves() function:

LT = array(LT).cumsum()

Benedict Verhegghe <bverheg>
Project Administrator
Mon 26 Sep 2016 04:04:17 PM UTC, original submission:  

I want to populate an array with cell layer thickness values for the boundary layer mesh consisting of a defined number of cells.

The first value is 0.0 which means the mesh starts at the airfoil surface. The first layer has a thickness of wall_distance which is an input calculated based on flow properties. The following layers thickness growth with a certain rate e.g. 1.12 which has to be adjustable.

I keep getting an error: IndentationError: unindent does not match any outer indentation level

I tried the following:

# boundary layer, cell layer thickness growth
# wall_dist = wall distance, nbl = number of cell layers, gr = growth rate
def bl_growth(wall_dist,nbl,gr):
        n_layers=[0.0,wall_dist]    # array, incl. first two values
growth=wall_dist
        for i in range(3, nbl):
            growth=growth*gr
            n_layers.append(growth)
    return(n_layers[])

...

# Create a quad4 boundary layer mesh between the two curves
wall_dist = 2.5e-5 # wall distance based on reynolds number and flow velocity
nbl=20 # number of boundary layer cell layers
gr=1.25 # boundary layer cell layers thickness growth rate/factor
#nbl = [0.0,2.5e-2,0.1,0.2,0.4,0.7,1.0]
LT=bl_growth(wall_dist,nbl,gr)
M1 = simple.connectCurves(Ca,Ba,LT)
draw(M1,color=cyan)

Klaus Burkart <klausb>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #38598:  cfd_2d_work_3.py added by klausb (2KiB - text/x-python)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by klausb (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-26 klausb Attached File- => Added cfd_2d_work_3.py, #38598

    Back to the top


    Powered by Savane 3.5