Fri 16 May 23:06:54 CEST 2025
This commit is contained in:
parent
5ed0ca22c1
commit
cc86756bcd
|
@ -1,9 +1,13 @@
|
|||
from SimNDT.engine.engineBase import EngineBase
|
||||
|
||||
#
|
||||
# Setup and control of numerical simulation
|
||||
# Input: Simulation.Im derived from Scenario.Iabs
|
||||
#
|
||||
try:
|
||||
import SimNDT.engine.efit2dcython as EFIT2DCython
|
||||
except:
|
||||
print("error in importation for Serial EFIT2D")
|
||||
print("error in import for Serial EFIT2D (efit2dcython)")
|
||||
|
||||
from SimNDT.core.material import Material
|
||||
from SimNDT.core.constants import BC
|
||||
|
@ -30,7 +34,6 @@ pzt = Material("pzt", 7750.0, c11, c12, c22, c44)
|
|||
class EFIT2D(EngineBase):
|
||||
def __init__(self, simPack, Platform):
|
||||
EngineBase.__init__(self, simPack, Platform)
|
||||
|
||||
self.max_value = 0.0
|
||||
self._Receiver = False
|
||||
|
||||
|
@ -38,8 +41,9 @@ class EFIT2D(EngineBase):
|
|||
if self.Platform == "OpenCL":
|
||||
self.initFieldsCL()
|
||||
|
||||
# Main setup of numerical model
|
||||
def materialSetup(self):
|
||||
|
||||
print("EFIT2D: Creating material matrix from material library.")
|
||||
Materials = copy.deepcopy(self.simPack.Materials)
|
||||
MRI, NRI = np.shape(self.simPack.Simulation.Im)
|
||||
|
||||
|
@ -77,7 +81,7 @@ class EFIT2D(EngineBase):
|
|||
self.Eta_v[ind] = Materials[n].Eta_v
|
||||
self.Eta_s[ind] = Materials[n].Eta_s
|
||||
|
||||
# Find the base materials
|
||||
# Find the base materials (always label 0)
|
||||
for i, item in enumerate(Materials):
|
||||
if item.Label == 0:
|
||||
base_material = i
|
||||
|
@ -92,6 +96,40 @@ class EFIT2D(EngineBase):
|
|||
self.Eta_v[ind] = Materials[base_material].Eta_v
|
||||
self.Eta_s[ind] = Materials[base_material].Eta_s
|
||||
|
||||
# Direct import of Rho, VL and VT material matrix
|
||||
def materialImport(self,Rho,VL,VT,Eta_v,Eta_s):
|
||||
print("EFIT2D: Importing material matrix.")
|
||||
eta_v=1e-30
|
||||
eta_s = 1e-30
|
||||
MRI, NRI = np.shape(Rho)
|
||||
self.Rho = Rho.astype('float32')
|
||||
ind = np.nonzero(Rho < 2)
|
||||
self.Rho[ind] = 10e23
|
||||
self.Eta_v = np.ones((MRI, NRI), dtype=np.float32)*eta_v
|
||||
self.Eta_s = np.ones((MRI, NRI), dtype=np.float32)*eta_s
|
||||
Lam = Rho*(VL*VL-2*VT*VT)
|
||||
Mu = Rho*(VT*VT)
|
||||
C11 = Lam+2*Mu
|
||||
C12 = Lam
|
||||
C22 = C11
|
||||
C44 = Mu
|
||||
self.C11 = C11.astype('float32')
|
||||
self.C12 = C12.astype('float32')
|
||||
self.C22 = C22.astype('float32')
|
||||
self.C44 = C44.astype('float32')
|
||||
self.C11[ind] = 1e-20
|
||||
self.C12[ind] = 1e-20
|
||||
self.C22[ind] = 1e-20
|
||||
self.C44[ind] = 1e-20
|
||||
print("Rho=["+str(self.Rho.min())+","+str(self.Rho.max())+"]")
|
||||
print("C11=["+str(self.C11.min())+","+str(self.C11.max())+"]")
|
||||
print("C12=["+str(self.C12.min())+","+str(self.C12.max())+"]")
|
||||
print("C22=["+str(self.C22.min())+","+str(self.C22.max())+"]")
|
||||
print("C44=["+str(self.C44.min())+","+str(self.C44.max())+"]")
|
||||
# Warning: If boundary is air the boundary must be set to base material, but applyBoundaries sets boundary again to 0; don't care about it here?
|
||||
|
||||
|
||||
|
||||
def initFields(self):
|
||||
|
||||
MRI, NRI = np.shape(self.simPack.Simulation.Im)
|
||||
|
|
Loading…
Reference in New Issue
Block a user