from fealpy.functionspace import ParametricLagrangeFiniteElementSpace class PlanetHeatConductionSimulator(): def __init__(self, mesh): self.space = ParametricLagrangeFiniteElementSpace(mesh, p=1) self.mesh = self.space.mesh self.M = self.space.mass_matrix() self.A = self.space.stiff_matrix() if __name__ == '__main__': from fealpy.mesh import MeshFactory import matplotlib.pyplot as plt mesh = MeshFactory.unitcirclemesh(h=0.1, p=1) mesh.meshdata['A'] = 0.1 # 邦德反照率 mesh.meshdata['epsilon'] = 0.9 # 辐射率 mesh.meshdata['rho'] = 1400 # kg/m^3 密度 mesh.meshdata['c'] = 1200 # Jkg^-1K^-1 比热容 mesh.meshdata['kappa'] = 0.02 # Wm^-1K^-1 热导率 mesh.meshdata['sigma'] = 5.6367e-8 # 玻尔兹曼常数 mesh.meshdata['q'] = 1367.5 # W/m^2 太阳辐射通量 mesh.meshdata['mu0'] = 1 # max(cos beta,0) 太阳高度角参数 simulator = PlanetHeatConductionSimulator(mesh) mesh.to_vtk(fname='test.vtu')
mesh = mf.boxmesh2d(box, nx=4, ny=4, meshtype='poly') mesh = mf.triangle(box, h=0.1, meshtype='tri') mesh = mf.triangle(box, h=0.1, meshtype='poly') mesh = mf.special_boxmesh2d(box, n=10, meshtype='fishbone') mesh = mf.special_boxmesh2d(box, n=10, meshtype='rice') mesh = mf.special_boxmesh2d(box, n=10, meshtype='cross') mesh = mf.special_boxmesh2d(box, n=10, meshtype='nonuniform') mesh = mf.unitcirclemesh(0.1, meshtype='tri') mesh = mf.unitcirclemesh(0.1, meshtype='poly') # 3d mesh if False: box = [0, 1, 0, 1, 0, 1] mesh = mf.boxmesh3d(box, nx=1, ny=1, nz=1, meshtype='hex') mesh = mf.boxmesh3d(box, nx=1, ny=1, nz=1, meshtype='tet') # plot GD = mesh.geo_dimension() fig = plt.figure() if GD == 2: axes = fig.gca()
Author ------ Huayi Wei <*****@*****.**> Date ---- 2021.06.03 08:48:52 """ import numpy as np import matplotlib.pyplot as plt from fealpy.mesh import MeshFactory as MF box2d = [0, 1, 0, 1] mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='tri') mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='quad') mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='poly') mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='fishbone') mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='rice') mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='cross') mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='nonuniform') mesh = MF.unitcirclemesh(0.1, meshtype='poly') mesh = MF.triangle(box2d, 0.1, meshtype='poly') fig = plt.figure() axes = fig.gca() mesh.add_plot(axes) plt.show()