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

Smooth transition of elements from one size to another based on contour levels #120

Open
BahramKhazaei-NOAA opened this issue Nov 7, 2023 · 0 comments
Assignees

Comments

@BahramKhazaei-NOAA
Copy link

One simple way to develop a new approach in OCSMesh for smooth transition between two element/cell size values is to consider multiple contour lines between the two sizes. That can be implemented by defining size at different contour levels as follows:

# level 1:
hfun.add_contour(target_size=750,  level=0,  expansion_rate=0.025)
hfun.add_constant_value(value=750, lower_bound=0)

# level 2:
hfun.add_contour(target_size=2000, level=-1500, expansion_rate=0.01)
hfun.add_constant_value(value=2000, lower_bound=-1500,  upper_bound=-2500)

# level 3:
...

Another way is to just define many levels in the example shown below and define contour levels through a loop:

# Size function criteria for 25 contour levels:
levels   = np.linspace( 0, -7500, num=25)
exp_rate = np.linspace(0.05,  0.01, num=25)
tgt_size = np.linspace(1000,  7500, num=25)

# Define 24 contour levels based on the criteria above:
for il in range (0, len(levels)-1):
    hfun.add_contour(target_size=tgt_size[il], level=levels[il], expansion_rate=exp_rate[il])
    hfun.add_constant_value(value=tgt_size[il], lower_bound=levels[il])

# Define one last level (contour level 25):
hfun.add_contour(target_size=tgt_size[-1],  level=levels[-1],  expansion_rate=exp_rate[-1])
hfun.add_constant_value(value=tgt_size[-1], lower_bound=levels[-2], upper_bound=levels[-1])
@SorooshMani-NOAA SorooshMani-NOAA self-assigned this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants