[Help] FEM transient analysis

About the development of the FEM module/workbench.

Moderator: bernd

dinodano
Posts: 11
Joined: Mon Jun 06, 2022 5:42 am

[Help] FEM transient analysis

Post by dinodano »

Hello,

I just started learning FreeCAD and sorry in advance if the problems I need help addressing is very trivial or have been answered before. :D

I am trying to do a thermo mechanical transient analysis on a simple model. I have set the thermo mechanical steady state to false with time end and time initial step 60 and 1 respectively. I would like to ask why are the CCX time results in weird intervals (1,2,3.5,5.75,etc) instead of (1,2,3,4,etc). Am I understanding the time initial step function incorrectly?

Also, is there a way to plot a graph with the CCX time results produced with Displacement against Temperature (and compiling all the CCX time results)?

Lastly, with regards to the temperature constraints, I would like to input a fluctuating temperature to the model. For example, a sin curve ranging from 290K to 300K with 295K as the initial temperature. I would like to see the model expand when it goes from 295K to 300K and contract from 295K to 290K, if possible. Sort of like a dynamic thermal expansion. Would I have to write inp file, elmer or play around with the python console?

Sorry again that I am lacking in understanding on FEM as I am very new to 3D modelling and FEM. Instructional videos would help greatly! Thank you.


OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 +148 (Git)
Build type: Release
Branch: Branch_0.19.4
Hash: 476ecf091941bead59b14e44afa6064d5a66afa3
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/Singapore (en_SG)
Attachments
trial3_transient.FCStd
(975.72 KiB) Downloaded 6 times
NewJoker
Veteran
Posts: 1327
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Help] FEM transient analysis

Post by NewJoker »

dinodano wrote: Mon Jun 06, 2022 6:19 am I would like to ask why are the CCX time results in weird intervals (1,2,3.5,5.75,etc) instead of (1,2,3,4,etc). Am I understanding the time initial step function incorrectly?
Initial time step is just what the solve (CalculiX) uses to start calculations. Then it can automatically adjust the increment size based on convergence. You can control the frequency with which the results are saved but you would have to export the input file, modify it manually using CalculiX's keyword syntax, run the simulation with standalone CalculiX solver and then open the .frd file in FreeCAD to visualize the results.

dinodano wrote: Mon Jun 06, 2022 6:19 am Also, is there a way to plot a graph with the CCX time results produced with Displacement against Temperature (and compiling all the CCX time results)?
For this you will need more advanced postprocessing tools. You can convert the .frd file to .vtk and do the postprocessing in ParaView which is also open-source.

dinodano wrote: Mon Jun 06, 2022 6:19 am I would like to input a fluctuating temperature to the model.
In CalculiX this is done using amplitudes. They can't be defined in FreeCAD so again you would have to export the input file and modify it manually.

Check CalculiX's documentation for details regarding keyword syntax: http://www.dhondt.de/ccx_2.19.pdf
dinodano
Posts: 11
Joined: Mon Jun 06, 2022 5:42 am

Re: [Help] FEM transient analysis

Post by dinodano »

NewJoker wrote: Mon Jun 06, 2022 7:50 am For this you will need more advanced postprocessing tools. You can convert the .frd file to .vtk and do the postprocessing in ParaView which is also open-source.
May I ask how do I convert the file to .vtk for postprocessing? I tried using this macro to export: https://www.youtube.com/watch?v=_DdT7Wxk4yw , but I keep getting this error "Error in Selection: Select a correct Mechanical AnalysisError" .
NewJoker wrote: Mon Jun 06, 2022 7:50 am In CalculiX this is done using amplitudes. They can't be defined in FreeCAD so again you would have to export the input file and modify it manually.

Check CalculiX's documentation for details regarding keyword syntax: http://www.dhondt.de/ccx_2.19.pdf
Thank you for sending the documentation, it is quite helpful. If possible, I would like to ask if you have any example videos of the input file being modified? It would help me greatly, thank you.
NewJoker
Veteran
Posts: 1327
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Help] FEM transient analysis

Post by NewJoker »

dinodano wrote: Mon Jun 13, 2022 7:52 am May I ask how do I convert the file to .vtk for postprocessing?
There's no single best way to do this but I use these three approaches:
- importing the .frd file to FreeCAD and exporting it .vtk (but it may not work for procedures not yet supported in FreeCAD)
- this converter: https://github.com/calculix/ccx2paraview
- and this one: https://forum.freecadweb.org/viewtopic.php?t=11664 (you have to send a request to the owner of that Google Drive to download the files)

dinodano wrote: Mon Jun 13, 2022 7:52 am If possible, I would like to ask if you have any example videos of the input file being modified?
Not really but CalculiX's keywords are very intuitive and the documentation describes their syntax in detail (chapter 7. Input deck format). In this particular case, check the documentation section for *Amplitude keyword (it's first in the list). Apart from the text describing available parameters and their possible values, the most relevant part is the one at the bottom where necessary data lines are shown and the example is provided.

Here the syntax is simply:

Code: Select all

*Amplitude, name=amplitude_name
t_1, A_1, t_2, A_2, t_3, A_3, ..., t_n, A_n
where t_n means time point n and A_n means amplitude value at this time point.

After defining the amplitude you just have to use it in boundary condition or load definition. For example:

Code: Select all

*Boundary, amplitude=amplitude_name
n_set, 11, 11, temperature_value
Just keep in mind that amplitude values are multiplied by magnitudes specified in BC/load definition. So it's usually best to specify 1 as temperature_value and define temperature magnitudes directly in amplitude.
dinodano
Posts: 11
Joined: Mon Jun 06, 2022 5:42 am

Re: [Help] FEM transient analysis

Post by dinodano »

Hi, I don't think I am understanding the syntax of Calculix correctly. I appreciate all the help I can get :D

I am trying to simulate a simple model undergoing length changes with fluctuating temperature. I've set the initial conditions to 300K and the thermo mechanical steady state as false with time end and time initial step 60 and 0.01 respectively. The amplitude and boundary defined in the inp file I edited are as follows:

*AMPLITUDE, NAME=A1
0.,350.,5.,250.,10.,350.,15.,250.,20.,350.,25.,250.,30.,350.,35.,250.,40.,350.,45.,250.,50.,350

*BOUNDARY, AMPLITUDE=A1
Nall,11,11,100

What I had hoped to have seen is the model decreasing the length at 5s due to temperature at 250K and increasing in length in 10s due to temperature at 350K. I have also

I have attached the necessary files. Please do advise, thank you so much.

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 +148 (Git)
Build type: Release
Branch: Branch_0.19.4
Hash: 476ecf091941bead59b14e44afa6064d5a66afa3
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/Singapore (en_SG)
Attachments
trial5_edit.FCStd
(907.41 KiB) Downloaded 4 times
trial5.txt
(21.25 KiB) Downloaded 5 times
NewJoker
Veteran
Posts: 1327
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Help] FEM transient analysis

Post by NewJoker »

You just have to move part of the amplitude definition to next data line and it will work. There's a limit of entries in a single data line but you can always use multiple data lines in such cases.
dinodano
Posts: 11
Joined: Mon Jun 06, 2022 5:42 am

Re: [Help] FEM transient analysis

Post by dinodano »

NewJoker wrote: Mon Jun 27, 2022 8:15 am You just have to move part of the amplitude definition to next data line and it will work. There's a limit of entries in a single data line but you can always use multiple data lines in such cases.
I tried giving each amplitude definition their own line but it does not seem to work.
The temperature does not seem to change from their initial temperature of 300K
trial5.jpg
trial5.jpg (71.49 KiB) Viewed 481 times
trial5.txt
(21.3 KiB) Downloaded 8 times
I also changed the temperature amplitudes to increasing values from 300K to 350K for a simpler result, but the temperature still does not seem to change.

Please advise. Thank you.
Attachments
trial5_edit.FCStd
(907.54 KiB) Downloaded 3 times
NewJoker
Veteran
Posts: 1327
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Help] FEM transient analysis

Post by NewJoker »

How do you run this analysis - using CalculiX executable ? And then you open the .frd file in FreeCAD ? When I run the attached input file and post-process it in GraphiX (CalculiX's native pre- and postprocessor), the temperatures at the end of the analysis are uniform (because you applied a temperature BC to all nodes) but not equal to the initial temperature. However, I've noticed that you use the amplitude incorrectly - if its definition uses temperatures and not multipliers, then the magnitude specified under *Boundary keyword must be equal to 1. In your case, it's 100 so values in the amplitude definition are multiplied by 100 and you have a temperature of e.g. 350*100 = 35000 K.
dinodano
Posts: 11
Joined: Mon Jun 06, 2022 5:42 am

Re: [Help] FEM transient analysis

Post by dinodano »

NewJoker wrote: Mon Jun 27, 2022 8:27 pm How do you run this analysis - using CalculiX executable ? And then you open the .frd file in FreeCAD ?
I set thermo mech steady state as false, click on SolverCcxTools, select thermomechanical, select write .inp file, select edit .inp file, make changes on the editor, select Run Calculix.
Should I be exporting and importing the inp file with SolverCcxTools selected? I am not sure on how to go about it and which file format and editing, my apologies, very new to FreeCAD and FEM.
NewJoker wrote: Mon Jun 27, 2022 8:27 pm In your case, it's 100 so values in the amplitude definition are multiplied by 100 and you have a temperature of e.g. 350*100 = 35000 K.
Oh, understood. Thank you so much for explaining and spotting my error.
NewJoker
Veteran
Posts: 1327
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Help] FEM transient analysis

Post by NewJoker »

dinodano wrote: Wed Jun 29, 2022 8:36 am select edit .inp file, make changes on the editor, select Run Calculix.
This approach may not work properly here. Instead of this step, you can go to the directory where the input file is saved (its address is displayed as Working directory), open it with any text editor (I suggest Notepad++ since Windows Notepad is not convenient for .inp file editing), make the necessary changes, save the file and run it using CalculiX executable. It can be downloaded from here: http://www.dhondt.de/calculix_2.19_4win.zip and you just have to place the ccx_static.exe file in the same folder as your input file, open the command line (type cmd in the address bar of Windows File Explorer) then type ccx_static input_file_name and hit Enter. This will start the calculations and as a result, you will get several files, including the one with frd extension. You can open it in FreeCAD, use CalculiX's native postprocessor - GraphiX (the best option, described below) or convert the frd file to vtk so that you can open it in ParaView.

To use GraphiX for postprocessing, you have to place the cxg_GLUT and glut64.dll files in the same directory as your input file and type cgx_GLUT frd_file_name.frd in the command line.
Post Reply