CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

fvOptions: Time dependent semiImplicitSource

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2021, 08:02
Default fvOptions: Time dependent semiImplicitSource
  #1
Member
 
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 6
uosilos is on a distinguished road
How can time dependency be added inside the explicit term of the semiImplicitSource??


This is my attempt but it shows: ‘runTime’ was not declared in this scope
mesh_.time().value() didn't work as well...



Code:
energySource
    {
        type            semiImplicitSource;

        timeStart       0;
        duration        0.025;
        selectionMode   cellSet;
        cellSet         ignitionCells;
                
        volumeMode      absolute;
                      
        sources
        {
         h
         {
            explicit
            {
                type coded;
                name heatInjection;
                code
                #{
                    
                   
                        const scalar tiempo = runTime.value(); //mesh_.time().value();
                        const scalar power = 0;
                            
                        const scalar tMax = 0.010;
                const scalar Pmax = 4e5; //Pmax/Vapp
                const scalar pCorte = 2.67e5; //2/3*Pmax;
                const scalar tCorte = 0.015774; //(-2-pow(0.5,(4-8/3)))/(-2/tMax);
                    
                    if (tiempo < tCorte)
                    {
                    power = ((-1/tMax)*pow(2,tiempo)+2*tiempo)/(tMax/Pmax);
                    }
                    else
                    {
                        power = (pow(2,tiempo)+pow(2,endTime)-2*tiempo*endTime)*pCorte/(pow(2,tCorte)+pow(2,endTime)-2*tCorte*endTime);
                    }
                    return power; 
                    
                #};
            }
            implicit 0;
            }
    }
/*
uosilos is offline   Reply With Quote

Old   July 2, 2021, 04:12
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 850
Blog Entries: 1
Rep Power: 19
dlahaye is on a distinguished road
const Time& tiempo = mesh().time();

See e.g. https://www.openfoam.com/documentati...ces-coded.html

Saludos, Domenico.
uosilos likes this.
dlahaye is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script for pseudo-parallel usage of reconstructPar kwardle OpenFOAM Post-Processing 42 May 7, 2024 23:17
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 09:10
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58


All times are GMT -4. The time now is 00:50.