Simulations & Solvers

FDTD, Low-Frequency, Neuron, Mode-Matching, Flow, Acoustics, etc...

213 Topics 627 Posts

Subcategories


  • FDTD, Low-Frequency, Neuron, Mode-Matching, Flow, Acoustics, etc...

    11 Topics
    27 Posts

    Hi! Can someone help me understand if it makes sense to calculate SAR statistics in a low frequency electrical stimulation (30 Hz)? Thanks!!

  • 0 Votes
    2 Posts
    360 Views

    I am not familiar with SCANIP or it's image formats, but can't you export your data as an stl or another compatible image format?

    In the 'Model' tab, if you click on 'Imp/ Export' -> 'Import' you should be able to see the different file formats that can be imported.

    If Exporting your whole model as some compatible format doesn't work, maybe you can export the different tissues individually?

    If this doesn't work then maybe you can email the support team to request compatibility?

  • Acoustic Signal Input File

    4
    0 Votes
    4 Posts
    180 Views

    Really late reply, sorry, hope the reply is still useful ... Please check in 'Setup' what you set up in 'Periods' ... For user defined sources, the simulation time is defined by 1/frequency * periods ... So this might be the issue (which should probably be changed if so)

  • Induced Magnetic H-field

    4
    0 Votes
    4 Posts
    227 Views

    You're welcome!
    If you haven't found it already, you may also check this post: https://forum.zmt.swiss/topic/8/how-to-calculate-the-inductance-of-a-simple-coil
    It has useful information for computing the inductances...

  • 0 Votes
    1 Posts
    101 Views
    No one has replied
  • 0 Votes
    9 Posts
    309 Views

    @Sylvain I agree with you suggestion that the sine wave with duty cycle can be equal to the continuous sine wave as long as both of the excitation signals have the same time-averaged power. But, I still very curious about the computation algorithm of the s4l.

  • 0 Votes
    8 Posts
    363 Views

    @Sylvain Thank you for you reply. I think I have known the explaination. Actually, I want use the EM FDTD and the Thermal Transient modules to simulate the heating problem. Firstly, I used the sine waveform as the excitation signal. The microwave induced heat caused significant temperature increasing. However, when I replaced the continuous sine waveform into the waveform with pulse width modulation (the duty cycle is 10%), it doesn't see temperature increasing any more. I noticed that I didn't select the option of normalization in the source of Thermal Transient. I don't knwo whether I should select the normalization and set the scale factor as 1 W? The normal sine waveform and the modulated sine waveform are shown in below, respectively.
    捕获2.PNG
    捕获1.PNG

  • Transducer Array

    4
    0 Votes
    4 Posts
    213 Views

    Yes I'm aware of what you're referring to but there is no readily available template available in Sim4Life. With some work it could be easily generated via a Python script (by creating spheres and disks and using boolean operators to intersect or subtract them) or perhaps you can maybe email the S4L support team to ask if they can provide you with a model for you to import?

  • GPU simulation - Error code (no error code)

    2
    0 Votes
    2 Posts
    165 Views

    Hi,

    Did you try to run one of the tutorial examples (Dipole antenna, for example) with CUDA solver? How big is your simulation project in terms of grid size?

  • Thermal Simulation, Surface normals not found warning

    Solved
    4
    1 Votes
    4 Posts
    246 Views

    I am having this issue as well, with S4L Light 5.2.1.1375 which is the latest version(as of the time I am posting this). My model is simple cylinder with homogenous liquid modeled within the S4L software platform. Any advice or insight how to remove it would be much appreciated as it means I cannot run the solver as it diverges.

    Note: This was fixed by removing the nan's from my source term, and surrounding my cylindeer with a rectangular block of air so that the solver was working in a rectangular black not a cylinder.

  • FDTD Timestep

    2
    0 Votes
    2 Posts
    214 Views

    Hi,
    As FDTD is a time-domain based method, implementing LF sources with this method is quite challenging. It would need a very (very) long simulation's time, without any assurance of reaching the correct convergence level at the end - furthermore if your simulation has a certain amount of MCells.
    For input signal with frequency components below the MHz, LF approach is the only solution that would give you quick and accurate results. I would thus advice you to (1) get the current profile along time, and (2) do a fft so as to get the current's magnitude for each of the frequency components. Then, (3) perform several LF simulations for each of the frequency/magnitude obtained during step (2).
    Best

  • Maximum Cell Count

    10
    0 Votes
    10 Posts
    582 Views

    thanks. It works if I lower it to 55khz, but not if I lower it to 2kHz.

  • Material anisotropy along a curve?

    4
    0 Votes
    4 Posts
    272 Views

    Something to get started to create an anisotropic conductivity tensor for S4L from solving a Poisson equation with boundary conditions (running an EM simulation and using its potential). Once the field is created in the analysis tab it can be used as a part of a new EM simulation for any material selected to have inhomogeneous and anisotropic properties.

    import numpy as np import s4l_v1.document as document import s4l_v1.model as model import s4l_v1.simulation.emlf as emlf from s4l_v1 import ReleaseVersion, Unit from s4l_v1.model import Vec3, Translation, Rotation import s4l_v1.units as units import s4l_v1.analysis as analysis import XCoreModeling def CreateMockAnisotropicConductivity(sim): # Transversal and longitudinal sigmas sigma1 = 3.0 sigma2 = 1.0 # here conductivity has 6 component (anisotropic tensor) results = sim.Results() p = results["Overall Field"].Outputs["EM Potential(x,y,z,f0)"] p.Update() e = results["Overall Field"].Outputs["EM E(x,y,z,f0)"] e.Update() e_field = e.Data.Field(0) nc = e.Data.Grid.NumberOfCells print "E Field shape", e_field.shape print "Number of Cells", nc # E Field shape (nc, 3) - Cell centered # Calculate sigma on cell centers print "Calculate anisotropic sigma values" sigma_wm = np.zeros([nc,6]) # 6 unique values # tensor component indexing for solver iu3 = (np.array([0, 1, 2, 0, 1, 0], dtype=np.int64), np.array([0, 1, 2, 1, 2, 2], dtype=np.int64)) for idx, val in enumerate(e_field): tmp = np.zeros([3,3], dtype=np.complex) tmp[0] = val if (not np.isnan(val).any() and np.inner(val, val) != 0): P = np.dot(tmp.T, tmp) / np.inner(val,val) else: P = np.full((3, 3), 0, dtype=np.complex) sigma_tensor = sigma1*P + sigma2*( np.identity(P.shape[0]) - P ) sigma_wm[idx] = sigma_tensor[iu3].real sigma_swapped = sigma_wm[:,[0,1,2,3,5,4]] # Fix bug where yz and xz were swapped tensor_conductivity = analysis.core.DoubleFieldData() tensor_conductivity.NumberOfSnapshots = 1 tensor_conductivity.NumberOfComponents = 6 tensor_conductivity.Grid = e.Data.Grid.Clone() tensor_conductivity.ValueLocation = analysis.core.eValueLocation.kCellCenter tensor_conductivity.SetField(0, sigma_swapped) #sigma_wm) # Fix bug where yz and xz were swapped tensor_conductivity.Quantity.Name = 'Anisotropic Conductivity From E Field' tensor_conductivity.Quantity.Unit = analysis.core.Unit('S/m') producer_t = analysis.core.TrivialProducer() producer_t.SetDataObject(tensor_conductivity) producer_t.Name = 'Anisotropic Conductivity' document.AllAlgorithms.Add(producer_t)
  • 0 Votes
    6 Posts
    432 Views

    @montanaro said in Inhomogenous anisotropic electrical conductivity:

    Hi yes this is possible in the latest release of Sim4Life, however there isn't a good tutorial for it at the moment (I'll help prepare one). Essentially what is needed is to create a Trivial Producer (an artificial field distribution in the Analysis tab) via Python that has 6 components, representing the symmetric anisotropic tensor values ordered in such a way: xx, yy, zz, xy, xz, yz. Each component should have the full anisotropic values that will be interpolated into the simulation grid. This trivial producer must be assigned the correct units of S/m (this is all handled via a Python script). Once that is done, then in your EM simulation you can assign these values to any given material: Materials -> Electric Conductivity: Anisotropic, Inhomogeneous -> Data Origin: Analysis Output -> Then you can select your field.

    I'll hopefully find some time to update this comment here with a sample script.

    Here's a sample script I found to import VTI data and convert it to a Trivial producer in the correct format. Let me know if anything is not clear.

    # -*- coding: utf-8 -*- import os import numpy as np import vtk from vtk.numpy_interface import dataset_adapter as dsa import XCoreModeling import XPostProcessor fp = r"D:\Users\sample\path" fn = "sample.vti" f = os.path.join(fp, fn) reader = vtk.vtkXMLImageDataReader() reader.SetFileName(f) reader.Update() img = dsa.WrapDataObject(reader.GetOutput()) dxx = img.PointData['Dxx'] dyy = img.PointData['Dyy'] dzz = img.PointData['Dzz'] dxy = img.PointData['Dxy'] dyz = img.PointData['Dyz'] dxz = img.PointData['Dxz'] dims = img.VTKObject.GetDimensions() origin = img.VTKObject.GetOrigin() spacing = img.VTKObject.GetSpacing() # scale to meters scale = XCoreModeling.GetActiveModel().LengthUnits.ToUnit(XPostProcessor.Unit.Meter) origin = [scale*origin[0], scale*origin[1], scale*origin[2]] spacing = [scale*spacing[0], scale*spacing[1], scale*spacing[2]] grid = XPostProcessor.UniformGrid() grid.SetUnit(0, XPostProcessor.Unit.Meter) # note meters here grid.SetUnit(1, XPostProcessor.Unit.Meter) grid.SetUnit(2, XPostProcessor.Unit.Meter) # create dual grid, so we can assign point data from image as cell centered data grid.SetDimensions(dims[0]+1, dims[1]+1, dims[2]+1) grid.SetOrigin(origin[0]-0.5*spacing[0], origin[1]-0.5*spacing[0], origin[2]-0.5*spacing[0]) grid.SetSpacing(spacing[0], spacing[1], spacing[2]) assert grid.NumberOfCells == dxx.shape[0] sigma = np.zeros([grid.NumberOfCells,6]) sigma[:,0] = dxx sigma[:,1] = dyy sigma[:,2] = dzz sigma[:,3] = dxy sigma[:,4] = dyz sigma[:,5] = dxz aniso_cond = XPostProcessor.DoubleFieldData() aniso_cond.Grid = grid aniso_cond.NumberOfSnapshots = 1 aniso_cond.NumberOfComponents = 6 aniso_cond.ValueLocation = XPostProcessor.eValueLocation.kCellCenter aniso_cond.SetComponentLabel(0, "Dxx") aniso_cond.SetComponentLabel(1, "Dyy") aniso_cond.SetComponentLabel(2, "Dzz") aniso_cond.SetComponentLabel(3, "Dxy") aniso_cond.SetComponentLabel(4, "Dyz") aniso_cond.SetComponentLabel(5, "Dxz") aniso_cond.SetField(0, sigma) aniso_cond.Quantity.Name = 'Anisotropic Conductivity From DTI (use for Bone)' aniso_cond.Quantity.Unit = XPostProcessor.Unit('S/m') producer_t = XPostProcessor.TrivialProducer() producer_t.SetDataObject(aniso_cond) producer_t.Description = 'Anisotropic Conductivity' XPostProcessor.AlgorithmRegistry().AddAlgorithm(producer_t)
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Multidomain mesh not shown in mesh tools

    3
    0 Votes
    3 Posts
    312 Views

    The multidomain mesh is currently not available for Sim4Life light, that's why the relevant button does not appear in the ribbon.

  • 0 Votes
    1 Posts
    187 Views
    No one has replied
  • 0 Votes
    1 Posts
    256 Views
    No one has replied
  • 1 Votes
    1 Posts
    186 Views
    No one has replied
  • 0 Votes
    2 Posts
    256 Views

    Hi,
    In transient thermal simulation, several ways of defining initial temperatures distribution are available (as detailed in the Manual, section 2.8.2.5). In your case, either 'steady state' or 'continue simulation' can allow you to avoid those 30 min with no EM sources. Here an example of process:
    (1) Run a first thermal simulation with only the human model and its proper thermal features, until reaching the required steady-state. This simulation would be the initialization of all your thermal simulations.
    (2) Create a 2nd simulation in which the 'Material' is defined as for the first one and use the 'Continue Simulation' option. You would also need to define the 'Snapshot', meaning at what time of the first simulation you are considering the initial temperatures (take care in case of non-convergence). EM sources can then be directly applied at 0 second.
    For ensuring accuracy, I would advice you to keep the same grid for all your thermal simulations.
    Best,
    Mélina

  • Break of continuity on E-field

    1
    0 Votes
    1 Posts
    144 Views
    No one has replied