Update TO_Problem.py
This commit is contained in:
parent
19b64de76e
commit
6d2171b3af
|
@ -1,11 +1,15 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
'''
|
||||||
Created on Tue Aug 11 14:20:11 2020
|
@ Copyright (c) 2022 by Zeyu Zhang, All Rights Reserved.
|
||||||
|
@ Author : Zeyu Zhang
|
||||||
@author: zzy
|
@ Email : zhangzeyu_work@outlook.com
|
||||||
|
@ Date : 2022-10-25 09:30:27
|
||||||
定义设计域
|
@ LastEditTime : 2022-10-25 09:33:20
|
||||||
"""
|
@ FilePath : /ZZY_CODE/Env_JAX/IDRL/Linear_TO/TO_Problem.py
|
||||||
|
@
|
||||||
|
@ Description :
|
||||||
|
@ Reference :
|
||||||
|
'''
|
||||||
|
|
||||||
import jax.ops as jops
|
import jax.ops as jops
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -81,49 +85,5 @@ def cantilever_single_NN(TopOpt):
|
||||||
return model_kwargs
|
return model_kwargs
|
||||||
|
|
||||||
|
|
||||||
def cantilever_single_big():
|
|
||||||
L = 1.6
|
|
||||||
W = 0.8
|
|
||||||
nelx = 160
|
|
||||||
nely = 80
|
|
||||||
design_condition = 2
|
|
||||||
Total_dof = 2*(nelx+1)*(nely+1)
|
|
||||||
ele_length = L/nelx
|
|
||||||
ele_width = W/nely
|
|
||||||
ele_thickness = 1.0
|
|
||||||
volfrac = 0.5
|
|
||||||
dofs = np.arange(Total_dof)
|
|
||||||
loaddof = Total_dof-1
|
|
||||||
# fext = jnp.zeros(Total_dof)
|
|
||||||
# fext = jops.index_update(fext, jops.index[loaddof], -1.)
|
|
||||||
fext = np.zeros(Total_dof)
|
|
||||||
fext[loaddof] = -1
|
|
||||||
fixeddofs = np.array(dofs[0:2*(nely+1):1])
|
|
||||||
freedofs = np.setdiff1d(dofs, fixeddofs)
|
|
||||||
filter_width = 3.0
|
|
||||||
design_map = np.ones([nely, nelx], dtype=np.int64)
|
|
||||||
return ToProblem(L, W, nelx, nely, design_condition, ele_length, ele_width, ele_thickness, volfrac, fixeddofs, freedofs, fext, filter_width, design_map)
|
|
||||||
|
|
||||||
|
|
||||||
def cantilever_single_big_NN(TopOpt):
|
|
||||||
dense_input_channel = 128
|
|
||||||
dense_init_scale = 1.0
|
|
||||||
conv_input_0 = 32
|
|
||||||
up_sampling_scale = (1, 2, 2, 2, 2)
|
|
||||||
total_resize = int(np.prod(up_sampling_scale))
|
|
||||||
h = TopOpt.nely // total_resize
|
|
||||||
w = TopOpt.nelx // total_resize
|
|
||||||
dense_output_channel = h * w * conv_input_0
|
|
||||||
dense_scale_init = dense_init_scale * \
|
|
||||||
jnp.sqrt(jnp.maximum(dense_output_channel / dense_input_channel, 1))
|
|
||||||
model_kwargs = {
|
|
||||||
'h': h,
|
|
||||||
'w': w,
|
|
||||||
'dense_scale_init': dense_scale_init,
|
|
||||||
'dense_output_channel': dense_output_channel,
|
|
||||||
'dense_input_channel': dense_input_channel,
|
|
||||||
'conv_input_0': conv_input_0,
|
|
||||||
'up_sampling_scale': up_sampling_scale,
|
|
||||||
}
|
|
||||||
return model_kwargs
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue