2023年6月17日星期六

ICEM model stent and aneurysm

 always forget so I think i better put a mark here 

The aneursym and stent has to meshed separately 


I need some advice. As part of my research our lab focuses on virtual stenting and coiling in patient specific aneurysms. We have traditionally used ICEM CFD to mesh the aneurysm geometry and deployed stent geometry but the problem is it is difficult to resolve the stent geometry without creating a crazy amount of elements. We volume mesh both the aneurysm and stent geometry, then import the mesh into Star-CD, then delete the "shell" elements that represent the stent so we can perform CFD. Can anyone think of a better way of doing this?? Does ICEM CFD have some type of Embedded mesh technique or Immersed Boundary that can be used to resolve the stent meshing issue? Another problem is that since the stent is quite small compared to the parent vessel, ICEM creates dozens of "CREATED MATERIAL" that I believe represent the small volume gaps between the stent geometry. I've tried importing the volume mesh into CFX, but finding and deleting these "shell" elements like we do in Star-CD is not as cut and dry. Is there an easy way in CFX to distinguish between "shell" and the volume elements so the deletion of the stent is easier??

Sorry for the long response but help is appreciated!

https://www.cfd-online.com/Forums/ansys-meshing/110204-aneurysm-stent-meshing.html


after that we can merget them together 

https://www.cfd-online.com/Forums/ansys-meshing/124609-mesh-body-inside-body.html

2023年6月3日星期六

solve module cannot found problem.

Shit, I stuck in a environment path for so many days but finally crack through it. 


after sudo gedit .~bashrc, you put a souce to it.


but what the ass

 you also need to  make the module you want is under the directory path 

e.g. home/ass/


copy the  module there but not under anaconda....hey man you dude!

 

update 22/12

the tiGAR-master should be rename as tIGAR, so inside still have another tIGAR, so the whole directory have to be maintained. 

haha I finally can run the karmensky code 

step by step

 

first 

use gmsh 4.4.1 mesh the geo with step in surface.step

then it will generate gmsh

then use python chamelon.py to generate .xdmf and h5, 

then create a folder 

 fluid-solid problem parameters
p = parser.add_argument_group("fluid-solid problem")
p.add_argument("--mesh-folder",dest="MESH_FOLDER",
               default="./mesh-M0/",
               help="Folder that contains the fluid-solid mesh and markers.")
p.add_argument("--mesh-filename",dest="MESH_FILENAME",
               default="aorta_mesh.xdmf",
               help="Filename of the fluid-solid mesh.")
p.add_argument("--subdomains-filename",dest="SUBDOMAINS_FILENAME",
               default="aorta_subdomains.xdmf",
               help="Filename of the fluid-solid subdomains markers.")
p.add_argument("--boundaries-filename",dest="BOUNDARIES_FILENAME",
               default="aorta_boundaries.xdmf",
               help="Filename of the fluid-solid boundary markers.")
p.add_argument("--markers-string",dest="MARKERS_STRING",default="markers",
               help="Mesh physical group marker string.")
p.add_argument("--polynomial-degree",dest="POLYNOMIAL_DEGREE",
               type=int,default=1,
               help="Fluid-solid problem polynomial degree.")      

 

https://fenics.readthedocs.io/projects/ffc/en/latest/installation.html#id9  


https://stackoverflow.com/questions/74585622/pyfirmata-gives-error-module-inspect-has-no-attribute-getargspec

so got that error chane the visitor.py under coffee to inspect.getfullargspec

Python3.11 Removed: The getargspec() function, deprecated since Python 3.0; use inspect.signature() or inspect.getfullargspec() instead. May 2 at 5:05

2023年5月27日星期六

随便写写 (1)

 我又生病了,最近病毒施虐,倒霉的我又感冒了。 


不过看了一部好电影,每次想起就会生出勇气。 明天会更好。 、


电影名是月球奇幻旅

https://www.youtube.com/watch?v=rY_-jzVziLY


父亲希望你去欧米茄星,我们也希望你能去,因为那也是我们的愿望,希望你能代我们实现!

曾经我也是全村的希望,村里的小孩只有我上了大学,我要成为大学的教授,去帮同年的小伙伴实现成功的愿望,用我的眼睛,去帮大家看世界。不过前路如何艰难,我也要坚持下去。加油kiwi.

冯仑说:伟大都是熬出来的。为什么用熬?因为普通人承受不了的委屈你得承受,普通人需要别人理解安慰励,但你没有,普通人用对抗消极指责来发泄情绪,但你必须看到爱和光,在任何事情上学会转化消化,普通人需要一个肩膀在脆弱的时候靠一靠,而你就是别人依靠的肩膀

 


2021年8月14日星期六

geomagic

 Spent one hour on repair geometry in the geomagic, 


rule of thumb

1. flip to the same normal before moving the imported item 

2. then connect them using bridget


3. easy 

2021年4月21日星期三

tensorflow error

 https://github.com/tensorflow/tensorflow/issues/35403#


using a tf.Tensor as a Python bool is not allowed in Graph execution. Use Eager execution or decorate this function with 


I solve it by just using Can you please try with !pip install tensorflow-gpu==2.1-rc2and see if the error still persists. I am not seeing any issue with TF 2.1.Thanks!

2021年4月19日星期一

compiling netflow

 Have some problem on compiling netflow, so I think the error resulted by 


https://stackoverflow.com/questions/10727568/cannot-convert-parameter-1-from-const-char-to-lpcwstr


n your project, it sounds like all of these macros are referencing the -W versions. This is controlled by the UNICODE preprocessor macro (which is defined if you choose the "Use Unicode Character Set" project option in Visual Studio). (Some of Microsoft's C and C++ run time library functions also have ANSI and wide versions. Which one you get is selected by the similarly-named _UNICODE macro that is also defined by that Visual Studio project setting.)

Typically, both of the -A and -W functions exist in the libraries and are available, even if your application is compiled for Unicode. (There are exceptions; some newer functions are available only in "wide" versions.)

If you have a char * that contains text in the proper ANSI code page, you can call the -A version explicitly (e.g., SetWindowTextA). The -A versions are typically wrappers that make wide character copies of the string parameters and pass control to the -W versions.

An alternative is to make your own wide character copies of the strings. You can do this with MultiByteToWideChar. Calling it can be tricky, because you have to manage the buffers. If you can get away with calling the -A version directly, that's generally simpler and already tested. But if your char * string is using UTF-8 or any encoding other than the user's current ANSI code page, you should do the conversion yourself


change Unicode fixed the problem 

2021年4月15日星期四

tensorflow issue

 stuck in tensorflow for few days for PINN. 

One of thing to get rid of placeholder is upgrade tensorflow

import tensorflow.compat.v1 as tf

tf.disable_v2_behavior() 

#tf.compat.v1.disable_eager_execution()



https://stackoverflow.com/questions/55870127/module-tensorflow-has-no-attribute-contrib


https://stackoverflow.com/questions/30429491/how-to-use-cmakedefine-preprocessor-directive-properly


cannot find header, need to make first 


find to fix the rendering error when install vtk  add word like const

https://stackoverflow.com/questions/19816139/expression-having-type-const-comparevptrs-would-lose-some-const-volatile-quali


stop at here 

File "C:\Users\Chiwei\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 481, in _disallow_in_graph_mode

    " this function with @tf.function.".format(task))


OperatorNotAllowedInGraphError: using a `tf.Tensor` as a Python `bool` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.


suspect is the save function and gpu plot will come back later.



2021年3月3日星期三

editing mesh in comsol

 hahahahaha I finally solve the problem in COMSOL myself. all these damn things come from the physics induced sequence.


next time cannot converge the model., right click mesh edit the physics induced sequence, then set the minimum order to be smaller then you can solve any model. 


https://www.comsol.com/forum/thread/53241/ivar-kjelberg-problem-on-joule-heating-analysis-over-a-thin-geometry


Ivar kjelberg after so many years you are still the best mentor on the forum. thanks for tips. 

2020年6月7日星期日

matlab ubuntu remote control and python2 to python3

Today manage to using remote control on the ubuntu

1. you can turn on the screen sharing using privary setting and ask it to just use the password,
then you can on remina from virtual ubuntu to remote access it
or you can also use windows
instal the vnc viewer
https://www.howtogeek.com/429190/how-to-set-up-remote-desktop-on-ubuntu/

2. also I manage to install matlab on ubuntu
https://linuxconfig.org/how-to-install-matlab-on-ubuntu-18-04-bionic-beaver-linux

3.         try:
            val_local = w.vector()(val_dof[0])

from dolfin import *
from ufl import cofac
import dolfin as dolfin
import sys

import
from ufl import cofac

mesh = Mesh()
f = HDF5File(MPI.comm_world, meshname+".hdf5", 'r')

print(tstep, p_cav*0.0075 , V_cav, fdataPV)

use 2to3 convert print function from python2 to python3
sudo apt-get 2to3

mesh = Mesh()
f = HDF5File(MPI.comm_world, meshname+".hdf5", 'r')

2020年3月23日星期一

A farewell for what-if

did not expect I am going to have my last paper to publish before I go to industry so soon.
I like research, however if I cannot get the Newton fellowship to go Imperial college, then I guess, this is going to be my last chance to do research in postdoc.

Thanks Prof yap for helping me throughout the fellowship application.

Thanks lik chuan and his team to support me unconditionally.

too many people I want to say thanks, but just to say sorry, as I have to let you down this time, as I am preparing to leave already if I dont get it.

Thank you very much NUS for every memory you give me. I am grateful for the past five years you give me. I am thinking if I got the fellowship, I will have another round to stay in research, but ya, my family need money, so I guess there is no turning back and I have to go d.

Thank you so much for the research world and wish all the best for the biomechanics journey.

I will be going to miss your guys very much.

enjoy guys!

2019年5月30日星期四

error for gcloud permission

I recently has problem on uploading the file to gcloud services, so the solution is suggested as below

is add the username@ instances name

that solve the problem

2019年2月27日星期三

Linux and aws

what the hell, keep facing the error cannot save text file under gedit in virtual box
so following the procedure here
https://unix.stackexchange.com/questions/52951/gedit-wont-save-a-file-on-a-virtualbox-share-text-file-busy

What fixed it for me (still a bit annoying but works), and is applicable to gedit, is to:
edit - preferences - editor Put a check on "Create backup copy"
When saving from now on, save the file once, ignore the error, save again. works every time.

2019年1月28日星期一

note for using LINUX

haha, first time join a company using Linux, dont even know how to close the file using vi command
just press escape, it will go out of the text and go the last line, then press SHift +semi colon, thenit will appear, then you pressre q +exclamation, then last one, and omost important one, just press enter, then magic will appear.

happy to solve the problem.

also need to take note the OpenFOAM. just type writenow and save file, it will terminate immediately,


iyou can change start now from last time start. then it will start from lasttimestep.


useful vi command
https://www.cs.colostate.edu/helpdocs/vi.html

2018年9月30日星期日

some thought

Recently decided to try CRIMSON installation, after I uninstall Virtural tool box and off the wifi, it start to run, so happy now,

finally run my model in CRIMSON software.


________________________________________________________________________

running OPENFOAM.
here is the good website to record
http://www.cfdyna.com/Home/openFOAM_Win.html

it has some protocol error, i guess it is just adminstrator problem
https://www.cfd-online.com/Forums/openfoam-installation/174281-got-error-while-copying-tutorial-files-local-directory.html
https://stackoverflow.com/questions/17895256/creating-symbolic-link-protocol-error

2017年1月5日星期四

张量tensor的解释

张量tensor的解释
https://www.zhihu.com/question/36814916

小学课本上画杨桃的故事每个人都听过,一个杨桃在不同角度看,就会呈现不同的样子。有些物理量也是一样的,它在不同的角度看就会有不同的数值。比如对于一个矢量,你的基底变化了,矢量的表示也会变化。但是矢量的长度永远不变。
杨桃还是那个杨桃,物理量也还是那个物理量,但是一旦你换了个角度看,杨桃的形状就变了,物理量的数值也就变了。
那么如果一个物理系统没有一个更好的观察方向,或者说我们需要频繁的变换我们的视角的时候,应该怎么把握一个胡乱变化的东西呢?
你要记住,杨桃和物理量本身都是不变的,变的只是它在你眼中的形象。
于是张量就出现了,它将视角变换时候的变换关系作为张量的定义,看似在乱七八糟变,实际上只有满足这样的变换关系,它才是不变的!
研究一个看似乱七八糟变,实际上不变的东西,就是张量分析


作者:大野喵渣
链接:https://www.zhihu.com/question/36814916/answer/69248640
来源:知乎
著作权归作者所有,转载请联系作者获得授权。

2016年6月4日星期六

residual in fluent

This is one of the best questions that anybody has posed in a while. As you've seen, it is sometimes not simple to declare convergence. Something that may help get the residuals down more, is to switch to double precision, and tweaking relaxation parameters may also help. Also, you need to consider the differencing scheme that you are using, and how accurate your initial flow field was. Something that sometimes helps is to get 0.0001 convergence on first order upwind differencing first, and then switch to higher order to see what it does. With external flows, where the initial flow field is normally a very good solution everywhere except near the body, it may also be difficult to get the requisite 0.001 convergence. For other flows 0.001 may not even be good enough. Take a very good look at how your surface integral changes with more iterations, sometimes if you really zoom in (in terms of y-axis scale), you can readily identify a damped oscillation, which is a good indication that you are "straddling" a converged answer. As last resort (or maybe that should be first?), work on your grid quality. If you have a number of skew or very high aspect ratio cells, perhaps away from your surface of interest, it may not affect your surface integral, but could affect the residuals.

from bukit indah to singapore

visit jusco in tebrau
ohor的Bukit Indah离second link不远,属于新山的新区,新区的亮点就是人少,有个AEON购物中心,里面除了诸多商场外,还有一个电影院和超市吉之岛。另外距离AEON 10分钟的脚程,还有TESCO和Giant大卖场。额外突出的好处是Jurong East地铁站可以直接搭Causewaylink CW3 通过second link 直达Bukit Indah。 

just arrive in jurong east mrt, then you take causewaylink CW 3, after passing through 2nd link, you can arrive in bukit indah. then back, you just wait for CW 3 then you can go back  to singapore d . 

2016年5月25日星期三

Residual

The residuals are the error magnitudes for equations as iterations progress. The equations include the governing equations; I.e. the Navier-Stokes momentum equations for each direction (x, y, and z if 3d, or just x and y if 2d), the continuity equation (conservation of mass), and if heat transfer is applicable, the energy equation. The equations may also include equations of the turbulence model defined under models-viscous. The residual is the difference between the previous result and the current result. As these errors are decreasing the equation results are reaching values that are changing less and less. This is what is known as convergence. That is the solutions are converging. If these errors begin to increase, the solution is then said to be diverging. Let me give a simplified example of convergence: Initial value = 2, 1st iteration value = 1.5 (residual value is equal to 2 - 1.5 = .5), 2nd iteration value = 1.2 (residual value = 1.5 - 1.2 = .3), 3rd iteration value = 1.05 (residual value = 1.2 - 1.05 = .15),... 1000th iteration value = 1.00001, and 1001th iteration value = 1.000005 (residual value = .00001 - .000005 = .000005). Perhaps the solution is converging to a value of 1. An opposite trend could be given as an example of divergence. A solution can converge and then diverge or vica versa. Does this help? Is my explanation clear and accurate?

2016年3月9日星期三

Abaqus debuggin

decide to use abaqus for FEM analysis.

so here is the link for compile the fortran.
http://tuoonline.sinaapp.com/?p=131
The whole picture is in fact very simple: subroutine is written in Fortran as *.f files, and ABAQUS need to compile these *.f before using it.  in this case,  the ifort.exe is the compiler. So (1) we need the the access to ifort.exe. Furthermore, this ifort.exe cares a lot about the working condition, he actually have an assistant to build up the working place for him. This assistant is called ifortvars.bat. So (2) we need the access to this ifortvars and(3)make it work!

to do (1) and (2), we need to add the file path of ifort.exe and ifortvars.bat into environment variables (path), so we can access those two at any folder while using command window.
(A)
Search your C:\ for ifort and ifortvars’s path first, record it in a text file. usually the ifortvars is in:
C:\Program Files (x86)\Intel\Composer XE 2013\bin
and the ifort is in:
“C:\Program Files (x86)\Intel\Composer XE 2013\bin\intel64
.
(B)
To setup environment variables:
right click on “computer”
choose properties
choose “advanced system setting” at the left upper area of the current window
click on environment variables at right lower corner of the current window.
Choose variable “path” in the upper frame titled “system variables” and click “edit”
at the end of variable value, add these paths of your “ifort” and “ifortvars” you just found at step (A), for example, mine is:
;C:\Program Files (x86)\Intel\Composer XE 2013\bin;C:\Program Files (x86)\Intel\Composer XE 2013\bin\intel64
Attention: don’t miss the ; at the start of these text and replace my file path with your file path.
(C)
To do (3), we need to add ifortvars.bat into ABAQUS command batch file, so it could setup the environment every time ABAQUS runs.
Open your ABAQUS commands folder, usually at C:\SIMULIA\Abaqus\Commands
right click on abaqus.bat, choose “edit”.
You will probably see this:
@echo off
“C:\SIMULIA\Abaqus\Commands\abq6131.bat” %*

just change it to this:
@echo off
@call ifortvars.bat intel64 vs2012
“C:\SIMULIA\Abaqus\Commands\abq6131.bat” %*
save it.

Remember to change the bold part(intel64 vs2012) accordingly to your system type and software version. For example if you are using visual studio 2010, then vs2012 should bevs2010. I add this note because last time my friend Clay stuck on this tiny part and pissing in the wind checking system variables and fortran compatibility for 10 mins and cried.
Another note: if you run ABAQUS and saw the composer is working, but in the next line it says file or path did not find, please check the quotation marks in the line: “C:\SIMULIA\Abaqus\Commands\abq6131.bat” %* of abaqus.bat is correct, especially after you copied this line from my blog. In this case the quotation marks had been replaced by a kind of quotation marks unrecognizable by windows.
(D)
To verify if it works:
open a command window by type cmd and enter in the start menu.
type:
abaqus verify -all
this command will run a comprehensive test for abaqus, including the standard and explicit with subroutine mode. Just read what’s on screen and perhaps the log file, you will see what your ABAQUS is capable of.

2016年1月23日星期六

SO today practice ANSYS 16.2 crack file.it is kinda headache,
but at the end of days, I realize that actually you do not need to edit the license file. you can just connect it. then it will work itself.
https://johnkaisercalautit.wordpress.com/2013/02/14/how-to-fix-ansys-workbench-flexlm-error/

Step-by-step guide:

1. Run Server ANSLIC_ADMIN utility (as administrator)

2. Click Stop the ANSYS, Inc. License Manager

3. Open command prompt and enter netstat -a. Scroll down and you should find port 1055 in use.

4. From the ADMIN Utility, click Specify the License Server Machine

5. Click Edit Selected Server Machine

6. Change ANSYS FLEXlm port number to any port number other than 1055 (ex. 1056) and click OK

7. Go to the folder \Program Files\ANSYS Inc\Shared Files\Licensing and open license.dat using notepad. Change the port no. to the one you set above and save.

8. From the Server ANSLIC_ADMIN utility, click Install the License File

9. Browse for the edited license.dat file

10. Click Start the ANSYS, Inc. License Manager