Author Topic: Neumann boundary condition  (Read 1162 times)

aditya

  • Newbie
  • *
  • Posts: 17
Neumann boundary condition
« on: January 05, 2017, 03:34:16 PM »
Hello All

A Very Happy New Year .....

I am trying to make a Neumann boundary condition for Fluid. (Nothing fancy just adding a value to the right hand side). But having some question and confusions regarding the newly introduced processes.


I added a new variable to the FluidDynamics application called FORCE and I want to assign a value to the force and then add it on to the RHS.


Question 1 :


Should and can I do it via the processes ?


Question 2 :


If I can do it via processes  how should the process know that it has to add the FORCE on the RHS of the equation system ?? The same is also not clear with the POINT_LOAD in structural mechanics application. the function ApplyScalarOnConditionsProcess is used here, but there the value of the force is set to the condition and does not specify if it goes on to RHS or LHS of the system being built.


Question 3:


I see that the function CalculateLocalSystem is still executed from the condition when each time the system is built. But Is this function really executed. Because, I make a condition and used it in MDPA file (I see that this condition is being used from the output), but the function CalculateLocalSystem  is never executed. Is this true ?


Question 4:


Which is the preferable way to do this Neumann condition.

Thank you.

riccardo

  • Global Moderator
  • Newbie
  • *****
  • Posts: 47
Re: Neumann boundary condition
« Reply #1 on: January 05, 2017, 05:08:39 PM »
Hi Aditya,

happy new year to you too.

first of all, i believe that the variable FORCE is already defined in the core, so please ensure to use that instead of defining a new one.

if you want to use this variable to describe a "surface traction" than i assume it expresses a distributed loading.
The only mechanism to add a contribution of this type to the RHS is by defining a condition that does the surface integration and contributes it to the RHS, so that it is assembled during the build process. Such condition is definitely executed as long as it is part of the model_part for which you are doing the Build...
Such condition will read the nodal values and perform the surface integral.

in order to answer to your questions, i would need to understand how you want to choose the actual values. If it is for FSI then i guess the mapper will alread assign the nodal values you wish to use. Is that not so?

Ruben is also doing (or planning to do) something very similar, so i guess you'll want to sync on this. Ruben? commentS?

aditya

  • Newbie
  • *
  • Posts: 17
Re: Neumann boundary condition
« Reply #2 on: January 05, 2017, 05:59:47 PM »
I do not want a distributed load. But something similar to point load.

I have a condition that has  CalculateLocalSystem function and what it does is returns a RHS vector with the point load (similar).

Quote
Such condition is definitely executed as long as it is part of the model_part for which you are doing the Build..

I am not sure ... here I attach the terminal output

Code: [Select]
variables for the vms fluid solver added correctly
::[Mechanical Solver]:: Variables ADDED
  [Reading Nodes    : 3806 nodes read]
  [Reading Elements : 7096 elements read] [Type: Element2D3N]
  [Reading Conditions : 8 conditions read] [Type: WallCondition2D2N]
  [Reading Conditions : 8 conditions read] [Type: WallCondition2D2N]
  [Reading Conditions : 100 conditions read] [Type: WallCondition2D2N]
  [Reading Conditions : 190 conditions read] [Type: PointForce2Dfluid]
  [Reading Conditions : 210 conditions read] [Type: WallCondition2D2N]
  [Total Lines Read : 23442]
mSettings.PrettyPrintJsonString() : {
    "element_name": "VMS2D3N",
    "condition_name": "MonolithicWallCondition2D"
}
########################### Total number of condition :: 516

Here we can see that the new condition I defined PointForce2Dfluid is read and in a different output I can see its constructor is called. So this condition is "made". But I see that the function CalculateLocalSystem from this condition is not called as I do not see any output(I print something) from this function.

What I do not understand is in the file navier_stokes_solver_vmsmonolithic.py .. there is this code.. (Yes I am using a Monolithic solver)

Code: [Select]
#here we replace the dummy elements we read with proper elements
            self.settings.AddEmptyValue("element_replace_settings")
            if(self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3):
                self.settings["element_replace_settings"] = KratosMultiphysics.Parameters("""
                    {
                    "element_name":"VMS3D4N",
                    "condition_name": "MonolithicWallCondition3D"
                    }
                    """)
            elif(self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2):
                self.settings["element_replace_settings"] = KratosMultiphysics.Parameters("""
                    {
                    "element_name":"VMS2D3N",
                    "condition_name": "MonolithicWallCondition2D"
                    }
                    """)
            else:
                raise Exception("domain size is not 2 or 3")
           
            KratosMultiphysics.ReplaceElementsAndConditionsProcess(self.main_model_part, self.settings["element_replace_settings"]).Execute()
(I see similar substitution code in the fractional step solver too)
Is it not substituting all the conditions with MonolithicWallCondition2D   ... ?? And I checked the implementation in MonolithicWallCondition2D it is basically returning zero matrices and vector for LHS and RHS respectively. The point here is ... though a custom condition like the one I have is made(instantiated) it is being replace with this MonolithicWallCondition2D which does nothing .... ?? Am I correct ??



Quote
in order to answer to your questions, i would need to understand how you want to choose the actual values. If it is for FSI then i guess the mapper will alread assign the nodal values you wish to use. Is that not so?

The variable FORCE is set I sometimes do it by myself or sometimes from a mapper. But at the end ... yes the nodal value of FORCE is assigned at some point.

About
Quote
first of all, i believe that the variable FORCE is already defined in the core, so please ensure to use that instead of defining a new one.
Yes I see it is defined. I will remove the I added and use the one from the core.


rzorrilla

  • Newbie
  • *
  • Posts: 5
Re: Neumann boundary condition
« Reply #3 on: January 10, 2017, 11:40:42 AM »
Hi Aditya,

As Riccardo said, I did it once but at the moment there is no fluid point load condition in the fluid app. As far as I can understand, your problem is that the ReplaceElementsAndConditionsProcess substitutes the PointLoad condition that you have defined in the *.mdpa, am I right?

In any case, you can have a look to the partitioned solver present in the FSIApp (partitioned_fsi_solver.py). It has a method called _SetFluidNeumannCondition that can do your thing.

    def _SetFluidNeumannCondition(self):

        fluid_computational_volume_submodelpart = self.fluid_solver.GetComputingModelPart()

        for cond in self.fluid_solver.main_model_part.Conditions:
            if(cond.Id > aux_count):
                aux_count = cond.Id
        aux_count += 1

        for i in range(self.settings["coupling_solver_settings"]["fluid_interfaces_list"].size()):
            interface_submodelpart_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"].GetString()
            interface_submodelpart_i = self.fluid_solver.main_model_part.GetSubModelPart(interface_submodelpart_name)

            for node in interface_submodelpart_i.Nodes:
                if self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2:
                    fluid_computational_volume_submodelpart.CreateNewCondition("PointForce2Dfluid",aux_count,[node.Id],self.fluid_solver.main_model_part.Properties[0])
                elif self.structure_solver.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3:
                    fluid_computational_volume_submodelpart.CreateNewCondition("PointForce3Dfluid",aux_count,[node.Id],self.fluid_solver.main_model_part.Properties[0])

                aux_count+=1

As you can see this method creates a PointLoadCondition for each node of the interface, which is defined as a submodelpart of the fluid model part.

I hope this helps. Regards,


Rubén.

aditya

  • Newbie
  • *
  • Posts: 17
Re: Neumann boundary condition
« Reply #4 on: January 12, 2017, 05:12:53 PM »
Hello Ruben

Yes that works. Thank you very much. But before it worked, I had to some modifications to the mdpa file. !!