Need help writing .wbjn remesh script file
Hi guys, yet another student here trying to setup a basic flow simulation for an IC engine. I am doing this simulation using Ansys 13 and the default CFX fluid flow analysis template.
I've made it most of the way through the setup now and have run basic simulations to check the mesh motion and deformation is all working correctly. As expected, part way through the simulation, the mesh quality becomes an issue due to the large deformations involved. I'm now trying to setup the user-defined remeshing. I have the interrupt control set to interrupt at a specific time (t>=0.0014s) and I have a mesh file already setup to suit the position of the geometry at that point. It all seems pretty straight forward but where I'm stuck is the "External Command" section in the "Remeshing" tab. This section requires that I write a".wbjn remesh script". I have very little experience when it comes to writing code and no experience with Fortran or anything along those lines. Therefore, I don't even have a basic understanding of how to do this. I have gone through all the tutorials, help files and also searched these forums but there is a bit of a void of information in this area. There are tutorials on how to setup remeshing but they only go into detail for using the auto remeshing (with an ICEM mesh replay file). I'll save you the details of why I don't want to do it that way. I am confident I have everything setup correctly and only need help with this "External Command" section. If anyone could please give me a basic example of how to write this script file, it would be very much appreciated. I don't even know what a wbjn file is so I'm not even sure if this is something I should be writing in part of Ansys or if I need to use an external program. I'm aware that the file paths and such details will be different but I can figure that part out easily enough. The only info I have to go off so far is what's stated in the help files: Quote:
|
Using workbench remeshing will waste a lot of time, because open and update workbench is very slow. My English is too poor to help you,if you can speak chinese,you can watch this:
http://blog.sina.com.cn/s/blog_90affd98010112d7.html |
While it does not answer your question this looks like a good post to plug my PhD thesis from long ago: http://hdl.handle.net/2100/248
I have no experience in remeshing with CFX so cannot help your question. But hopefully my thesis is a useful reference and might be able to help you.... and you can always ask the author if you don't understand something, you don't get that with many books :) |
Thanks for the replies. I really need to use the user-defined remeshing so I can have the valves coming to a complete close. Trying to do an auto remesh like that would cause problems, I believe. I also have no experience with ICEM and don't really have enough time left to figure it out before my thesis is due.
Anyway, I made a little progress. I figured out what the .wbjn file is. For future reference: The .wbjn file required in the external command just refers to a journal file that you make in Workbench itself. Just go to File>Scripting>Record Journal and save it whereever. The journal is then recording every action you make in Workbench until you go back and click "Stop Recording Journal". So once you've started the recording, go and load the new geometry file that you wish to use for the remesh, update the remesh and if required, open the meshing program and make adjustments to suit the new geometry position. Once everything is updated,stop the journal recording and the file is saved. Then you can enter the location of the journal file in the external command section (as it is explained in my quote from the help section above). Also, make sure you use the quotation marks around the path to the .bat file that opens Workbench (exactly as it is written in the help file I quoted). This is important because there's a space in the file name "Ansys Inc" so if you don't use quotes, it tries to find a file just named "Ansys" and the remesh fails. Ok, so where I'm stuck now is that I only know how to get it to remesh once and choose one file. I need it to remesh multiple times throughout the simulation, meaning the remesh script needs to find out what point in time the simulation is at and use that info to decide which geometry file to load. Below is my current journal file that can successfully run the first remesh. Can anyone help me with adding the code required to tell it how to select the correct geometry file for each remesh, based on the current simulation time? The simulation needs to remesh at t=0.0028[s] and t=0.004[s]. The names of the geometry files follow the same convention as the file seen in the script below (Geometry_t=0.0028.agdb and Geometry_t=0.004.agdb) Quote:
|
Hey Rallyeee
This is a problem i've been trying to deal with for a while. By the looks of it you found the tutorial on how to perform an workbench remesh but have are confused at the same point everyone else is, during the script phase. By the sounds of it, you already have all your meshes made. If that is the case, and i'm not 100% sure on this, I do not believe you need to perform all the same steps as in the workbench remesh tutorial. My understanding is that the point of the "remesh" configuration and how the tutorial works, is it allows you to have workbench create a new mesh based of the latest output of the solver. In essence, in your .wbjn script, you can write it to send the output geometry to workbench, open workbench and read the new geometry then remesh the solution based of the new geometry. I dont think this is what you are really trying to do so you should not have to go through this step. With that being said, I have not figured out how to input a different mesh without using this type of method. If you have found a way for it to apply a new mesh during a single time, then to do it multiple times my simple solution would be to create a new stop criteria and configuration for each stop criteria. Then you could simply point the remesh configuration for each stop to a specified mesh file. How I have solved the .wbjn issue myself in my simulations is to skip the .wbjn step and instead direct the solver to just open my workbench file. From there, instead of having the .wbjn file create my new mesh, i simply do it manually. Once i finish, i just save my file and close workbench and once workbench is closed, the solver reads the new mesh, interpolates the results and continues. It is not the most efficient as it requires you to watch the simulation and manually update things however it gets the job done. If this interests you then feel free to post here again or pm me and i can explain this further. |
Hi Doginal, thanks for the reply. I think I've already started doing what you mentioned, I'm setting it up to run multiple configs and it has a separate script file for each config. So it can just do one remesh each config and I don't have to figure out any fancy coding.
It's not the most computationally efficient way but it's the most efficient in terms of my time. I'm interested to hear how you do each step manually. If I knew I could do it that way, I would have long ago. I don't mind if I need to come back to the computer every time it needs a remesh. Do I literally just leave the wbjn file out of the external command section? |
You dont quite leave off the .wbjn script
The way the code is in the tutorial for the external command External Command: "C:\Program Files\ANSYS Inc\v130\Framework\bin\Win64\runwb2.bat" -B -R C:\<Path To Remesh Script>\WB_Remesh.wbjn. the -B represent, run workbench in batch mode. Batch mode simply means it runs workbench without opening any of the GUI so you dont see it happening. the -R tells it to run a script once workbench has opened (in this case in batch mode) Instead of just deleting that part replace the -B and -R with -F and replace the path to the .wbjn file to your workbench file (.wbpj). -F means to open workbench like normal so it will open your workbench file for you to use. manipulate your geometry and generate your mesh. The geometry manipulation can be simplified by monitoring some point in the solver that tracks any motion and using a parameter in your geometry. This will allow you to edit the geometry without actually opening your geom file. Also i should note, when i do this, i open and run cfx.pre and cfx.solver as standalone application and my workbench contains only the geometry and mesh. To summarize Mesh file is same as tutorial External Command: "C:\Program Files\ANSYS Inc\v130\Framework\bin\Win64\runwb2.bat" -F C:\<Path To Remesh Script>\WB_Remesh.wbpj. Hope this helps and let me know if you have any other questions DM |
Maybe this will help you, read it carefully.
# encoding: utf-8 SetScriptVersion(Version="13.0") Open(FilePath="C:/Documents and Settings/jian.liu/Desktop/workbench-remesh/1.wbpj") system1 = GetSystem(Name="Post") results1 = system1.GetContainer(ComponentName="Results") results1.Edit() results1.SendCommand(Command=r"""DATA READER: Clear All Objects = false Append Results = true Edit Case Names = false Open to Compare = false Multi Configuration File Load Option = Last Case Open in New View = true Keep Camera Position = true Load Particle Tracks = true Files to Compare = END DATA READER: Domains to Load= END > load filename=C:\Documents and Settings\jian.liu\Desktop\workbench-remesh\Unnamed_001.dir\res, multifile=append""") results1.SendCommand(Command="""VIEW:View 1 Camera Mode = User Specified CAMERA: Option = Pivot Point and Quaternion Pivot Point = 1.3113e-006, 0, 0.005 Scale = 0.741036 Pan = 0, 0 Rotation Quaternion = 0.279848, -0.364705, -0.115917, 0.880476 END END EXPRESSION EVALUATOR: Evaluated Expression = Angle END > forceupdate EXPRESSION EVALUATOR""") results1.Exit() designPoint1 = Parameters.GetDesignPoint(Name="0") parameter1 = Parameters.GetParameter(Name="P1") designPoint1.SetParameterExpression( Parameter=parameter1, Expression="P2") system2 = GetSystem(Name="SYS") component1 = system2.GetComponent(Name="Mesh") component1.Update(AllDependencies=True) Save( FilePath="C:/Documents and Settings/jian.liu/Desktop/workbench-remesh/1.wbpj", Overwrite=True) |
Thanks for the help guys, I'll have to mess around some more and see how I go. I'm trying to run this all off a laptop so the sims take a while. I'll no doubt be back with more questions.
|
Hi everone. I thought I'd end the confusion about the script file used in EDR's tutorial. The missing wbjn script from http://www.edr.no/blogg/ansys_blogge...nch_cfx_remesh contains the following code:
Code:
import os |
Hi everybody!
I'm trying to do something like this http://blog.sina.com.cn/s/blog_90affd98010112d7.html but I have to remesh a fluid domain with a solid cylinder rotating in it. I would like to know wich geometrical parameter I should set to create the new mesh! Can somebody help me? Thanks a lot! |
Hi guys, I'm still slowly picking away at this. I have run many simulations and remeshed many times but have not completed an entire run successfully yet. The main issue is that there are constant license server problems with my University's server. I'm wondering if it's possible to restart a run after it has failed. I have to remesh many times in one simulation and I can never get through them all without the license server dropping out during one of them and causing the solution to fail. Is there any way to process the results files that are left over and start from that point? Or once a solution fails, is the only option to start again from scratch?
|
That sounds like a really hopeless setup. You have to give the IT guys a kick as that is pathetic if they cannot even run a half reasonable licenses server..... I mean - how hard is it? It is just a computer which sits there and does nothing much.
End of soapbox. If you have an unreliable system then all you can do is write frequent full transient results files. Then you can restart from the most recent full results file. But keep a record of how much time you are wasting with this and show it to your professor/supervisor. |
replacement file
I am also having problem with the remeshing. I follow your script, and I successfully start the remeshing script.
But the problem is, ANSYS just replaced the old mesh with exactly the same mesh. So I guess I am wroing in setting the replacement file. Does anyone know which file to put in that blank? Thanks so much!!! |
@Frank0079: Remeshing using Workbench allows both translational and rotational motions whereas ICEM handles only translation.
@Rallyee: Set license preference to use one license for each application instead of sharing. For future runs that crash and generate a result file, you can initialise the run with the res file in order to continue the run. If done correctly, your monitor plot will continue from where it left off. When post-processing, load results as complete history. @ocb00999:refer to the mesh file located in the project dp0 subfolder, e.g. C:\Run\Run_files\dp0\global\MECH\SYS.mshdb. The other thing is to make sure that the name of your data monitors are the same as the parameters in Workbench. @dclaudia85: you might be better off rotating the cylinder and interface it with the outer fluid domain using GGI. |
hello everybody,
i have a problem with remeshing too. i use ansys 14 to simulate a butterfly valve (rotating around an axis) by using the rigid body solver. due to the motion of the butterfly valve (rigid body) the mesh is deformed in a such way making it impossible to get meaningful results. i somehow need to extract the geometry out of the current results. what i tried to do, is what Doginal suggested. remeshing without a script but doing it manually. Quote:
does anybody know, how to extract the current geometry while the solver is paused?:confused::confused::confused::confused: i would be very thankful for any kind of help! (if i would know an angular velocity of 1 degree*s^-1 for example, i could stop after one second set the new angle, create the new mesh and go on) |
Hi,
I am facing similar problems. I need to remesh using user defined functions and I am not expert in coding area. My question is related to the post quoted below, Can we have icem cfd mesh using user defined re meshing setting? I have tried icem reply and it only gave transnational motion. Can you please give some guidelines in resolving this issue. (http://www.cfd-online.com/Forums/cfx...sh-motion.html) Quote:
|
1 Attachment(s)
External Command: "C:\Program Files\ANSYS Inc\v130\Framework\bin\Win64\runwb2.bat" -B -R C:\<Path To Remesh Script>\WB_Remesh.wbjn.
Hi, I am trying to do similar problem like the sample tutorial of EDR Blogg with workbench remeshing, but just before remeshing it ended giving a error(attached) indicating there is no batch file exist. Can anyone please help me? |
Check the location of your rubwb2.bat, e.g. is your ANSYS v130, 32 or 64 bit?
Quote:
|
Quote:
I would also avoid spaces in the path... |
Pls answer me
I know this is the one, which is used to execute script for Fluent..
But at end of execution, it shut down the fluent software. I need to display fluent.. So can u pls help me for this? "C:\Program Files\ANSYS Inc\v150\Framework\bin\Win64\runwb2.bat" -B -R C:\Users\admin\Desktop\newWbjn.wbpj.. |
Please guide.
Quote:
i know this reply is little older but can you please tell me how to load the latest geometry for remeshing in workbench. do i have to redraw the geometry or is there any way i can load the latest geometry from the cfx results files. i am simulating vortex induced vibrations of cylinders in cfx rigid body solver. please reply. |
Problem with Remeshing
Hi everybody. I'm doing my first moving mesh and remeshing simulation on a check valve but I have a problem that I'm not able to solve.
I set the transient simulation in order to have a moving mesh. It runs for a while but at a certain point the displacements are too big and the simulation fails. So I started to work on remeshing. However I don't have ICEM (because of license purchasing issue) and i don't know how to generate the new geometry, when the displacements of the original mesh become too big, in order to make a new mesh on it. Can anyone please help me? Thanks a lot! |
|
from gambit to ansys
Is it possible to import external geometry file in ansys workbench from gambit to remesh it?
help plz:confused::confused::confused: |
Aren't you able to export the geometry in Gambit through Iges, STEP or parasolid?
Alternatively, you can import the fluent mesh in ICEM, delete all volume elements and build a new mesh from the remaining surface elements. |
All times are GMT -4. The time now is 21:19. |