BFE load in coupled field simulation

Hello I try to apply a moving heat source in a transient structural simulation via coupled field elements.

Element definition:

et,matid,226

keyopt,matid,1,11

keyopt,matid,2,1

keyopt,matid,6,1

keyopt,matid,9,1


Heat source code:

CMSEL,ALL

*GET,EMAX,ELEM,,NUM,MAX     !Retrieves a value and stores it as a scalar parameter or part of an array parameter. Name of Parameter = EMAX, Entity=Element,

*GET,EMIN,ELEM,,NUM,MIN     !Retrieves a value and stores it as a scalar parameter or part of an array parameter. Name of Parameter = EMAX, Entity=Element

ALLSEL

 

Q3=3e4

r0=0.01

Zi=-0.0025

VEL=0.001  

TAU=0

PI=ACOS(-1)

 

time_weld=2                      ! welding time

time_inc=1                        !

time_steps=time_weld/time_inc      

NROPT, FULL                       !NROPT= Specifies the Newton-Raphson options in a static or full transient analysis.Use full Newton-Raphson.

 

*DO,i,1,time_steps,1              !TIME INCREMENT

WTIME=(i*time_inc)

TIME,WTIME

HCENTER=VEL*WTIME

 

*DO,jj,EMIN,EMAX,1                 !SELECTS THE CENTROID OF EVERY ELEMENT

X=CENTRX(jj)                       !Centroid X-coordinate of jj-th element in global Cartesian coordinate system.Centroid is determined from the selected nodes on the element.

Y=CENTRY(jj)                       !Centroid Y-coordinate of jj-th element in global Cartesian coordinate system.Centroid is determined from the selected nodes on the element.

Z=CENTRZ(jj) 

CSI=Y+(VEL*(TAU-WTIME))

 

r=sqrt(X**2+CSI**2)

 

*IF,Z,LT,Zi,THEN

qfsw=0

*ELSEIF,r,GT,r0

qfsw=0

*ELSE

qfsw=(3*Q3*r)/(2*PI*r0**3)

*ENDIF

 

BFE,jj,HGEN,,qfsw                           ! Defines an element body force load.BFE, Elem, Lab, STLOC, VAL1, VAL2, VAL3, VAL4

*ENDDO

SOLVE

*ENDDO

 

CMSEL,ALL                                 ! Selects a subset of components and assemblies

BFEDELE,ALL,ALL                           ! Deletes element body force loads.BFEDELE, ELEM, Lab

ALLSEL 

The BFE is not applied and I don’t know why. Is the coupled field element 226 not valid for BFE HGEN load? The APDL loop is valid and is running well in transient thermal module. I get some error warning.

Error:

*** WARNING ***                         CP =       1.406   TIME= 11:52:52
 The specified heat generations from the BFE command can not be applied 
 because element 2401 is undefined.  


Best Answer

  • BenjaminStarlingBenjaminStarling AustraliaPosts: 101Member
    edited December 2020 Accepted Answer

    It is not clear to me which part you are struggling with? This method just replaces the loop you already have with the jj variable.

    Is it the use of components? this method checks each element within a component only once. Therefore if you need to loop through all elements more than once, you will need to reset the component selection at some point. i.e. between your *do loop with i, and your *do loop with jj, reselect the master set of elements you wish to apply the load to either through esel, or cmsel. This is one of the reasons a temporary component is created for looping, such that the original master component remains unaltered.

    Another issue may be the lack of ALLSEL command. I forgot to put it in my example, but as we are selecting and deselecting elements, you need to ensure all elements and nodes that you would like to participate in the solve, are selected before issuing the solve command.

    If you have any more info/code, or a model to share, feel free, it will give me a better idea of what the issue is.

Answers

  • akhemkaakhemka Posts: 719Forum Coordinator

    Hi @ANSYS_FEM_Guy ,


    The warning indicates that there is no 2401 element defined. Can you please look for this element number in your model?


    Regards,

    Ashish Khemka

  • ANSYS_FEM_GuyANSYS_FEM_Guy Posts: 16Member
    edited December 2020

    Hi Ashish,

    thank you for your answer. I checked the model, there is no element with the number 2401. The model only consists of 2400 elements.

    I don't know why it's not working, because when I run the code in transient thermal, it's working like intended.


    Best regards

    Sam Donell

  • rkumbharrkumbhar PunePosts: 188Forum Coordinator

    Hi @ANSYS_FEM_Guy try using value EMAX-1 in the *DO loop

  • ANSYS_FEM_GuyANSYS_FEM_Guy Posts: 16Member
    edited December 2020

    Hi @rkumbhar,

    when I try to change the script from

    *DO,jj,EMIN,EMAX,1  
    

    to

    *DO,jj,EMIN,EMAX-1,1  
    

    The result it the same. It doesn't work either way.

  • BenjaminStarlingBenjaminStarling AustraliaPosts: 101Member

    What is the value of EMAX? Although there are only 2400 elements, your method requires that there are no gaps in numbering in your model. Try using the following.

    ESEL.....select elements you want to loop.
    CM,E_TEMP,ELEM                 !Temporary Component for Looping. In your case should be all elements you want to apply BFE.
    E_NEXT=ELNEXT(0)               !ELNEXT(0) is a FORTRAN routine that returns first element number, or 0 when there are no more elements.
    *DOWHILE,E_NEXT                !Dowhile loops end when 0 is returned.
        ...
        BFE,E_NEXT,HGEN,,qfsw      !Apply load to E_NEXT Element.
       ...
       CMSEL,S,E_TEMP,ELEM         !Remove the most recent checked/load applied element from the temporary set.
       ESEL,U,ELEM,,E_NEXT         !""
       CM,E_TEMP,ELEM              !""
       E_NEXT=ELNEXT(0)
    *ENDDO
    

    Body Loads, HGEN, is valid for Element 226.

    This method also has the advantage that the E_TEMP component is updated through each iteration. This allows for many other interesting logic loops within APDL.

  • ANSYS_FEM_GuyANSYS_FEM_Guy Posts: 16Member

    Hello @BenjaminStarling,

    thank you for your answer. I'm struggling a lil'bit to implement you method in my thermal loop.

    In my approach, I'm selecting the centroids of the elements and moving in Y direction with specified velocity. I'm confused how to convert it to your approach.


    Best regards

    Sam Donell

  • ANSYS_FEM_GuyANSYS_FEM_Guy Posts: 16Member

    @BenjaminStarling,

    I upload the model. Sorry for the language, but I'm momentarily living in Germany and due to this I have only access to a German ANSYS WB 19.2 Version.

    I tried my code separately, thermal and structural only, and it's running fine. But when I let them run simultaneously , the thermal code is neglected.


    Best regards

    Sam Donell

Sign In or Register to comment.