Add FemConstraintFluidboundary related Cpp files

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
Post Reply
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Add FemConstraintFluidboundary related Cpp files

Post by qingfeng.xia »

## updated

This FemConstraint is used only by CFD (Computional Fluid Dynamics, FVM is more popular than FEM in this field) solver, OpenFOAM in the first instance, which is not merged yet. But this classes can be tested with FEM solver, bofore the CFD solver is available.

FemConstraint is categoried into 5 types (modelled after commerical CFD tools, CFX) and then many subtypes, to simplify cpp side coding. Only one such cpp class is needed for CFD, instead of >10 classes.

Both cpp and python code are developed in branch `foambuilder_pre2` in April 2016. After failed to rebase it to latest upstream. I decided to merge cpp part which is kind of stable, to reduce my work to manually merge with upstream master in the future. Python side code targeted on Oct to be merged after refactoring.

Instead of commit a big feature, fluidboudnary in cpp and FoamSovler in python, I am only capable of split pull request. I am very poor on git, I have not succeded in git rebase for one year.

###

3D render is not tweaked, it based on ConstraintForce adn ConstraintFixed, with changed color to distinguish different subtype

I can see some warning on EOL, I hope github can solve it.

#warning: LF will be replaced by CRLF in src/Mod/Fem/App/AppFem.cpp.
#The file will have its original line endings in your working directory.

3 commits, tested passed in GUI. Ubuntu 16.04 64bit
fem_constraint_fluid_boundary.png
fem_constraint_fluid_boundary.png (237.87 KiB) Viewed 13600 times
Function can be tested by

Code: Select all

#test macro
App.newDocument("Unnamed")
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
Gui.activateWorkbench("PartWorkbench")
App.ActiveDocument.addObject("Part::Cylinder","Cylinder")
App.ActiveDocument.ActiveObject.Label = "Cylinder"
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
Gui.activateWorkbench("FemWorkbench")
import FemGui
import FemAnalysis
import FemSolverCalculix
FemAnalysis.makeFemAnalysis('Analysis')
FemGui.setActiveAnalysis(App.activeDocument().ActiveObject)
FemSolverCalculix.makeFemSolverCalculix('CalculiX')
FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().ActiveObject]
App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject', 'Cylinder_Mesh')
App.activeDocument().ActiveObject.Shape = App.activeDocument().Cylinder
Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)
Gui.activeDocument().resetEdit()

FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().addObject('Fem::ConstraintFluidBoundary', 'FluidBoundary')]
#
Last edited by qingfeng.xia on Thu Aug 11, 2016 11:08 pm, edited 1 time in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Add FemConstraintFluidboundary related Cpp files

Post by qingfeng.xia »

After code review, some issues fixed:


There are several issues that need to be fixed:
1. Typo in Command.cpp: Create fluid condition condition => Create fluid boundary condition
> Corrected

2. The layout of TaskFemConstraintFluidBoundary.ui is not set properly. At runtime the dialog looks cropped.
> I check TaskFemConstraintForce.ui, to keep size policy constant/identical

3. The dialog has a check box "Reverse direction" and is hidden at runtime and never used. So, why is it there?
> In CFD, inlet and outlet are two distinct types, "Reversed" should be set only by program, not by user. It is useful in rendering.
> I hope to leave it for the time being, if it is not used by other boudnary type in the future, I can remove the checkbox and slot.

4. The valueChanged() signal of spinBoundaryValue is connect to the non-existent slot
`TaskFemConstraintFluidBoundary::onBoundaryValueChanged(double)`
> It is cleaned out before the first commit as it is empty. I will leave it empty for the future extension

5. According to the selected boundary the "Basic" tab is made visible or invisible. When changing to another tab and back it becomes visible again.
> I have corrected this.

6. As test project FemCalculixCantilever3D.FCStd (from the data/examples directory) was used and it hid the Turbulence & Thermal tabs but both were visible again when the dialog was fully up. Instead of showing/hiding the tabs they should be enabled or disabled.

> I agree, it should be disabled now, once CFD solver side change happens, it then will be enabled. The size is updated and it can auto expand with task panel.
> Taskpanel seems to have a min width, 257 pixels?

Once all this is fixed it would be good to describe in a few words how to use this function.

see the first paragraph for this post, updated

> I have not rebase master, as I will run into trouble. As it is mergable, I hope it is acceptable behind the master. Also fix cpp coding {} format

> Thanks
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Add FemConstraintFluidboundary related Cpp files

Post by wmayer »

Merged.
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Add FemConstraintFluidboundary related Cpp files

Post by RatonLaveur »

Dear friends, I take the liberty of forking this current conversation https://forum.freecadweb.org/viewtopic. ... 73#p407573 here.

It seems that the FemConstraintFluidBoundary is now out-of-place in the FEM WB, since Qing Feng aptly forked into the OpenFOAM specific Cfd WB.
Since FEM has now the CFD capabilities of Elmer and uses other types of constraints (FemConstraintFlowVelocity), would it be out of place to kindly ask if we could remove FemConstraintFluidBoundary for the sake of clarity/cleanliness?
qingfeng.xia wrote: Thu Aug 11, 2016 11:08 pm ping
I hope you do not mind the ping or the request
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Add FemConstraintFluidboundary related Cpp files

Post by bernd »

IMHO we should temporary deactivate the Gui command. The object can still be added by Python. This way we keep all object implementation ATM.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Add FemConstraintFluidboundary related Cpp files

Post by bernd »

RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Add FemConstraintFluidboundary related Cpp files

Post by RatonLaveur »

Note that the dropdown menu Model --> Fluid Constraints --> ...also has the command there in the middle. Probably a good idea to suppress it.
By the way I'm 100% on board with suppressing the command, not deleting it. (I.e. still accessible by command line or backend).
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Add FemConstraintFluidboundary related Cpp files

Post by bernd »

Post Reply