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

Automatic input file (.in) generation #111

Open
1 task done
Jamie790 opened this issue Nov 30, 2023 · 5 comments
Open
1 task done

Automatic input file (.in) generation #111

Jamie790 opened this issue Nov 30, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Jamie790
Copy link

Problem

I have a larger vascular tree that contains thousands of small vessels. I am trying to use a 1D solver for this vascular tree but I could not generate an input file (.in).

I try to use VMTK to extract the network from the vascular tree and get the nodes of vascular networks. but for joints and segments, I don't know how to define them to be recognised in the 1D solver.

Please give me some advice. Many thanks.

Regards,
Jamie

Solution

Automatic input file (.in) generation from large surface file (.stl)

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines
@Jamie790 Jamie790 added the enhancement New feature or request label Nov 30, 2023
@mrp089
Copy link
Member

mrp089 commented Dec 1, 2023

@Jamie790, have a look at our ROM Simulation Tool in the SimVascular GUI. It's made exactly for this purpose. You can turn a vascular surface into a centerline and that into a 0D or 1D model automatically. This is the paper behind these methods. You can also run this process with the SimVascular Python API.

@Jamie790
Copy link
Author

Jamie790 commented Dec 1, 2023

Hi,
Thanks for the reply, I have tried both ROM Simulation in Tool SimVascular GUI and SimVascular Python API. But the model I am dealing with is insanely complex shown below:

image

It will take forever to load in SimVascular GUI. Any suggestions? For example, when importing the surface model, will the model be easier to load if I change the separation angle?

I am currently trying to refine the model by eliminating very small vessels, hopefully, I can import to GUI after that. Also, I am trying to write my own code to generate input files from surface files for 1D simulation, i used the VMTK to extract the vessel network shown below: and try to get the nodes, segments and joints from this network.

image

Regards,
Jamie

@mrp089
Copy link
Member

mrp089 commented Dec 2, 2023

Oh wow, that is quite a detailed model!

SimVascular also calculates the centerline using VMTK but then does some additional processing. This processing gets a more accurate cross-sectional area and branch/junction splitting than directly from VMTK. This is where it takes a very long time.

In our pulmonary models, we reached a "reasonable" processing time (which could still be ~1 hour) using an adaptive coarser mesh size. If you can import the surface geometry, you could experiment with radius-based meshing (finer mesh on smaller branches) and coarser mesh size. However, if the mesh is too coarse, VMTK might skip some branches and SimVacsular will throw an error. With a geometry that detailed, that still might not work.

Another option involving more programming would be to bypass the additional processing and try using the information from VMTK directly (what you were proposing at the top). These Python functions extract the 0D/1D segments and write them to 0D/1D input files.

@Jamie790
Copy link
Author

Hi,

Thanks for the help. I have make some progress since last week! I am able to import the kidney model in simvascular and successfully meshed (see below). But i got an error message when i try to create Data Files for Simulation as shown below. I am using MacBook Pro with M1 (Ventura 13.4). This error seems like i had wrong installation or current simvascular version not fit my mac (libgfortran.5.dylib not founded). Any help will be appreciated!

image

dyld[16186]: Library not loaded: /usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib
Referenced from: <7F8D4F10-902B-3ADE-B253-9A20D4A22593> /usr/local/sv/svsolver/2022-07-22/bin/svpre
Reason: tried: '/libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/svExternals/lib/libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/svExternals/lib/plugins/libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/lib/libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/./libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/bin/libgfortran.5.dylib' (no such file), '/Applications/SimVascular.app/Contents/Resources/lib/plugins/libgfortran.5.dylib' (no such file), '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)

Regards,
Jamie

@Jamie790
Copy link
Author

Hi,

Please ignore the previous problem, I have solved it already.

I am facing a new problem after successfully generating input file. The solver gave me error message below. I think the error meassage tells me that it have too many vessels (Number of Coupled Surfaces > MAXSURF ).

Can you guild me how to release this limit (MAXSURF), so that i can run the simulation successfully.

The process ID for myrank (0) is (32696).
The number of processes is 1.

Solver Input Files listed as below:

Local Config: solver.inp
Default Input File: Not Setup.

Parameter Values setup as below:

Time Varying Boundary Conditions From File: True
BCT File Type: DAT
Number of BCT Files: 1
BCT Matching Type: Global Node ID
BCT Time Scale Factor: 1.0
Equation of State: Incompressible
Time Step Size: 0.01
Number of Timesteps: 100
Viscous Control: Viscous
Number of Timesteps between Restarts: 50
Print Average Solution: True
Print Error Indicators: False
Number of Force Surfaces: 1
Surface ID's for Force Calculation: 1
Force Calculation Method: Velocity Based
Apply Wall Deformation: False
Number of Surfaces which Output Pressure and Flow: 0
Density: 1.06
Viscosity: 0.04
Solver Type: svLS
svLS Type: NS
Number of Krylov Vectors per GMRES Sweep: 100
Number of Solves per Left-hand-side Formation: 1
Tolerance on Momentum Equations: 0.05
Tolerance on Continuity Equations: 0.4
Tolerance on svLS NS Solver: 0.4
Maximum Number of Iterations for svLS NS Solver: 1
Maximum Number of Iterations for svLS Momentum Loop: 2
Maximum Number of Iterations for svLS Continuity Loop: 400
Residual Tolerance: 1000000.0
Time Integration Rule: Second Order
Time Integration Rho Infinity: 0.5
Flow Advection Form: Convective
Quadrature Rule on Interior: 2
Quadrature Rule on Boundary: 3
Number of Elements Per Block: 255
Number of Coupled Surfaces: 380
Number of Coupled Surfaces > MAXSURF

Regards,
Jamie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants